Adds report-hm-changes script
This commit is contained in:
parent
9976991058
commit
a2d2812bd2
2
home.nix
2
home.nix
|
@ -1,7 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./programs ./launchd.nix ./nix.nix ];
|
||||
imports = [ ./programs ./scripts ./launchd.nix ./nix.nix ];
|
||||
|
||||
home.username = "abhinav";
|
||||
home.homeDirectory = "/Users/abhinav";
|
||||
|
|
1
justfile
1
justfile
|
@ -25,6 +25,7 @@ build: (_run "_build")
|
|||
|
||||
_switch:
|
||||
home-manager -v switch --flake "{{ root_dir }}#abhinav"
|
||||
report-hm-changes
|
||||
|
||||
# switch to latest home-manager generation
|
||||
switch: (_run "_switch")
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
rc = pkgs.callPackage ./report-hm-changes.nix { inherit config pkgs; };
|
||||
in {
|
||||
home.packages = [ rc ];
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link";
|
||||
in
|
||||
pkgs.writeShellScriptBin "report-hm-changes" ''
|
||||
# Disable nvd if there are less than 2 hm profiles.
|
||||
if [ $(ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
|
||||
echo "Skipping changes report..."
|
||||
else
|
||||
${pkgs.nvd}/bin/nvd diff $(ls -d1v ${profiles} | tail -2)
|
||||
fi
|
||||
''
|
Loading…
Reference in New Issue