Compare commits

..

1 Commits

Author SHA1 Message Date
a131294402 Update README.md 2025-10-08 22:42:16 +02:00
6 changed files with 86 additions and 156 deletions

26
README.md Normal file
View File

@@ -0,0 +1,26 @@
> Moved to https://github.com/cupcakearmy/nix/tree/main/cli
# Nix
Nix setup for server
## Install
```bash
# First time install
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Install / Update
nix run home-manager -- switch --flake github:cupcakearmy/nix-cli#root -b bkp
```
## Update
This can be run on any machine. Just update and then just rerun on the targets
```bash
nix flake update
# To test
nix run home-manager -- build --flake .#root
```

12
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1759853171, "lastModified": 1735774425,
"narHash": "sha256-uqbhyXtqMbYIiMqVqUhNdSuh9AEEkiasoK3mIPIVRhk=", "narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1a09eb84fa9e33748432a5253102d01251f72d6d", "rev": "5f6aa268e419d053c3d5025da740e390b12ac936",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -22,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1759831965, "lastModified": 1735471104,
"narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=", "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c9b6fb798541223bbb396d287d16f43520250518", "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,5 +1,5 @@
{ {
description = "Server Shell"; description = "nix base CLI env";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@@ -10,31 +10,15 @@
}; };
outputs = outputs =
{ { nixpkgs, home-manager, ... }:
nixpkgs,
home-manager,
...
}:
let let
profiles = import ./profiles.nix; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in in
{ {
homeConfigurations = nixpkgs.lib.genAttrs (builtins.map (user: user.username) profiles) ( homeConfigurations."root" = home-manager.lib.homeManagerConfiguration {
user: inherit pkgs;
let modules = [ ./home.nix ];
system = (nixpkgs.lib.findFirst (u: u.username == user) null profiles).architecture; };
pkgs = nixpkgs.legacyPackages.${system};
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = {
username = user;
homeDirectory = (nixpkgs.lib.findFirst (u: u.username == user) null profiles).homeDirectory;
};
}
);
}; };
} }

104
home.nix
View File

@@ -1,88 +1,76 @@
{ { config, pkgs, ... }:
config,
pkgs,
username,
homeDirectory,
...
}:
{ {
home.username = username;
home.homeDirectory = homeDirectory;
home.stateVersion = "25.11";
home.packages = (import ./pkgs.nix { inherit pkgs; });
fonts.fontconfig.enable = true;
home = { home = {
username = "root";
homeDirectory = "/root";
stateVersion = "25.05"; # Please read the comment before changing.
packages = with pkgs; [
neovim
tmux
git
gnutar
btop
# Rust utils
bat
eza
fd
ripgrep
ripgrep-all
zoxide
uutils-coreutils-noprefix
dust
yazi
starship
rclone
nerd-fonts.jetbrains-mono
];
sessionVariables = { sessionVariables = {
EDITOR = "nvim"; EDITOR = "nvim";
}; };
shellAliases = { shellAliases = {
# Rust re-maps
l = "eza -a1lh"; l = "eza -a1lh";
ls = "eza"; ls = "eza";
cat = "bat";
cd = "z";
# QOL
dc = "docker compose"; dc = "docker compose";
rsync = "rsync -az --info=progress2"; rsync = "rsync -az --info=progress2";
t = "tmux new-session -A -s main"; t = "tmux new-session -A -s main";
e = "nvim"; e = "nvim";
g = "lazygit"; g = "lazygit";
d = "lazydocker"; d = "lazydocker";
p = "pnpm"; vai = "home-manager switch --flake github:cupcakearmy/nix-cli#root -b backup";
px = "pnpm -s dlx";
n = "fnm use --install-if-missing";
c = "pwd | pbcopy";
k = "kubectl";
vai = "sudo darwin-rebuild switch --flake ~/.config/nix-macos#${username}";
}; };
}; };
programs = { programs = {
direnv.enable = true; home-manager.enable = true;
zoxide.enable = true; starship.enable = true;
bash.enable = true;
fish = { fish.enable = true;
enable = true;
interactiveShellInit = ''
if type -q starship
starship init fish | source
end
if type -q fnm
fnm env --use-on-cd | source
end
if type -q nvs
nvs env --source | source
end
'';
};
bash = {
enable = true;
};
tmux = { tmux = {
enable = true; enable = true;
clock24 = true; clock24 = true;
mouse = true; mouse = true;
extraConfig = '' extraConfig = ''
# switch panes using Alt-arrow without prefix # switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L bind -n M-Left select-pane -L
bind -n M-Right select-pane -R bind -n M-Right select-pane -R
bind -n M-Up select-pane -U bind -n M-Up select-pane -U
bind -n M-Down select-pane -D bind -n M-Down select-pane -D
# switch panes using jkhl # switch panes using jkhl
bind h select-pane -L bind h select-pane -L
bind l select-pane -R bind l select-pane -R
bind j select-pane -U bind j select-pane -U
bind k select-pane -D bind k select-pane -D
''; '';
shell = "${pkgs.fish}/bin/fish"; shell = "${pkgs.fish}/bin/fish";
terminal = "tmux-256color"; terminal = "tmux-256color";
}; };

View File

@@ -1,46 +0,0 @@
{ pkgs }:
with pkgs;
[
# Base
tmux
git
git-lfs
git-crypt
gnutar
gnupg
htop
btop
rclone
rename
tmux
tree
wget
rsync
yq
delta
# Rust utils
bat
eza
fd
ripgrep
ripgrep-all
zoxide
uutils-coreutils-noprefix
dust
yazi
starship
# Dev
lazydocker
k9s
kubectl
# Editor
neovim
fzf
lazygit
# Fonts
nerd-fonts.jetbrains-mono
]

View File

@@ -1,22 +0,0 @@
[
{
username = "root_x86_linux";
architecture = "x86_64-linux";
homeDirectory = "/root";
}
{
username = "root_x86_macos";
architecture = "x86_64-darwin";
homeDirectory = "/root";
}
{
username = "root_arm_linux";
architecture = "aarch64-linux";
homeDirectory = "/root";
}
{
username = "root_arm_macos";
architecture = "aarch64-darwin";
homeDirectory = "/root";
}
]