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