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
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