mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
Haskell utils: add an attrset mapping GHC version to hidden packages
This commit is contained in:
parent
539a5cad94
commit
f1a53653c3
17
flake.lock
17
flake.lock
@ -124,6 +124,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ghc-utils": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1662774800,
|
||||
"narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea",
|
||||
"revCount": 1072,
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/bgamari/ghc-utils"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/bgamari/ghc-utils"
|
||||
}
|
||||
},
|
||||
"gomod2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -217,6 +233,7 @@
|
||||
"crane": "crane",
|
||||
"devshell": "devshell",
|
||||
"flake-utils-pre-commit": "flake-utils-pre-commit",
|
||||
"ghc-utils": "ghc-utils",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"mach-nix": "mach-nix",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
@ -53,6 +53,11 @@
|
||||
url = "github:nix-community/all-cabal-json/hackage";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
ghc-utils = {
|
||||
url = "git+https://gitlab.haskell.org/bgamari/ghc-utils";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
@ -66,6 +71,7 @@
|
||||
pre-commit-hooks,
|
||||
crane,
|
||||
all-cabal-json,
|
||||
ghc-utils,
|
||||
...
|
||||
} @ inp: let
|
||||
b = builtins;
|
||||
|
@ -79,4 +79,37 @@ in {
|
||||
(targetBuildDepends ++ buildToolDepends ++ condBuildDepends);
|
||||
in
|
||||
depNames;
|
||||
|
||||
# XXX: This might be better as a function. See
|
||||
# https://github.com/nixos/nixpkgs/blob/773c2a7afa4cc94f91d53d8cb35245cbf216082b/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix#L49-L56
|
||||
# Packages we shouldn't always overwrite with null, but presently do anyway, are
|
||||
# 1) terminfo, when we cross-compile
|
||||
# 2) xhtml, when ghc.hasHaddock is set to false
|
||||
ghcVersionToHiddenPackages = l.pipe "${inputs.ghc-utils}/library-versions/pkg_versions.txt" [
|
||||
l.readFile
|
||||
(l.split "\n#+\n# GHC [^\n]+")
|
||||
l.tail
|
||||
(l.filter l.isString)
|
||||
(l.concatMap (l.splitString "\n"))
|
||||
(l.filter (s: s != "" && !(l.hasPrefix "HEAD" s)))
|
||||
(l.map (
|
||||
s: let
|
||||
ghcVersionAndHiddenPackages = l.match "([^[:space:]]+)[[:space:]]+(.+)" s;
|
||||
ghcVersion = l.head ghcVersionAndHiddenPackages;
|
||||
hiddenPackages = l.pipe (l.last ghcVersionAndHiddenPackages) [
|
||||
(l.splitString " ")
|
||||
(l.map (packageAndVersion:
|
||||
l.pipe packageAndVersion [
|
||||
(l.match "([^/]+)/.+")
|
||||
l.head
|
||||
(packageName: l.nameValuePair packageName null)
|
||||
]))
|
||||
(pkgNames: [(l.nameValuePair "Win32" null)] ++ pkgNames)
|
||||
l.listToAttrs
|
||||
];
|
||||
in
|
||||
l.nameValuePair ghcVersion hiddenPackages
|
||||
))
|
||||
l.listToAttrs
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user