Do not sync direnv

It will only add the the cache to gcroots on the first computer that
built it, so everyone else has to re-fetch it.
This commit is contained in:
Geoffrey Frogeye 2025-05-19 21:48:44 +02:00
parent 3690815630
commit 65817f4e70

View file

@ -1,5 +1,8 @@
# Allow switching to a specific environment when going into a directory
{
config,
lib,
pkgs,
...
}:
{
@ -11,7 +14,46 @@
enableZshIntegration = true;
nix-direnv.enable = true;
};
git.ignores = [ ".envrc" ".direnv" ];
git.ignores = [
".envrc"
".direnv"
];
};
systemd.user.services.direnv_ignore = {
Service = {
Type = "oneshot";
ExecStart = lib.getExe (
pkgs.writeShellApplication {
name = "direnv_ignore";
text =
''
ignore_direnv() {
dir="$1"
if [ ! -f "$dir/.stignore" ]
then
touch "$dir/.stignore"
fi
rule="**/.direnv"
if ! grep -qFx "$rule" "$dir/.stignore"
then
echo "$rule" >> "$dir/.stignore"
fi
}
''
+ (lib.trivial.pipe config.frogeye.folders [
builtins.attrValues
(builtins.filter (folder: folder.syncthing.enable))
(builtins.map (folder: ''
ignore_direnv ${lib.strings.escapeShellArg folder.fullPath}
''))
lib.strings.concatLines
]);
}
);
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}