mirror of
https://github.com/input-output-hk/foliage.git
synced 2024-09-17 15:17:10 +03:00
Build a cabal install plan purely in nix
This commit is contained in:
parent
80bcb8333c
commit
74a3931147
1
dist-newstyle/cache/plan.json
vendored
Normal file
1
dist-newstyle/cache/plan.json
vendored
Normal file
File diff suppressed because one or more lines are too long
403
flake.lock
403
flake.lock
@ -1,88 +1,5 @@
|
||||
{
|
||||
"nodes": {
|
||||
"HTTP": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1451647621,
|
||||
"narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=",
|
||||
"owner": "phadej",
|
||||
"repo": "HTTP",
|
||||
"rev": "9bc0996d412fef1787449d841277ef663ad9a915",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "phadej",
|
||||
"repo": "HTTP",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-32": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1603716527,
|
||||
"narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "48bf10787e27364730dd37a42b603cee8d6af7ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.2",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-34": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1640353650,
|
||||
"narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.4",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-36": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1641652457,
|
||||
"narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "f27667f8ec360c475027dcaee0138c937477b070",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.6",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cardano-shell": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1608537748,
|
||||
"narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "cardano-shell",
|
||||
"rev": "9392c75087cb9a3d453998f4230930dea3a95725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "cardano-shell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
@ -98,336 +15,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1644229661,
|
||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ghc-8.6.5-iohk": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1600920045,
|
||||
"narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "ghc",
|
||||
"rev": "95713a6ecce4551240da7c96b6176f980af75cae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"ref": "release/8.6.5-iohk",
|
||||
"repo": "ghc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hackage": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1661130976,
|
||||
"narHash": "sha256-6eTbXPY0ZPKC32xi1KVHsqM+QC34LpQnM1He9tygBQY=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "hackage.nix",
|
||||
"rev": "14df7a1e633059997ecd3182d8272a1f13e99c62",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "hackage.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"haskell-nix": {
|
||||
"inputs": {
|
||||
"HTTP": "HTTP",
|
||||
"cabal-32": "cabal-32",
|
||||
"cabal-34": "cabal-34",
|
||||
"cabal-36": "cabal-36",
|
||||
"cardano-shell": "cardano-shell",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
|
||||
"hackage": "hackage",
|
||||
"hpc-coveralls": "hpc-coveralls",
|
||||
"hydra": "hydra",
|
||||
"nix-tools": "nix-tools",
|
||||
"nixpkgs": [
|
||||
"haskell-nix",
|
||||
"nixpkgs-unstable"
|
||||
],
|
||||
"nixpkgs-2003": "nixpkgs-2003",
|
||||
"nixpkgs-2105": "nixpkgs-2105",
|
||||
"nixpkgs-2111": "nixpkgs-2111",
|
||||
"nixpkgs-2205": "nixpkgs-2205",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"old-ghc-nix": "old-ghc-nix",
|
||||
"stackage": "stackage"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1661131248,
|
||||
"narHash": "sha256-UCbiKv4DWeGVeOknUbQqJkk0sZAn34CSntjIG12uWOg=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "haskell.nix",
|
||||
"rev": "e36a34c4abc02287ec79bf88a0c993f6b66f9945",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "haskell.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hpc-coveralls": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1607498076,
|
||||
"narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=",
|
||||
"owner": "sevanspowell",
|
||||
"repo": "hpc-coveralls",
|
||||
"rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "sevanspowell",
|
||||
"repo": "hpc-coveralls",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hydra": {
|
||||
"inputs": {
|
||||
"nix": "nix",
|
||||
"nixpkgs": [
|
||||
"haskell-nix",
|
||||
"hydra",
|
||||
"nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1646878427,
|
||||
"narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "hydra",
|
||||
"rev": "28b682b85b7efc5cf7974065792a1f22203a5927",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "hydra",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"lowdown-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1633514407,
|
||||
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix": {
|
||||
"inputs": {
|
||||
"lowdown-src": "lowdown-src",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1643066034,
|
||||
"narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "2.6.0",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-tools": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1659569011,
|
||||
"narHash": "sha256-wHS0H5+TERmDnPCfzH4A+rSR5TvjYMWus9BNeNAMyUM=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "nix-tools",
|
||||
"rev": "555d57e1ea81b79945f2608aa261df20f6b602a5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "nix-tools",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1632864508,
|
||||
"narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
|
||||
"lastModified": 1661353537,
|
||||
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "82891b5e2c2359d7e58d08849e4c89511ab94234",
|
||||
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.05-small",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2003": {
|
||||
"locked": {
|
||||
"lastModified": 1620055814,
|
||||
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-20.03-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2105": {
|
||||
"locked": {
|
||||
"lastModified": 1655034179,
|
||||
"narHash": "sha256-rf1/7AbzuYDw6+8Xvvf3PtEOygymLBrFsFxvext5ZjI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "046ee4af7a9f016a364f8f78eeaa356ba524ac31",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-21.05-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2111": {
|
||||
"locked": {
|
||||
"lastModified": 1656782578,
|
||||
"narHash": "sha256-1eMCBEqJplPotTo/SZ/t5HU6Sf2I8qKlZi9MX7jv9fw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "573603b7fdb9feb0eb8efc16ee18a015c667ab1b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-21.11-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2205": {
|
||||
"locked": {
|
||||
"lastModified": 1657876628,
|
||||
"narHash": "sha256-URmf0O2cQ/3heg2DJOeLyU/JmfVMqG4X5t9crQXMaeY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "549d82bdd40f760a438c3c3497c1c61160f3de55",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-22.05-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-regression": {
|
||||
"locked": {
|
||||
"lastModified": 1643052045,
|
||||
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1657888067,
|
||||
"narHash": "sha256-GnwJoFBTPfW3+mz7QEeJEEQ9OMHZOiIJ/qDhZxrlKh8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "65fae659e31098ca4ac825a6fef26d890aaf3f4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"old-ghc-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1631092763,
|
||||
"narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=",
|
||||
"owner": "angerman",
|
||||
"repo": "old-ghc-nix",
|
||||
"rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "angerman",
|
||||
"ref": "master",
|
||||
"repo": "old-ghc-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"haskell-nix": "haskell-nix",
|
||||
"nixpkgs": [
|
||||
"haskell-nix",
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
}
|
||||
},
|
||||
"stackage": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1661044553,
|
||||
"narHash": "sha256-a/RFN+0b4iv30IPJ8wsiod3R+A1jEAj7lhR5G/F/+JY=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "stackage.nix",
|
||||
"rev": "e26c8280c6adf0e8bc9bb90b81d017cd29c590bd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "stackage.nix",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
204
flake.nix
204
flake.nix
@ -1,47 +1,169 @@
|
||||
{
|
||||
description = "Foliage is a tool to create custom Haskell package repositories, in a fully reproducible way.";
|
||||
inputs = { flake-utils.url = "github:numtide/flake-utils"; };
|
||||
|
||||
inputs = {
|
||||
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
||||
haskell-nix.url = "github:input-output-hk/haskell.nix";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit (pkgs) lib;
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, haskell-nix }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; inherit (haskell-nix) config; overlays = [haskell-nix.overlay]; };
|
||||
project = pkgs.haskell-nix.cabalProject {
|
||||
src = ./.;
|
||||
compiler-nix-name = "ghc8107";
|
||||
shell.tools = {
|
||||
cabal = {};
|
||||
hlint = {};
|
||||
haskell-language-server = {};
|
||||
plan = lib.importJSON ./dist-newstyle/cache/plan.json;
|
||||
|
||||
# whatever, we do have the right versions in the plan
|
||||
cabal-install = pkgs.cabal-install;
|
||||
ghc = pkgs.haskell.compiler.ghc8107;
|
||||
|
||||
fetchHackageSdist = { package, version, sha256 }:
|
||||
builtins.fetchurl {
|
||||
inherit sha256;
|
||||
url =
|
||||
"https://hackage.haskell.org/package/${package}-${version}/${package}-${version}.tar.gz";
|
||||
name = "${package}-${version}.tar.gz";
|
||||
};
|
||||
|
||||
fetchCabalFileByHash = { package, version, sha256 }:
|
||||
builtins.fetchurl {
|
||||
inherit sha256;
|
||||
url = "https://casa.fpcomplete.com/${sha256}";
|
||||
name = "${package}-${version}-cabal-file-${sha256}";
|
||||
};
|
||||
|
||||
fetchComponentSrc =
|
||||
{ pkg-name, pkg-version, pkg-src, pkg-src-sha256, pkg-cabal-sha256 }:
|
||||
if pkg-src.type == "repo-tar" then
|
||||
builtins.fetchurl {
|
||||
url =
|
||||
"${pkg-src.repo.uri}package/${pkg-name}-${pkg-version}/${pkg-name}-${pkg-version}.tar.gz";
|
||||
name = "${pkg-name}-${pkg-version}.tar.gz";
|
||||
sha256 = pkg-src-sha256;
|
||||
}
|
||||
else if pkg-src.type == "local" then
|
||||
# simplifying (and terrifying) assumption
|
||||
./.
|
||||
else
|
||||
abort "boh";
|
||||
|
||||
inherit (plan) install-plan;
|
||||
|
||||
install-plan-map =
|
||||
lib.mapAttrs (_: builtins.head) (lib.groupBy (p: p.id) install-plan);
|
||||
|
||||
externalDeps = [ pkgs.zlib ];
|
||||
|
||||
buildComponent = n:
|
||||
|
||||
let
|
||||
all-depends = builtins.concatMap (n:
|
||||
(lib.optionals (n ? depends) n.depends)
|
||||
++ (lib.optionals (n ? exe-depends) n.exe-depends)) ([ n ]
|
||||
++ lib.optionals (n ? components)
|
||||
(builtins.attrValues n.components));
|
||||
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = n.id;
|
||||
|
||||
propagatedBuildInputs = externalDeps ++ builtins.map buildComponent
|
||||
(builtins.filter (n: n.type == "configured")
|
||||
(builtins.map (d: install-plan-map.${d}) all-depends));
|
||||
|
||||
setupHook = pkgs.writeScript "setup-hook.sh" ''
|
||||
ghcPackagesHook() {
|
||||
if [[ -d "$1/packages.conf" ]]; then
|
||||
if [[ ! -d $out/packages.conf ]]; then
|
||||
mkdir -p $out/packages.conf
|
||||
fi
|
||||
# collect all the package specification files
|
||||
for n in $1/packages.conf/*.conf; do
|
||||
cp --no-clobber $n $out/packages.conf
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
addEnvHooks "$targetOffset" ghcPackagesHook
|
||||
'';
|
||||
|
||||
postUnpack = if n ? pkg-cabal-sha256 then ''
|
||||
echo "Updating ${n.pkg-name}.cabal with the revision ${n.pkg-cabal-sha256}"
|
||||
cp ${
|
||||
fetchCabalFileByHash {
|
||||
package = n.pkg-name;
|
||||
version = n.pkg-version;
|
||||
sha256 = n.pkg-cabal-sha256;
|
||||
}
|
||||
} $sourceRoot/${n.pkg-name}.cabal
|
||||
'' else
|
||||
"";
|
||||
|
||||
configurePhase = let
|
||||
components =
|
||||
map (c: if c == "lib" then "lib:" + n.pkg-name else c)
|
||||
(if n ? component-name then
|
||||
[ n.component-name ]
|
||||
else if n ? components then
|
||||
(builtins.attrNames n.components)
|
||||
else
|
||||
abort "boh");
|
||||
|
||||
in ''
|
||||
runHook preConfigure
|
||||
|
||||
mkdir -p $out
|
||||
|
||||
if [[ ! -d $out/packages.conf ]]; then
|
||||
mkdir $out/packages.conf
|
||||
fi
|
||||
${ghc}/bin/ghc-pkg --package-db $out/packages.conf recache
|
||||
${ghc}/bin/ghc-pkg --package-db $out/packages.conf check
|
||||
|
||||
if grep 'build-type:\s\+Configure' ${n.pkg-name}.cabal; then
|
||||
export BUILD_TYPE=Configure
|
||||
else
|
||||
export BUILD_TYPE=Simple
|
||||
fi
|
||||
|
||||
${cabal-install}/bin/cabal act-as-setup \
|
||||
--build-type=$BUILD_TYPE \
|
||||
configure -- \
|
||||
--verbose=2 \
|
||||
--cid=${n.id} \
|
||||
--prefix $out \
|
||||
--package-db=$out/packages.conf \
|
||||
--with-compiler=${ghc}/bin/ghc \
|
||||
${builtins.concatStringsSep " " components}
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
${cabal-install}/bin/cabal act-as-setup build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
${cabal-install}/bin/cabal act-as-setup install
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
src = fetchComponentSrc {
|
||||
inherit (n)
|
||||
pkg-name pkg-version pkg-src pkg-src-sha256 pkg-cabal-sha256;
|
||||
};
|
||||
};
|
||||
|
||||
allPackages = lib.mapAttrs (_: buildComponent) install-plan-map;
|
||||
|
||||
localPackages = lib.mapAttrs (_: buildComponent)
|
||||
(lib.filterAttrs (n: v: v ? style && v.style == "local")
|
||||
install-plan-map);
|
||||
|
||||
in {
|
||||
packages = allPackages // {
|
||||
default = builtins.head (builtins.attrValues localPackages);
|
||||
};
|
||||
shell.buildInputs = with pkgs; [
|
||||
nixpkgs-fmt
|
||||
];
|
||||
modules = [{
|
||||
packages.foliage.components.exes.foliage.dontStrip = false;
|
||||
}];
|
||||
};
|
||||
in {
|
||||
packages.default = project.foliage.components.exes.foliage;
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
name = "foliage-dev-shell";
|
||||
};
|
||||
});
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [
|
||||
"https://cache.iog.io"
|
||||
"https://foliage.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
||||
"foliage.cachix.org-1:kAFyYLnk8JcRURWReWZCatM9v3Rk24F5wNMpEj14Q/g="
|
||||
];
|
||||
};
|
||||
devShells.default =
|
||||
pkgs.mkShell { buildInputs = [ ghc cabal-install ]; };
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user