scripts: make hcr a regular script to immediately report changes after a switch

This commit is contained in:
Gabriel Volpe committed 2022-10-25 15:27:27 +02:00
1 parent e7c9f99931
commit e28a220d00
3 files changed
+23 -21

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
{ config, pkgs, ... }:
let
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link";
in
pkgs.writeShellScriptBin "hm-changes-report" ''
# 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
''
+9 -21
View File
@@ -2,29 +2,17 @@ let
scripts = { config, lib, pkgs, ... }:
let
gen-ssh-key = pkgs.callPackage ./gen-ssh-key.nix { inherit pkgs; };
hms = pkgs.callPackage ./switcher.nix { inherit config pkgs; };
hcr = pkgs.callPackage ./changes-report.nix { inherit config pkgs; };
kls = pkgs.callPackage ./keyboard-layout-switch.nix { inherit pkgs; };
szp = pkgs.callPackage ./show-zombie-parents.nix { inherit pkgs; };
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link";
in
{
home = {
activation.changesReport = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# 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
$DRY_RUN_CMD ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${profiles} | tail -2)
fi
'';
packages =
[
gen-ssh-key # generate ssh key and add it to the system
kls # switch keyboard layout
szp # show zombie parents
# hms # custom home-manager switcher that considers the current DISPLAY
];
};
home.packages = [
hcr # home-manager changes report between generations
gen-ssh-key # generate ssh key and add it to the system
kls # switch keyboard layout
szp # show zombie parents
];
};
in [ scripts ]
in
[ scripts ]
+1
View File
@@ -7,6 +7,7 @@ activateHM() {
rm ~/.config/orage/oragerc.bak
rm -rf ~/.config/secrets
HOME_MANAGER_BACKUP_EXT=bak result/activate
hm-changes-report
}
rebuild_home_edp() {