feat: add nrb script using nvd

This commit is contained in:
buffet 2024-03-18 12:17:29 +01:00
parent ab6a2b668e
commit ca2f2ee914
2 changed files with 23 additions and 0 deletions

View file

@ -14,6 +14,7 @@
./gpg.nix
./ime.nix
./mako.nix
./nvd.nix
./sway.nix
];
@ -42,6 +43,7 @@
packages = with pkgs; [
unstable.anki
unstable.logseq
alejandra
python3

21
users/buffet/nvd.nix Normal file
View file

@ -0,0 +1,21 @@
{pkgs, ...}: {
home-manager.users.buffet = {
home.packages = [
(pkgs.writeScriptBin "nrb" ''
#!/usr/bin/env bash
[[ $UID == 0 ]] || {
echo need to run as root
exit 1
}
nixos-rebuild build --flake ~buffet/rice#alice || exit 1
diff="$(${pkgs.nvd}/bin/nvd diff /run/current-system result)"
rm result
nixos-rebuild switch --flake ~buffet/rice#alice
echo '***'
printf '%s' "$diff"
'')
];
};
}