Improve home manager update script

main
jri 9 months ago
parent 0df634c254
commit f07817e065

@ -33,8 +33,10 @@
# nodejs packages
nodejs
yarn
biome
nodePackages.typescript-language-server
nodePackages.get-graphql-schema
# java packages
jdk

@ -15,3 +15,4 @@ alias `shx` = sudo -E helix -c '{{dirs.config}}/helix/config.toml'
{{#if-installed nix}}
alias devshell = nix develop -c $env.SHELL
{{/if-installed}}
def `silo cd` [] { silo repo | cd $in }

@ -3,9 +3,27 @@ def after_apply_all [] {
print $"(ansi red)home-manager is not installed(ansi reset)"
return
}
if (ha-chksum) == $env.SILO_HA_CHKSUM? {
print $"(ansi green)home-manager configuration unchanged(ansi reset)"
return;
}
print "Updating with home-manager"
( home-manager switch )
print "Expiring old home manager configurations"
( home-manager expire-generations -1 days )
print "Cleaning nix store"
( nix-store --gc )
ignore
}
def --env before_apply_all [] {
$env.SILO_HA_CHKSUM = (ha-chksum)
}
def ha-chksum [] {
shasum ~/.config/home-manager/home.nix
}

Loading…
Cancel
Save