mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 06:19:00 +00:00
home-manager/files/mutable-files: refactor module
This commit is contained in:
parent
96d6a446e1
commit
883138bbde
@ -3,8 +3,12 @@
|
|||||||
let
|
let
|
||||||
cfg = config.home.mutableFile;
|
cfg = config.home.mutableFile;
|
||||||
|
|
||||||
|
runtimeInputs = lib.makeBinPath (with pkgs; [
|
||||||
|
archiver curl git gopass
|
||||||
|
]);
|
||||||
|
|
||||||
# An attribute set to be used to get the fetching script.
|
# An attribute set to be used to get the fetching script.
|
||||||
fetchScript = path: value:
|
fetchScript = _: value:
|
||||||
let
|
let
|
||||||
url = lib.escapeShellArg value.url;
|
url = lib.escapeShellArg value.url;
|
||||||
path = lib.escapeShellArg value.path;
|
path = lib.escapeShellArg value.path;
|
||||||
@ -177,10 +181,6 @@ in
|
|||||||
)
|
)
|
||||||
'')
|
'')
|
||||||
cfg;
|
cfg;
|
||||||
|
|
||||||
runtimeInputs = lib.makeBinPath (with pkgs; [
|
|
||||||
archiver curl git gopass
|
|
||||||
]);
|
|
||||||
in
|
in
|
||||||
pkgs.writeShellScript "fetch-mutable-files" ''
|
pkgs.writeShellScript "fetch-mutable-files" ''
|
||||||
export PATH=${runtimeInputs}
|
export PATH=${runtimeInputs}
|
||||||
@ -192,14 +192,11 @@ in
|
|||||||
mutableFilesCmds = lib.mapAttrsToList
|
mutableFilesCmds = lib.mapAttrsToList
|
||||||
(path: value: value.postScript)
|
(path: value: value.postScript)
|
||||||
cfg;
|
cfg;
|
||||||
|
|
||||||
script = pkgs.writeShellApplication {
|
|
||||||
name = "fetch-mutable-files-post-script";
|
|
||||||
runtimeInputs = with pkgs; [ archiver curl git gopass ];
|
|
||||||
text = lib.concatStringsSep "\n" mutableFilesCmds;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
"${script}/bin/fetch-mutable-files-post-script";
|
pkgs.writeShellScript "fetch-mutable-files-post-script" ''
|
||||||
|
export PATH=${runtimeInputs}
|
||||||
|
${lib.concatStringsSep "\n" mutableFilesCmds}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = [ "default.target" ];
|
Install.WantedBy = [ "default.target" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user