nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at lib-types-attrNamesToTrue 98 lines 2.0 kB view raw
1{ 2 stdenvNoCC, 3 lib, 4 elixir, 5 hex, 6 rebar, 7 rebar3, 8 cacert, 9 git, 10}@inputs: 11 12{ 13 pname, 14 version, 15 hash ? "", 16 sha256 ? "", 17 src, 18 mixEnv ? "prod", 19 debug ? false, 20 meta ? { }, 21 patches ? [ ], 22 elixir ? inputs.elixir, 23 hex ? inputs.hex.override { inherit elixir; }, 24 ... 25}@attrs: 26 27let 28 hash_ = 29 if hash != "" then 30 { 31 outputHashAlgo = null; 32 outputHash = hash; 33 } 34 else if sha256 != "" then 35 { 36 outputHashAlgo = "sha256"; 37 outputHash = sha256; 38 } 39 else 40 { 41 outputHashAlgo = "sha256"; 42 outputHash = lib.fakeSha256; 43 }; 44in 45stdenvNoCC.mkDerivation ( 46 attrs 47 // { 48 nativeBuildInputs = [ 49 elixir 50 hex 51 cacert 52 git 53 ]; 54 55 MIX_ENV = mixEnv; 56 MIX_DEBUG = if debug then 1 else 0; 57 DEBUG = if debug then 1 else 0; # for rebar3 58 # the api with `mix local.rebar rebar path` makes a copy of the binary 59 MIX_REBAR = "${rebar}/bin/rebar"; 60 MIX_REBAR3 = "${rebar3}/bin/rebar3"; 61 # there is a persistent download failure with absinthe 1.6.3 62 # those defaults reduce the failure rate 63 HEX_HTTP_CONCURRENCY = 1; 64 HEX_HTTP_TIMEOUT = 120; 65 66 configurePhase = 67 attrs.configurePhase or '' 68 runHook preConfigure 69 export HEX_HOME="$TEMPDIR/.hex"; 70 export MIX_HOME="$TEMPDIR/.mix"; 71 export MIX_DEPS_PATH="$TEMPDIR/deps"; 72 73 # Rebar 74 export REBAR_GLOBAL_CONFIG_DIR="$TMPDIR/rebar3" 75 export REBAR_CACHE_DIR="$TMPDIR/rebar3.cache" 76 runHook postConfigure 77 ''; 78 79 inherit patches; 80 81 dontBuild = true; 82 83 installPhase = 84 attrs.installPhase or '' 85 runHook preInstall 86 mix deps.get ''${MIX_ENV:+--only $MIX_ENV} 87 find "$TEMPDIR/deps" -path '*/.git/*' -a ! -name HEAD -exec rm -rf {} + 88 cp -r --no-preserve=mode,ownership,timestamps $TEMPDIR/deps $out 89 runHook postInstall 90 ''; 91 92 outputHashMode = "recursive"; 93 94 impureEnvVars = lib.fetchers.proxyImpureEnvVars; 95 inherit meta; 96 } 97 // hash_ 98)