Add nvd scripts

This commit is contained in:
David Morgan 2022-10-28 20:59:49 +01:00
parent 175f7c6c0b
commit 1b2afd4387
Signed by: djm
GPG Key ID: C171251002C200F2
3 changed files with 38 additions and 0 deletions

View File

@ -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

View File

@ -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
''

View File

@ -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
''