diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-10-28 20:59:49 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-10-28 20:59:49 +0100 |
commit | 1b2afd438743e6460b79c366dc1835c8fb7eb671 (patch) | |
tree | 1d5c4fb321a1aadc4d9b81395311908d23905509 /nix-conf | |
parent | 175f7c6c0ba4af1bd35da282bc819ddc1e9eb4ff (diff) | |
download | dotfiles-1b2afd438743e6460b79c366dc1835c8fb7eb671.tar.gz |
Add nvd scripts
Diffstat (limited to 'nix-conf')
-rw-r--r-- | nix-conf/home/includes/common.nix | 7 | ||||
-rw-r--r-- | nix-conf/home/includes/scripts/hm-changes-report.nix | 16 | ||||
-rw-r--r-- | nix-conf/home/includes/scripts/system-changes-report.nix | 15 |
3 files changed, 38 insertions, 0 deletions
diff --git a/nix-conf/home/includes/common.nix b/nix-conf/home/includes/common.nix index 6d177da..2f06409 100644 --- a/nix-conf/home/includes/common.nix +++ b/nix-conf/home/includes/common.nix @@ -1,4 +1,8 @@ { config, pkgs, ... }: +let + hcr = pkgs.callPackage ./scripts/hm-changes-report.nix { inherit config pkgs; }; + scr = pkgs.callPackage ./scripts/system-changes-report.nix { inherit config pkgs; }; +in { imports = [ @@ -6,6 +10,9 @@ ]; home.packages = with pkgs; [ + hcr + scr + aspell aspellDicts.en aspellDicts.en-computers diff --git a/nix-conf/home/includes/scripts/hm-changes-report.nix b/nix-conf/home/includes/scripts/hm-changes-report.nix new file mode 100644 index 0000000..ec31a73 --- /dev/null +++ b/nix-conf/home/includes/scripts/hm-changes-report.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +# https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix +let + #hm-profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link"; + hm-profiles = "/nix/var/nix/profiles/per-user/djm/home-manager-*-link"; +in +pkgs.writeShellScriptBin "hm-changes-report" '' + # Disable nvd if there are less than 2 hm profiles. + if [ $(ls -d1v ${hm-profiles} 2>/dev/null | wc -l) -lt 2 ]; then + echo "Skipping changes report..." + else + ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${hm-profiles} | tail -2) + fi +'' + diff --git a/nix-conf/home/includes/scripts/system-changes-report.nix b/nix-conf/home/includes/scripts/system-changes-report.nix new file mode 100644 index 0000000..56166cb --- /dev/null +++ b/nix-conf/home/includes/scripts/system-changes-report.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +# https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix +let + system-profiles = "/nix/var/nix/profiles/system-*-link"; +in +pkgs.writeShellScriptBin "system-changes-report" '' + # Disable nvd if there are less than 2 hm profiles. + if [ $(ls -d1v ${system-profiles} 2>/dev/null | wc -l) -lt 2 ]; then + echo "Skipping changes report..." + else + ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${system-profiles} | tail -2) + fi +'' + |