Moved to bind mounts

This commit is contained in:
Jan-Bulthuis 2025-06-10 03:23:30 +02:00
parent 5ade637e57
commit 0305b8d33a

View File

@ -146,17 +146,29 @@ in
modules.profiles.base.enable = true; modules.profiles.base.enable = true;
# Mount the directories from the network share # Mount the directories from the network share
home.activation.dirMount = lib.hm.dag.entryAfter [ "writeBoundary" ] '' home.activation.dirMount =
if ${pkgs.krb5}/bin/klist -s; then let
echo "Kerberos ticket found, mounting home directory" bindScript = dir: ''
ln -s /network/$USER/Documents $HOME/Documents || true mkdir -p /network/$USER/${dir}
ln -s /network/$USER/Music $HOME/Music || true ${pkgs.bindfs}/bin/bindfs /network/$USER/${dir} $HOME/${dir}
ln -s /network/$USER/Pictures $HOME/Pictures || true '';
ln -s /network/$USER/Video $HOME/Video || true in
else lib.hm.dag.entryAfter [ "writeBoundary" ] ''
echo "No kerberos ticket found" if ! ${pkgs.krb5}/bin/klist -s; then
fi echo "No kerberos ticket found"
''; ${pkgs.krb5}/bin/kinit
fi
if ${pkgs.krb5}/bin/klist -s; then
echo "Kerberos ticket found, mounting home directory"
${bindScript "Documents"}
${bindScript "Music"}
${bindScript "Pictures"}
${bindScript "Video"}
else
echo "Still no kerberos ticket found, skipping home directory mount"
fi
'';
} }
) )
] ++ config.home-manager.sharedModules; ] ++ config.home-manager.sharedModules;