|
|
@ -1,4 +1,8 @@
|
|
|
|
def after_apply_all [] {
|
|
|
|
def after_apply_all [] {
|
|
|
|
|
|
|
|
if $env.SILO_HM_CALLED? != null {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.SILO_HM_CALLED = true
|
|
|
|
if not ('~/.nix-profile/bin/home-manager' | path exists) {
|
|
|
|
if not ('~/.nix-profile/bin/home-manager' | path exists) {
|
|
|
|
print $"(ansi red)home-manager is not installed(ansi reset)"
|
|
|
|
print $"(ansi red)home-manager is not installed(ansi reset)"
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -16,14 +20,48 @@ def after_apply_all [] {
|
|
|
|
print "Cleaning nix store"
|
|
|
|
print "Cleaning nix store"
|
|
|
|
( nix-store --gc )
|
|
|
|
( nix-store --gc )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "Linking applications"
|
|
|
|
|
|
|
|
link-applications
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "Clearing invalid application links"
|
|
|
|
|
|
|
|
clear-invalid-links
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "Applying silo config after package install"
|
|
|
|
|
|
|
|
( silo apply )
|
|
|
|
ignore
|
|
|
|
ignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def --env before_apply_all [] {
|
|
|
|
def --env before_apply_all [] {
|
|
|
|
|
|
|
|
if $env.SILO_HM_CALLED? != null {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
$env.SILO_HA_CHKSUM = (ha-chksum)
|
|
|
|
$env.SILO_HA_CHKSUM = (ha-chksum)
|
|
|
|
|
|
|
|
$env.PATH = ($env.PATH | append $"($env.HOME)/.nix-profile/bin")
|
|
|
|
|
|
|
|
ignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def ha-chksum [] {
|
|
|
|
def ha-chksum [] {
|
|
|
|
shasum ~/.config/home-manager/home.nix
|
|
|
|
shasum ~/.config/home-manager/home.nix
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def link-applications [] {
|
|
|
|
|
|
|
|
( glob ~/.nix-profile/share/applications/*.desktop
|
|
|
|
|
|
|
|
| par-each { try { ln -s $in ~/.local/share/applications/; print $"Linked ($in)" } } )
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clear-invalid-links [] {
|
|
|
|
|
|
|
|
( glob /home/jri/.local/share/applications/*.desktop
|
|
|
|
|
|
|
|
| each { ls -l $in }
|
|
|
|
|
|
|
|
| flatten
|
|
|
|
|
|
|
|
| where target? != null
|
|
|
|
|
|
|
|
| par-each {|entry| get target
|
|
|
|
|
|
|
|
| open $in
|
|
|
|
|
|
|
|
| parse -r '\nTryExec\s?=\s?(?<bin>[^\n]+)'
|
|
|
|
|
|
|
|
| get -i 0
|
|
|
|
|
|
|
|
| default {}
|
|
|
|
|
|
|
|
| merge $entry }
|
|
|
|
|
|
|
|
| where bin? != null
|
|
|
|
|
|
|
|
| where {|e| which $e.bin | is-empty }
|
|
|
|
|
|
|
|
| each {|e| rm $e.name; print $"Cleared ($e.name)" }
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|