A fork of attic a self-hostable Nix Binary Cache server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

flake: Add escape hatch to inject package args

+16 -7
+11 -7
crane.nix
··· 19 19 , boost 20 20 , darwin 21 21 , libiconv 22 + 23 + , extraPackageArgs ? {} 22 24 }: 23 25 24 26 let ··· 43 45 libiconv 44 46 ]; 45 47 46 - cargoArtifacts = craneLib.buildDepsOnly { 48 + extraArgs = extraPackageArgs; 49 + 50 + cargoArtifacts = craneLib.buildDepsOnly ({ 47 51 pname = "attic"; 48 52 inherit src version nativeBuildInputs buildInputs; 49 53 ··· 54 58 # With `use-zstd`, the cargo artifacts are archived in a `tar.zstd`. This is 55 59 # actually set if you use `buildPackage` without passing `cargoArtifacts`. 56 60 installCargoArtifactsMode = "use-zstd"; 57 - }; 61 + } // extraArgs); 58 62 59 63 mkAttic = args: craneLib.buildPackage ({ 60 64 pname = "attic"; ··· 86 90 maintainers = with maintainers; [ zhaofengli ]; 87 91 platforms = platforms.linux ++ platforms.darwin; 88 92 }; 89 - } // args); 93 + } // args // extraArgs); 90 94 91 95 attic = mkAttic { 92 96 cargoExtraArgs = "-p attic-client -p attic-server"; ··· 106 110 # 107 111 # We don't enable fat LTO in the default `attic` package since it 108 112 # dramatically increases build time. 109 - attic-server = craneLib.buildPackage { 113 + attic-server = craneLib.buildPackage ({ 110 114 pname = "attic-server"; 111 115 112 116 # We don't pull in the common cargoArtifacts because the feature flags ··· 120 124 121 125 CARGO_PROFILE_RELEASE_LTO = "fat"; 122 126 CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; 123 - }; 127 + } // extraArgs); 124 128 125 129 # Attic interacts with Nix directly and its tests require trusted-user access 126 130 # to nix-daemon to import NARs, which is not possible in the build sandbox. 127 131 # In the CI pipeline, we build the test executable inside the sandbox, then 128 132 # run it outside. 129 - attic-tests = craneLib.mkCargoDerivation { 133 + attic-tests = craneLib.mkCargoDerivation ({ 130 134 pname = "attic-tests"; 131 135 132 136 inherit src version buildInputs cargoArtifacts; ··· 151 155 152 156 runHook postInstall 153 157 ''; 154 - }; 158 + } // extraArgs); 155 159 in { 156 160 inherit cargoArtifacts attic attic-client attic-server attic-tests; 157 161 }
+5
flake/packages.nix
··· 25 25 type = types.nullOr types.package; 26 26 default = null; 27 27 }; 28 + extraPackageArgs = mkOption { 29 + type = types.attrsOf types.anything; 30 + default = {}; 31 + }; 28 32 }; 29 33 }; 30 34 }; ··· 41 45 ]; 42 46 in pkgs.callPackage ../crane.nix { 43 47 inherit craneLib; 48 + inherit (perSystemConfig.attic) extraPackageArgs; 44 49 }); 45 50 46 51 perSystem = { self', pkgs, config, cranePkgs, ... }: (lib.mkMerge [