From ca2f2ee914c82ce9e7d714915d61b191caba6ec4 Mon Sep 17 00:00:00 2001 From: buffet Date: Mon, 18 Mar 2024 12:17:29 +0100 Subject: [PATCH] feat: add nrb script using nvd --- users/buffet/default.nix | 2 ++ users/buffet/nvd.nix | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 users/buffet/nvd.nix diff --git a/users/buffet/default.nix b/users/buffet/default.nix index 6a2450b..4856419 100644 --- a/users/buffet/default.nix +++ b/users/buffet/default.nix @@ -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 diff --git a/users/buffet/nvd.nix b/users/buffet/nvd.nix new file mode 100644 index 0000000..aaf4f84 --- /dev/null +++ b/users/buffet/nvd.nix @@ -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" + '') + ]; + }; +}