mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 10:58:02 +00:00
modules/mutable-files: update module to be more usable
This commit is contained in:
parent
56635f0502
commit
8210f3274e
@ -20,8 +20,11 @@ let
|
||||
The path of the mutable file. By default, it will be relative to the
|
||||
home directory.
|
||||
'';
|
||||
default = "${homeDir}/${name}";
|
||||
example = lib.literalExpression "\${config.xdg.userDirs.documents}/top-secret";
|
||||
apply = p:
|
||||
let
|
||||
absDir = if lib.hasPrefix "/" p then p else "${baseDir}/${p}";
|
||||
in lib.removePrefix "${baseDir}/" absDir;
|
||||
};
|
||||
|
||||
extractPath = lib.mkOption {
|
||||
@ -44,7 +47,8 @@ let
|
||||
|
||||
- For `fetch`, the file will be fetched with `curl`.
|
||||
- For `git`, it will be fetched with `git clone`.
|
||||
- For `archive`, the file will be extracted before putting the file.
|
||||
- For `archive`, the file will be fetched with `curl` and extracted
|
||||
before putting the file.
|
||||
|
||||
The default type is `fetch`.
|
||||
'';
|
||||
@ -130,11 +134,7 @@ in
|
||||
'')
|
||||
cfg;
|
||||
|
||||
script = pkgs.writeShellApplication {
|
||||
name = "put-mutable-files";
|
||||
runtimeInputs = with pkgs; [ archiver curl git ];
|
||||
text = lib.concatStringsSep "\n" mutableFilesCmds;
|
||||
};
|
||||
script = pkgs.writeScriptBin "put-mutable-files" (lib.concatStringsSep "\n" mutableFilesCmds);
|
||||
in
|
||||
"${script}/bin/put-mutable-files";
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user