70 lines
2.4 KiB
Nix
70 lines
2.4 KiB
Nix
{ 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
|
|
'')
|
|
];
|
|
|
|
}
|