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,15 +146,27 @@ 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 =
let
bindScript = dir: ''
mkdir -p /network/$USER/${dir}
${pkgs.bindfs}/bin/bindfs /network/$USER/${dir} $HOME/${dir}
'';
in
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if ! ${pkgs.krb5}/bin/klist -s; then
echo "No kerberos ticket found"
${pkgs.krb5}/bin/kinit
fi
if ${pkgs.krb5}/bin/klist -s; then if ${pkgs.krb5}/bin/klist -s; then
echo "Kerberos ticket found, mounting home directory" echo "Kerberos ticket found, mounting home directory"
ln -s /network/$USER/Documents $HOME/Documents || true ${bindScript "Documents"}
ln -s /network/$USER/Music $HOME/Music || true ${bindScript "Music"}
ln -s /network/$USER/Pictures $HOME/Pictures || true ${bindScript "Pictures"}
ln -s /network/$USER/Video $HOME/Video || true ${bindScript "Video"}
else else
echo "No kerberos ticket found" echo "Still no kerberos ticket found, skipping home directory mount"
fi fi
''; '';
} }