chore: add additional NIX_CONFIG var & reformat

closes #11
This commit is contained in:
technofab 2024-11-26 14:11:45 +01:00
parent 50f0184a7b
commit a85c4e49fe

View file

@ -87,12 +87,12 @@
extra-trusted-public-keys = $NIX_PUBLIC_KEYS
extra-trusted-substituters = $NIX_SUBSTITUTERS
extra-substituters = $NIX_SUBSTITUTERS
$NIX_CONFIG
$NIX_EXTRA_CONFIG
"
echo -e "\\e[0Ksection_end:`date +%s`:nix_setup\\r\\e[0K"
${
"" # load the job's deps only if the name was passed
}
# load the job's deps only if the name was passed
if [[ ! -z $1 ]]; then
echo -e "\\e[0Ksection_start:`date +%s`:nix_deps[collapsed=true]\\r\\e[0KFetching deps for job"
nix build .#gitlab-ci-job-deps:$1
@ -138,15 +138,31 @@
};
};
in {
setup-script = setupScript "true # extra_setup";
finalize-script = finalizeScript "true # push_command";
setup-script =
setupScript
# sh
''
# extra_setup
true
'';
finalize-script =
finalizeScript
# sh
''
# push_command
true
'';
image = mkImage [
(setupScript ''
(setupScript
# sh
''
cachedir="$(pwd)/.nix-cache"
echo "Configuring caching with the Runner Cache in $cachedir..."
export NIX_SUBSTITUTERS="$NIX_SUBSTITUTERS file://$cachedir?priority=10&trusted=true"
'')
(finalizeScript ''
(finalizeScript
# sh
''
while read entry; do
[[ "$entry" == *.drv ]] && entry+="^*" || true
nix copy --quiet --to "file://$(pwd)/.nix-cache" $entry || true
@ -155,19 +171,31 @@
'')
];
image-cachix = mkImage [
(setupScript ''
(setupScript
# sh
''
echo "Configuring caching with cachix..."
${pkgs.cachix}/bin/cachix use $CACHIX_CACHE || true
'')
(finalizeScript "${pkgs.cachix}/bin/cachix push $CACHIX_CACHE || true")
(finalizeScript
# sh
''
${pkgs.cachix}/bin/cachix push $CACHIX_CACHE || true
'')
];
image-attic = mkImage [
(setupScript ''
(setupScript
# sh
''
echo "Configuring caching with attic..."
${inputs'.attic.packages.attic-client}/bin/attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN" || true
${inputs'.attic.packages.attic-client}/bin/attic use "$ATTIC_CACHE" || true
'')
(finalizeScript "${inputs'.attic.packages.attic-client}/bin/attic push ci:$ATTIC_CACHE || true")
(finalizeScript
# sh
''
${inputs'.attic.packages.attic-client}/bin/attic push ci:$ATTIC_CACHE || true
'')
];
};