16 inherit (haskell.lib.compose) overrideCabal addBuildTools justStaticExecutables;
17 inherit (lib) makeBinPath;
18 bundledBins = [ gnutar gzip git openssh ] ++ lib.optional stdenv.isLinux crun;
21 # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
25 ${o.postInstall or ""}
27 mv $out/bin/hercules-ci-agent $out/libexec
28 makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
31 (addBuildTools [ makeBinaryWrapper ] (justStaticExecutables haskellPackages.hercules-ci-agent));
32 in pkg.overrideAttrs (finalAttrs: o: {
34 position = toString ./default.nix + ":1";
36 passthru = o.passthru // {
38 version = testers.testVersion {
39 package = finalAttrs.finalPackage;
40 command = "hercules-ci-agent --help";
42 } // lib.optionalAttrs (stdenv.isLinux) {
43 # Does not test the package, but evaluation of the related NixOS module.
44 nixos-simple-config = (nixos {
45 boot.loader.grub.enable = false;
46 fileSystems."/".device = "bogus";
47 services.hercules-ci-agent.enable = true;
48 # Dummy value for testing only.
49 system.stateVersion = lib.trivial.release; # TEST ONLY
50 }).config.system.build.toplevel;
52 nixos-many-options-config = (nixos ({ pkgs, ... }: {
53 boot.loader.grub.enable = false;
54 fileSystems."/".device = "bogus";
55 services.hercules-ci-agent = {
57 package = pkgs.hercules-ci-agent;
59 workDirectory = "/var/tmp/hci";
60 binaryCachesPath = "/var/keys/binary-caches.json";
61 labels.foo.bar.baz = "qux";
62 labels.qux = ["q" "u"];
63 apiBaseUrl = "https://hci.dev.biz.example.com";
67 # Dummy value for testing only.
68 system.stateVersion = lib.trivial.release; # TEST ONLY
69 })).config.system.build.toplevel;