loki: Add post-build-hook to automatically upload matching packages
This commit is contained in:
parent
e24be19c75
commit
828a7c22bd
1 changed files with 23 additions and 13 deletions
|
@ -1,4 +1,9 @@
|
||||||
{ nixos-hardware, nix-ld-rs, ... }:
|
{
|
||||||
|
nixos-hardware,
|
||||||
|
nix-ld-rs,
|
||||||
|
attic,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -488,19 +493,24 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# nix.settings.post-build-hook =
|
nix.settings.post-build-hook =
|
||||||
# let
|
let
|
||||||
# inherit (attic.packages.${pkgs.system}) attic-client;
|
inherit (attic.packages.${pkgs.system}) attic-client;
|
||||||
# in
|
cachedPackagePatterns = builtins.concatStringsSep "|" [ "mongodb" ];
|
||||||
# pkgs.writeScript "upload-to-cache" ''
|
in
|
||||||
# set -eu
|
pkgs.writeScript "upload-to-cache" ''
|
||||||
# set -f
|
set -eu
|
||||||
# export IFS=' '
|
set -f
|
||||||
|
export IFS=' '
|
||||||
|
|
||||||
# OUT_PATHS=$(echo -n ''${OUT_PATHS} | ${pkgs.gawk}/bin/awk 'BEGIN { RS = " "; ORS = " "; } $0 !~ /horus_vcpkg/ { print $0 }')
|
OUT_PATHS=$(echo -n ''${OUT_PATHS} | ${pkgs.gawk}/bin/awk 'BEGIN { RS = " "; ORS = " "; } $0 ~ /(${cachedPackagePatterns})/ { print $0 }')
|
||||||
# echo "Uploading paths to cache " ''${OUT_PATHS}
|
if [[ -z "''${OUT_PATHS}" ]]; then
|
||||||
# exec ${attic-client}/bin/attic push main ''${OUT_PATHS}
|
echo "No matching packages to upload"
|
||||||
# '';
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Uploading paths to cache " ''${OUT_PATHS}
|
||||||
|
exec ${attic-client}/bin/attic push main ''${OUT_PATHS}
|
||||||
|
'';
|
||||||
|
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
|
|
Loading…
Reference in a new issue