mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
parent
50f0184a7b
commit
a85c4e49fe
1 changed files with 56 additions and 28 deletions
84
flake.nix
84
flake.nix
|
|
@ -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,36 +138,64 @@
|
|||
};
|
||||
};
|
||||
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 ''
|
||||
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 ''
|
||||
while read entry; do
|
||||
[[ "$entry" == *.drv ]] && entry+="^*" || true
|
||||
nix copy --quiet --to "file://$(pwd)/.nix-cache" $entry || true
|
||||
echo -n "."
|
||||
done
|
||||
'')
|
||||
(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
|
||||
# sh
|
||||
''
|
||||
while read entry; do
|
||||
[[ "$entry" == *.drv ]] && entry+="^*" || true
|
||||
nix copy --quiet --to "file://$(pwd)/.nix-cache" $entry || true
|
||||
echo -n "."
|
||||
done
|
||||
'')
|
||||
];
|
||||
image-cachix = mkImage [
|
||||
(setupScript ''
|
||||
echo "Configuring caching with cachix..."
|
||||
${pkgs.cachix}/bin/cachix use $CACHIX_CACHE || true
|
||||
'')
|
||||
(finalizeScript "${pkgs.cachix}/bin/cachix push $CACHIX_CACHE || true")
|
||||
(setupScript
|
||||
# sh
|
||||
''
|
||||
echo "Configuring caching with cachix..."
|
||||
${pkgs.cachix}/bin/cachix use $CACHIX_CACHE || true
|
||||
'')
|
||||
(finalizeScript
|
||||
# sh
|
||||
''
|
||||
${pkgs.cachix}/bin/cachix push $CACHIX_CACHE || true
|
||||
'')
|
||||
];
|
||||
image-attic = mkImage [
|
||||
(setupScript ''
|
||||
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")
|
||||
(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
|
||||
# sh
|
||||
''
|
||||
${inputs'.attic.packages.attic-client}/bin/attic push ci:$ATTIC_CACHE || true
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue