feat(PABU): cleanup and add deploy helper
This commit is contained in:
parent
69f9f9d51a
commit
ce5aa85b30
5 changed files with 140 additions and 69 deletions
35
hosts/PABU/applications.nix
Normal file
35
hosts/PABU/applications.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ pkgs, ... }@inputs: {
|
||||||
|
|
||||||
|
# welcome to nix
|
||||||
|
programs.nix-ld = { enable = true; };
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
# bare essentials
|
||||||
|
git
|
||||||
|
neovim
|
||||||
|
tmux
|
||||||
|
eza
|
||||||
|
expect
|
||||||
|
fzf
|
||||||
|
gum
|
||||||
|
# mason needs stuff
|
||||||
|
gcc
|
||||||
|
clang-tools
|
||||||
|
cargo
|
||||||
|
nodejs_24
|
||||||
|
jdk
|
||||||
|
tree-sitter
|
||||||
|
python3
|
||||||
|
go
|
||||||
|
# mason needs stuff
|
||||||
|
unzip
|
||||||
|
# telescope
|
||||||
|
fzf
|
||||||
|
ripgrep
|
||||||
|
# stuff
|
||||||
|
nixd
|
||||||
|
nixfmt-rfc-style
|
||||||
|
inputs.agenix.packages.x86_64-linux.default
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,71 +1,9 @@
|
||||||
{ lib, pkgs, modulesPath, ... }@inputs: {
|
{ modulesPath, ... }: {
|
||||||
imports = [ (modulesPath + "/profiles/minimal.nix") ];
|
imports = [
|
||||||
|
(modulesPath + "/profiles/minimal.nix")
|
||||||
# Installing a new system within the nspawn means that the /sbin/init script
|
./applications.nix
|
||||||
# just needs to be updated, as there is no bootloader.
|
./network.nix
|
||||||
system.build.installBootLoader = pkgs.writeScript "install-sbin-init.sh" ''
|
./system.nix
|
||||||
#!${pkgs.runtimeShell}
|
./user.nix
|
||||||
${pkgs.coreutils}/bin/ln -fs "$1/init" /sbin/init
|
|
||||||
'';
|
|
||||||
|
|
||||||
system.activationScripts.installInitScript = lib.mkForce ''
|
|
||||||
${pkgs.coreutils}/bin/ln -fs $systemConfig/init /sbin/init
|
|
||||||
'';
|
|
||||||
|
|
||||||
boot.isContainer = true;
|
|
||||||
networking.hostName = "PABU";
|
|
||||||
|
|
||||||
nix = {
|
|
||||||
settings = {
|
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
auto-optimise-store = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.groups.gandalf = { gid = 1000; };
|
|
||||||
|
|
||||||
users.users.gandalf = {
|
|
||||||
isNormalUser = true;
|
|
||||||
home = "/home/gandalf";
|
|
||||||
createHome = true;
|
|
||||||
group = "gandalf";
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
security.sudo.wheelNeedsPassword = false;
|
|
||||||
|
|
||||||
# welcome to nix
|
|
||||||
programs.nix-ld = { enable = true; };
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
|
|
||||||
# bare essentials
|
|
||||||
git
|
|
||||||
neovim
|
|
||||||
|
|
||||||
# mason needs stuff
|
|
||||||
gcc
|
|
||||||
clang-tools
|
|
||||||
cargo
|
|
||||||
nodejs_24
|
|
||||||
jdk
|
|
||||||
tree-sitter
|
|
||||||
python3
|
|
||||||
go
|
|
||||||
|
|
||||||
# mason needs stuff
|
|
||||||
unzip
|
|
||||||
|
|
||||||
# telescope
|
|
||||||
fzf
|
|
||||||
ripgrep
|
|
||||||
|
|
||||||
# stuff
|
|
||||||
nixfmt-rfc-style
|
|
||||||
|
|
||||||
inputs.agenix.packages.x86_64-linux.default
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
hosts/PABU/network.nix
Normal file
1
hosts/PABU/network.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ networking.hostName = "PABU"; }
|
||||||
27
hosts/PABU/system.nix
Normal file
27
hosts/PABU/system.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{ lib, pkgs, ... }: {
|
||||||
|
|
||||||
|
# Installing a new system within the nspawn means that the /sbin/init script
|
||||||
|
# just needs to be updated, as there is no bootloader.
|
||||||
|
system.build.installBootLoader = pkgs.writeScript "install-sbin-init.sh" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
${pkgs.coreutils}/bin/ln -fs "$1/init" /sbin/init
|
||||||
|
'';
|
||||||
|
|
||||||
|
system.activationScripts.installInitScript = lib.mkForce ''
|
||||||
|
${pkgs.coreutils}/bin/ln -fs $systemConfig/init /sbin/init
|
||||||
|
'';
|
||||||
|
|
||||||
|
boot.isContainer = true;
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
security.sudo.wheelNeedsPassword = false;
|
||||||
|
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
}
|
||||||
70
hosts/PABU/user.nix
Normal file
70
hosts/PABU/user.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
{ lib, pkgs, ... }: {
|
||||||
|
|
||||||
|
users.groups.gandalf = { gid = 1000; };
|
||||||
|
|
||||||
|
users.users.gandalf = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/gandalf";
|
||||||
|
createHome = true;
|
||||||
|
group = "gandalf";
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
ohMyZsh = {
|
||||||
|
enable = true;
|
||||||
|
theme = "half-life";
|
||||||
|
};
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
autosuggestions.enable = true;
|
||||||
|
shellAliases = {
|
||||||
|
ls = "${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons";
|
||||||
|
la =
|
||||||
|
"${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la";
|
||||||
|
ll =
|
||||||
|
"${pkgs.expect}/bin/unbuffer ${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la | ${pkgs.less}/bin/less -r";
|
||||||
|
lt =
|
||||||
|
"${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la --tree";
|
||||||
|
llt =
|
||||||
|
"${pkgs.expect}/bin/unbuffer ${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la --tree | ${pkgs.less}/bin/less -r";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.writeShellScriptBin "n" ''
|
||||||
|
set -euo pipefail
|
||||||
|
action=$(${pkgs.gum}/bin/gum choose switch test clean)
|
||||||
|
target=$(${pkgs.gum}/bin/gum choose PABU APPA MOMO)
|
||||||
|
case "$action" in
|
||||||
|
"clean")
|
||||||
|
case "$target" in
|
||||||
|
"PABU")
|
||||||
|
gum log -t kitchen -l info "Running: sudo nix-collect-garbage -d && nix store gc && nix-store --optimise"
|
||||||
|
sudo nix-collect-garbage -d && nix store gc && nix-store --optimise
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
gum log -t kitchen -l info "Running: ssh $target \"nix-collect-garbage -d && nix store gc && nix-store --optimise\""
|
||||||
|
ssh $target "nix-collect-garbage -d && nix store gc && nix-store --optimise"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
case "$target" in
|
||||||
|
"PABU")
|
||||||
|
gum log -t kitchen -l info "Running: sudo nixos-rebuild $action --option sandbox false --flake .#PABU"
|
||||||
|
sudo nixos-rebuild $action --option sandbox false --flake .#PABU
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
gum log -t kitchen -l info "Running: nixos-rebuild $action --build-host $target --target-host $target --flake .#$target"
|
||||||
|
nixos-rebuild $action --build-host $target --target-host $target --flake .#$target
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue