From 3ba4ba9abb14dad2d353b42900ec309e5e4d5b07 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 29 Jan 2023 23:26:24 +0100 Subject: [PATCH] packages/hercules-ci-agent: fix overrides, announce modified version --- packages/patched-inputs.nix | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/patched-inputs.nix b/packages/patched-inputs.nix index aa4d70d..ff62ac6 100644 --- a/packages/patched-inputs.nix +++ b/packages/patched-inputs.nix @@ -17,16 +17,34 @@ # hci-agent's build code does some funny shenanigans hercules-ci-agent = let original = packages.hercules-ci-agent.hercules-ci-agent; - patchedNix = patch-rename-direct original.nix ({ version, ...}: "nix-${version}_hci2") "patches/extra/hercules-ci-agent/nix"; - in (original.override { - # for hercules-ci-cnix-expr, hercules-ci-cnix-store - nix = patchedNix; - # for cachix - pkgs = pkgs // { nix = patchedNix; }; - }).overrideAttrs (old: { - # for hercules-ci-agent - buildInputs = (lib.remove original.nix old.buildInputs) ++ [ patchedNix ]; - }); + patchedNix = (patch original.nix "patches/extra/hercules-ci-agent/nix").overrideAttrs (old: rec { + name = "nix-${version}"; + version = "${original.nix.version}_hci2"; + postUnpack = '' + ${old.postUnpack or ""} + echo -n "${version}" > .version + ''; + }); + forcePatchNix = old: { + buildInputs = (lib.remove original.nix old.buildInputs) ++ [ patchedNix ]; + passthru = old.passthru // { + nix = patchedNix; + }; + }; + patchDeps = lib.const rec { + hercules-ci-cnix-store = packages.hercules-ci-agent.internal-hercules-ci-cnix-store.override (lib.const { + nix = patchedNix; + }); + hercules-ci-cnix-expr = packages.hercules-ci-agent.internal-hercules-ci-cnix-expr.override (lib.const { + nix = patchedNix; + inherit hercules-ci-cnix-store; + }); + cachix = pkgs.haskellPackages.cachix.override (lib.const { + nix = patchedNix; + inherit hercules-ci-cnix-store; + }); + }; + in (original.override patchDeps).overrideAttrs forcePatchNix; hci = packages.hercules-ci-agent.hercules-ci-cli; };