depot/packages/patched-inputs.nix

65 lines
2.3 KiB
Nix
Raw Normal View History

2022-07-31 16:09:40 +03:00
{
perSystem = { filters, inputs', lib, pkgs, ... }:
2021-06-05 23:59:06 +03:00
2022-07-31 16:09:40 +03:00
let
tools = import ./lib/tools.nix;
packages = builtins.mapAttrs (_: v: v.packages) inputs';
in with tools;
2021-06-05 23:59:06 +03:00
2022-07-31 16:09:40 +03:00
{
packages = filters.doFilter filters.packages rec {
inherit (packages.deploy-rs) deploy-rs;
2022-07-31 16:09:40 +03:00
nix-super = packages.nix-super.nix;
2022-07-31 16:09:40 +03:00
agenix = packages.agenix.agenix.override { nix = nix-super; };
# hci-agent's build code does some funny shenanigans
hercules-ci-agent = let
original = packages.hercules-ci-agent.hercules-ci-agent;
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;
})).overrideAttrs (o: {
postPatch = ''
${o.postPatch or ""}
# jailbreak pkgconfig deps
cp cachix.cabal cachix.cabal.backup
sed -i cachix.cabal -e 's/\(nix-[a-z]*\) *(==[0-9.]* *|| *>[0-9.]*) *&& *<[0-9.]*/\1/g'
sed -i cachix.cabal -e 's/pkgconfig-depends:.*/pkgconfig-depends: nix-main, nix-store/'
echo
echo Applied:
diff -U5 cachix.cabal.backup cachix.cabal ||:
echo
rm cachix.cabal.backup
'';
});
};
in (original.override patchDeps).overrideAttrs forcePatchNix;
2022-07-31 16:09:40 +03:00
hci = packages.hercules-ci-agent.hercules-ci-cli;
};
};
}