mirror of
https://github.com/bdnugget/nix-config.git
synced 2026-11-07 09:07:27 +00:00
scripts: make hcr a regular script to immediately report changes after a switch
This commit is contained in:
3 files changed
+23
-21
No files matched your search
@@ -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
|
||||
''
|
||||
@@ -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 ]
|
||||
Reference in new issue
Block a user