Factor out file-tree config
This commit is contained in:
parent
e6d9c5cb33
commit
897cb95155
|
@ -100,19 +100,7 @@ in
|
||||||
LimitNOFILE = "1024000";
|
LimitNOFILE = "1024000";
|
||||||
};
|
};
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
preStart =
|
preStart = "ln -sfT ${pkgs.setToDirectories cfg.cfgFiles} ${cfgDir}";
|
||||||
let
|
|
||||||
linkToPath = path: fileOrDir:
|
|
||||||
(if types.path.check fileOrDir then
|
|
||||||
[ "ln -sT ${fileOrDir} ${path}" ]
|
|
||||||
else
|
|
||||||
[ "mkdir -p ${path}" ] ++ lib.concatLists (lib.mapAttrsToList
|
|
||||||
(dirName: content: linkToPath "${path}/${dirName}" content)
|
|
||||||
fileOrDir));
|
|
||||||
cfgDirContent = pkgs.runCommand "laminar-cfg-dir" { }
|
|
||||||
(lib.concatStringsSep "\n" (linkToPath "$out" cfg.cfgFiles));
|
|
||||||
in
|
|
||||||
"ln -sfT ${cfgDirContent} ${cfgDir}";
|
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
nginx = {
|
nginx = {
|
||||||
|
|
19
overlays/file-tree.nix
Normal file
19
overlays/file-tree.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
final: prev:
|
||||||
|
let
|
||||||
|
inherit (prev) lib;
|
||||||
|
linkToPath = path: fileOrDir:
|
||||||
|
(
|
||||||
|
if lib.types.path.check fileOrDir then
|
||||||
|
[ "ln -sT ${fileOrDir} ${path}" ]
|
||||||
|
else
|
||||||
|
[ "mkdir -p ${path}" ] ++ lib.concatLists (
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(dirName: content: linkToPath "${path}/${dirName}" content)
|
||||||
|
fileOrDir
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
setToDirectories = files: prev.runCommand "set-to-directories" { }
|
||||||
|
(lib.concatStringsSep "\n" (linkToPath "$out" files));
|
||||||
|
}
|
Loading…
Reference in a new issue