Compare commits
4 commits
c268638fd7
...
f5ec539a68
Author | SHA1 | Date | |
---|---|---|---|
f5ec539a68 | |||
52ee8bab58 | |||
![]() |
8ce9bd9cad | ||
1046bbb70b |
3 changed files with 45 additions and 7 deletions
18
LICENSE.md
Normal file
18
LICENSE.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
Copyright 2023-2024 Clan contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -46,6 +46,12 @@ let
|
|||
fi
|
||||
'') (lib.attrValues gen.files)}
|
||||
|
||||
# outputs
|
||||
out=$(mktemp -d)
|
||||
trap 'rm -rf $out' EXIT
|
||||
export out
|
||||
mkdir -p "$out"
|
||||
|
||||
if [ $all_files_missing = false ] && [ $all_files_present = false ] ; then
|
||||
echo "Inconsistent state for generator: ${gen.name}"
|
||||
exit 1
|
||||
|
@ -80,12 +86,6 @@ let
|
|||
'') (lib.attrValues config.vars.generators.${input}.files)}
|
||||
'') gen.dependencies}
|
||||
|
||||
# outputs
|
||||
out=$(mktemp -d)
|
||||
trap 'rm -rf $out' EXIT
|
||||
export out
|
||||
mkdir -p "$out"
|
||||
|
||||
(
|
||||
# prepare PATH
|
||||
unset PATH
|
||||
|
@ -112,8 +112,15 @@ let
|
|||
mkdir -p "$(dirname "$OUT_FILE")"
|
||||
mv "$out"/${file.name} "$OUT_FILE"
|
||||
'') (lib.attrValues gen.files)}
|
||||
rm -rf "$out"
|
||||
fi
|
||||
|
||||
# move the files to the correct location
|
||||
${lib.concatMapStringsSep "\n" (file: ''
|
||||
OUT_FILE="$OUT_DIR"/${if file.secret then "secret" else "public"}/${file.generator}/${file.name}
|
||||
chown ${file.owner}:${file.group} "''${OUT_FILE}"
|
||||
chmod ${file.mode} "''${OUT_FILE}"
|
||||
'') (lib.attrValues gen.files)}
|
||||
rm -rf "$out"
|
||||
'') sortedGenerators}
|
||||
'';
|
||||
};
|
||||
|
|
13
options.nix
13
options.nix
|
@ -82,6 +82,19 @@
|
|||
default = generator.config.name;
|
||||
defaultText = "Name of the generator";
|
||||
};
|
||||
owner = lib.mkOption {
|
||||
description = "The user name or id that will own the file.";
|
||||
default = "root";
|
||||
};
|
||||
group = lib.mkOption {
|
||||
description = "The group name or id that will own the file.";
|
||||
default = "root";
|
||||
};
|
||||
mode = lib.mkOption {
|
||||
type = lib.types.strMatching "^[0-7]{4}$";
|
||||
description = "The unix file mode of the file. Must be a 4-digit octal number.";
|
||||
default = if file.config.group == "root" then "0400" else "0440";
|
||||
};
|
||||
deploy = lib.mkOption {
|
||||
description = ''
|
||||
Whether the file should be deployed to the target machine.
|
||||
|
|
Loading…
Add table
Reference in a new issue