feat: improve NixOS core functions

This commit is contained in:
Swarsel 2024-12-16 21:04:42 +01:00
parent f41ec53ee6
commit 61137e106f
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 127 additions and 129 deletions

View file

@ -4890,7 +4890,7 @@ This snipped is added to the activation script that is run after every rebuild a
system.activationScripts.diff = { system.activationScripts.diff = {
supportsDryActivation = true; supportsDryActivation = true;
text = '' text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff \ ${pkgs.nvd}/bin/nvd --color=always --nix-bin-dir=${pkgs.nix}/bin diff \
/run/current-system "$systemConfig" /run/current-system "$systemConfig"
''; '';
}; };
@ -7362,7 +7362,6 @@ This holds packages that I can use as provided, or with small modifications (as
nmap nmap
lsof lsof
nvd nvd
nh
nix-output-monitor nix-output-monitor
hyprpicker # color picker hyprpicker # color picker
findutils findutils
@ -8197,24 +8196,24 @@ Here we set some aliases (some of them should be shellApplications instead) as w
shellAliases = lib.recursiveUpdate shellAliases = lib.recursiveUpdate
{ {
hg = "history | grep"; hg = "history | grep";
hmswitch = "home-manager --flake ${config.swarselsystems.flakePath}#$(whoami)@$(hostname) switch"; hmswitch = "home-manager --flake ${config.swarselsystems.flakePath}#$(whoami)@$(hostname) switch |& nom";
nswitch = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) switch"; nswitch = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) --show-trace --log-format internal-json -v switch |& nom --json";
nboot = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) boot"; nboot = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) --show-trace --log-format internal-json -v boot |& nom --json";
magit = "emacsclient -nc -e \"(magit-status)\""; magit = "emacsclient -nc -e \"(magit-status)\"";
config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME"; config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME";
g = "git"; g = "git";
c = "git --git-dir=$HOME/.dotfiles/.git --work-tree=$HOME/.dotfiles/"; c = "git --git-dir=$FLAKE/.git --work-tree=$FLAKE/";
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;"; passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
passpull = "cd ~/.local/share/password-store; git pull; cd -;"; passpull = "cd ~/.local/share/password-store; git pull; cd -;";
hotspot = "nmcli connection up local; nmcli device wifi hotspot;"; hotspot = "nmcli connection up local; nmcli device wifi hotspot;";
cd = "z"; cd = "z";
cd-orig = "cd"; cd-orig = "cd";
cat-orig = "cat"; cat-orig = "cat";
cdr = "cd \"$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )\""; cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\"";
nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd"; nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff"; fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff";
lt = "ls -lath"; lt = "eza -las modified --total-size";
oldshell = "nix shell github:nixos/nixpkgs/\"$1\" \"$2\""; boot-diff = "nix store diff-closures /run/*-system";
} }
config.swarselsystems.shellAliases; config.swarselsystems.shellAliases;
autosuggestion.enable = true; autosuggestion.enable = true;

View file

@ -26,7 +26,6 @@
nmap nmap
lsof lsof
nvd nvd
nh
nix-output-monitor nix-output-monitor
hyprpicker # color picker hyprpicker # color picker
findutils findutils

View file

@ -5,24 +5,24 @@
shellAliases = lib.recursiveUpdate shellAliases = lib.recursiveUpdate
{ {
hg = "history | grep"; hg = "history | grep";
hmswitch = "home-manager --flake ${config.swarselsystems.flakePath}#$(whoami)@$(hostname) switch"; hmswitch = "home-manager --flake ${config.swarselsystems.flakePath}#$(whoami)@$(hostname) switch |& nom";
nswitch = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) switch"; nswitch = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) --show-trace --log-format internal-json -v switch |& nom --json";
nboot = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) boot"; nboot = "sudo nixos-rebuild --flake ${config.swarselsystems.flakePath}#$(hostname) --show-trace --log-format internal-json -v boot |& nom --json";
magit = "emacsclient -nc -e \"(magit-status)\""; magit = "emacsclient -nc -e \"(magit-status)\"";
config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME"; config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME";
g = "git"; g = "git";
c = "git --git-dir=$HOME/.dotfiles/.git --work-tree=$HOME/.dotfiles/"; c = "git --git-dir=$FLAKE/.git --work-tree=$FLAKE/";
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;"; passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
passpull = "cd ~/.local/share/password-store; git pull; cd -;"; passpull = "cd ~/.local/share/password-store; git pull; cd -;";
hotspot = "nmcli connection up local; nmcli device wifi hotspot;"; hotspot = "nmcli connection up local; nmcli device wifi hotspot;";
cd = "z"; cd = "z";
cd-orig = "cd"; cd-orig = "cd";
cat-orig = "cat"; cat-orig = "cat";
cdr = "cd \"$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )\""; cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\"";
nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd"; nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff"; fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff";
lt = "ls -lath"; lt = "eza -las modified --total-size";
oldshell = "nix shell github:nixos/nixpkgs/\"$1\" \"$2\""; boot-diff = "nix store diff-closures /run/*-system";
} }
config.swarselsystems.shellAliases; config.swarselsystems.shellAliases;
autosuggestion.enable = true; autosuggestion.enable = true;

View file

@ -3,7 +3,7 @@
system.activationScripts.diff = { system.activationScripts.diff = {
supportsDryActivation = true; supportsDryActivation = true;
text = '' text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff \ ${pkgs.nvd}/bin/nvd --color=always --nix-bin-dir=${pkgs.nix}/bin diff \
/run/current-system "$systemConfig" /run/current-system "$systemConfig"
''; '';
}; };