on iko/ghcjs-patch-master help sign in
Updated system-nixpkgs-map.nix and a default for X11 package (fixes #984) (#988)
a045d79paumr
docs/tutorials/pkg-map.md+28−2
@@ -29,13 +29,39 @@ nixpkgs.overlays = [
29];
29];
30```
30```
31
31
32+### Replace libraries of components
33+
34+If a component is missing a dependency it can be added via modules. For example:
35+
36+``` nix
37+project = pkgs.haskell-nix.project' {
38+ src = self;
39+ compiler-nix-name = "ghc8102";
40+ modules = [{
41+ # Replace `extra-libraries` dependencies
42+ packages.X11.components.library.libs = pkgs.lib.mkForce (with pkgs.xorg;
43+ [ libX11 libXrandr libXext libXScrnSaver libXinerama ]);
44+ }];
45+};
46+```
47+
32### Mapping in Haskell.nix
48### Mapping in Haskell.nix
33
49
34Alternatively, if the name is commonly used, an alias can be added to
50Alternatively, if the name is commonly used, an alias can be added to
35the Haskell.nix sources, so that it's solved for all users.
51the Haskell.nix sources, so that it's solved for all users.
36
52
37−* [`lib/pkgconf-nixpkgs-map.nix`](https://github.com/input-output-hk/haskell.nix/blob/master/lib/pkgconf-nixpkgs-map.nix) - for `pkgconfig-depends`
53+* [`lib/pkgconf-nixpkgs-map.nix`](https://github.com/input-output-hk/haskell.nix/blob/master/lib/pkgconf-nixpkgs-map.nix)
54+ — for `pkgconfig-depends`.
55+
56+ Each mapping entry is a list of packages.
57+
38−* [`lib/system-nixpkgs-map.nix`](https://github.com/input-output-hk/haskell.nix/blob/master/lib/system-nixpkgs-map.nix) - for `build-tool-depends`, `frameworks`, `extra-libraries`, etc.
58+* [`lib/system-nixpkgs-map.nix`](https://github.com/input-output-hk/haskell.nix/blob/master/lib/system-nixpkgs-map.nix)
59+ — for `build-tool-depends`, `frameworks`, `extra-libraries`, etc.
60+
61+ Each name can be mapped to:
62+ 1. A single package from nixkpgs.
63+ 2. `null` — eliminates the dependency
64+ 3. A list of packages — sometimes needed for dependencies such as `X11`.
39
65
40!!! tip "Open a PR"
66!!! tip "Open a PR"
41 Please go ahead and open a [pull request](https://github.com/input-output-hk/haskell.nix/pulls)
67 Please go ahead and open a [pull request](https://github.com/input-output-hk/haskell.nix/pulls)
lib/system-nixpkgs-map.nix+83−81
@@ -1,84 +1,86 @@
1−# Maps of system pkg references from
1+# Maps of system pkg references from cabal file to nixpkgs pkgs.
2−# cabal file to nixpkgs pkgs.
2+# library name (from `extra-libraries` field of `.cabal` file) -> nixpkgs package(s) mapping.
3+# This mapping is used to construct the `libs` component attribute.
3−# See ../docs/dev/pkg-map.md
4+# See ../docs/tutorials/pkg-map.md
4pkgs:
5pkgs:
5−# fetchgit should always come from the evalPackages
6+
6−# if it comes from the targetPackages we won't even
7+with pkgs;
7−# be able to execute it.
8+
8− { fetchgit = pkgs.evalPackages.fetchgit; }
9−# haskell lib -> nix lib mapping
10# -- linux
9# -- linux
11−// { crypto = pkgs.openssl;
10+{ crypto = [ openssl ];
12− "c++" = null; # no libc++
11+ "c++" = null; # no libc++
12+ "stdc++" = null;
13− "stdc++" = null; "stdc++-6" = null;
13+ "stdc++-6" = null;
14− ssl = pkgs.openssl;
14+ ssl = [ openssl ];
15− z = pkgs.zlib;
15+ z = [ zlib ];
16− pthread = null; # available by default
16+ pthread = null; # available by default
17− GL = pkgs.libGL;
17+ GL = [ libGL ];
18− GLU = pkgs.libGLU;
18+ GLU = [ libGLU ];
19− alut = pkgs.freealut;
19+ alut = [ freealut ];
20− X11 = pkgs.xorg.libX11;
20+ X11 = with xorg; [ libX11 ];
21− Xrandr = pkgs.xorg.libXrandr;
21+ Xrandr = [ xorg.libXrandr ];
22+ Xrender = [ xorg.libXrender ];
23+ Xss = [ xorg.libXScrnSaver ];
22− Xext = pkgs.xorg.libXext;
24+ Xext = [ xorg.libXext ];
23− Xi = pkgs.xorg.libXi;
25+ Xi = [ xorg.libXi ];
24− Xxf86vm = pkgs.xorg.libXxf86vm;
26+ Xxf86vm = [ xorg.libXxf86vm ];
25− Xcursor = pkgs.xorg.libXcursor;
27+ Xcursor = [ xorg.libXcursor ];
26− Xinerama = pkgs.xorg.libXinerama;
28+ Xinerama = [ xorg.libXinerama ];
27− mysqlclient = pkgs.mysql;
29+ mysqlclient = [ mysql ];
28− Imlib2 = pkgs.imlib2;
30+ Imlib2 = [ imlib2 ];
29− asound = pkgs.alsaLib;
31+ asound = [ alsaLib ];
30− ffi = null;
32+ ffi = null;
31− bz2 = pkgs.bzip2;
33+ bz2 = [ bzip2 ];
32− util = pkgs.utillinux;
34+ util = [ utillinux ];
33− magic = pkgs.file;
35+ magic = [ file ];
34− pq = pkgs.postgresql;
36+ pq = [ postgresql ];
35− iconv = pkgs.libiconv;
37+ iconv = [ libiconv ];
36− lapack = pkgs.liblapack;
38+ lapack = [ liblapack ];
37− boost_atomic = pkgs.boost;
39+ boost_atomic = [ boost ];
38− boost_chrono = pkgs.boost;
40+ boost_chrono = [ boost ];
39− boost_container = pkgs.boost;
41+ boost_container = [ boost ];
40− boost_context = pkgs.boost;
42+ boost_context = [ boost ];
41− boost_contract = pkgs.boost;
43+ boost_contract = [ boost ];
42− boost_coroutine = pkgs.boost;
44+ boost_coroutine = [ boost ];
43− boost_date_time = pkgs.boost;
45+ boost_date_time = [ boost ];
44− boost_fiber = pkgs.boost;
46+ boost_fiber = [ boost ];
45− boost_filesystem = pkgs.boost;
47+ boost_filesystem = [ boost ];
46− boost_graph = pkgs.boost;
48+ boost_graph = [ boost ];
47− boost_iostreams = pkgs.boost;
49+ boost_iostreams = [ boost ];
48− boost_locale = pkgs.boost;
50+ boost_locale = [ boost ];
49− boost_log_setup = pkgs.boost;
51+ boost_log_setup = [ boost ];
50− boost_log = pkgs.boost;
52+ boost_log = [ boost ];
51− boost_math_c99f = pkgs.boost;
53+ boost_math_c99f = [ boost ];
52− boost_math_c99l = pkgs.boost;
54+ boost_math_c99l = [ boost ];
53− boost_math_c99 = pkgs.boost;
55+ boost_math_c99 = [ boost ];
54− boost_math_tr1f = pkgs.boost;
56+ boost_math_tr1f = [ boost ];
55− boost_math_tr1l = pkgs.boost;
57+ boost_math_tr1l = [ boost ];
56− boost_math_tr1 = pkgs.boost;
58+ boost_math_tr1 = [ boost ];
57− boost_prg_exec_monitor = pkgs.boost;
59+ boost_prg_exec_monitor = [ boost ];
58− boost_program_options = pkgs.boost;
60+ boost_program_options = [ boost ];
59− boost_random = pkgs.boost;
61+ boost_random = [ boost ];
60− boost_regex = pkgs.boost;
62+ boost_regex = [ boost ];
61− boost_serialization = pkgs.boost;
63+ boost_serialization = [ boost ];
62− boost_signals = pkgs.boost;
64+ boost_signals = [ boost ];
63− boost_stacktrace_addr2line = pkgs.boost;
65+ boost_stacktrace_addr2line = [ boost ];
64− boost_stacktrace_basic = pkgs.boost;
66+ boost_stacktrace_basic = [ boost ];
65− boost_stacktrace_noop = pkgs.boost;
67+ boost_stacktrace_noop = [ boost ];
66− boost_system = pkgs.boost;
68+ boost_system = [ boost ];
67− boost_thread = pkgs.boost;
69+ boost_thread = [ boost ];
68− boost_timer = pkgs.boost;
70+ boost_timer = [ boost ];
69− boost_type_erasure = pkgs.boost;
71+ boost_type_erasure = [ boost ];
70− boost_unit_test_framework = pkgs.boost;
72+ boost_unit_test_framework = [ boost ];
71− boost_wave = pkgs.boost;
73+ boost_wave = [ boost ];
72− boost_wserialization = pkgs.boost;
74+ boost_wserialization = [ boost ];
73− tensorflow = pkgs.libtensorflow;
75+ tensorflow = [ libtensorflow ];
74− opencv = pkgs.opencv3;
76+ opencv = [ opencv3 ];
75− icuuc = pkgs.icu;
77+ icuuc = [ icu ];
76− icui18n = pkgs.icu;
78+ icui18n = [ icu ];
77− icudata = pkgs.icu;
79+ icudata = [ icu ];
78− vulkan = pkgs.vulkan-loader;
80+ vulkan = [ vulkan-loader ];
79− sodium = pkgs.libsodium;
81+ sodium = [ libsodium ];
80− gfortran = pkgs.gfortran.cc.lib;
82+ gfortran = [ gfortran.cc.lib ];
81− }
83+}
82# -- windows
84# -- windows
83// { advapi32 = null; gdi32 = null; imm32 = null; msimg32 = null;
85// { advapi32 = null; gdi32 = null; imm32 = null; msimg32 = null;
84 shell32 = null; shfolder = null; shlwapi = null; user32 = null;
86 shell32 = null; shfolder = null; shlwapi = null; user32 = null;
@@ -88,7 +90,7 @@ pkgs:
88 # if it's not we have more severe
90 # if it's not we have more severe
89 # issues anyway.
91 # issues anyway.
90 gcc_s_seh-1 = null;
92 gcc_s_seh-1 = null;
91− ssl32 = null; eay32 = pkgs.openssl;
93+ ssl32 = null; eay32 = [ openssl ];
92 iphlpapi = null; # IP Help API
94 iphlpapi = null; # IP Help API
93 msvcrt = null; # this is the libc
95 msvcrt = null; # this is the libc
94 Crypt32 = null;
96 Crypt32 = null;
@@ -96,4 +98,4 @@ pkgs:
96 }
98 }
97# -- os x
99# -- os x
98# NB: these map almost 1:1 to the framework names
100# NB: these map almost 1:1 to the framework names
99−// pkgs.darwin.apple_sdk.frameworks
101+// darwin.apple_sdk.frameworks
lib/system-pkgs.nixnew file+33
@@ -0,0 +1,33 @@
1+# Cabal packages can depend on operating system packages. However
2+# package names vary between distributions - there is no standard.
3+#
4+# This file augments the nixpkgs package set with extra attributes
5+# from the system packages map file.
6+#
7+# This package set will be used when resolving system package
8+# dependencies of package descriptions.
9+
10+pkgs:
11+
12+let
13+ buildEnvMaybe = name: paths:
14+ if builtins.length paths == 1
15+ then builtins.head paths
16+ else pkgs.buildEnv { name = "${name}-env"; inherit paths; };
17+
18+ mapPackages = name: ps:
19+ if builtins.typeOf ps == "list"
20+ then buildEnvMaybe name ps
21+ else ps;
22+
23+in
24+ # Base packages.
25+ pkgs
26+
27+ # fetchgit should always come from the evalPackages
28+ # if it comes from the targetPackages we won't even
29+ # be able to execute it.
30+ // { fetchgit = pkgs.evalPackages.fetchgit; }
31+
32+ # Apply the mapping.
33+ // builtins.mapAttrs mapPackages (import ./system-nixpkgs-map.nix pkgs)
modules/configuration-nix.nix+7
@@ -8,4 +8,11 @@
8 # this if we used the terminfo shipped with GHC, but this package is
8 # this if we used the terminfo shipped with GHC, but this package is
9 # reinstallable so we'd rather have it defined in the plan.
9 # reinstallable so we'd rather have it defined in the plan.
10 packages.terminfo.components.library.libs = [pkgs.ncurses];
10 packages.terminfo.components.library.libs = [pkgs.ncurses];
11+
12+ # The `extra-libraries` field in `X11.cabal` does not include Xss and Xinerama
13+ # see https://github.com/input-output-hk/haskell.nix/pull/988
14+ packages.X11.components.library.libs = [
15+ pkgs.xorg.libXScrnSaver
16+ pkgs.xorg.libXinerama
17+ ];
11}
18}
package-set.nix+1−1
@@ -12,7 +12,7 @@ in pkgs.lib.evalModules {
12 # The package descriptions depend on pkgs, which are used to resolve system package dependencies
12 # The package descriptions depend on pkgs, which are used to resolve system package dependencies
13 # as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
13 # as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
14 # augment the existing pkgs set with the specific mappings:
14 # augment the existing pkgs set with the specific mappings:
15− pkgs = pkgs // (import ./lib/system-nixpkgs-map.nix pkgs);
15+ pkgs = import ./lib/system-pkgs.nix pkgs;
16 pkgconfPkgs = import ./lib/pkgconf-nixpkgs-map.nix pkgs;
16 pkgconfPkgs = import ./lib/pkgconf-nixpkgs-map.nix pkgs;
17
17
18 inherit buildModules;
18 inherit buildModules;