Files
haskell.nix/lib/system-pkgs.nix
T
a045d79264 Updated system-nixpkgs-map.nix and a default for X11 package (fixes #984) (#988)
After investigating adding a project argument to override the
mapping of libs to packages we realised we could fix the X11
package by updating `modules/configuration-nix.nix`.

We also updated `system-nixpkgs-map.nix` to allow multiple
packages to be mapped for a single library (turned out not
to be necessary for X11).

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2021-01-08 13:10:00 +13:00

34 lines
941 B
Nix

# Cabal packages can depend on operating system packages. However
# package names vary between distributions - there is no standard.
#
# This file augments the nixpkgs package set with extra attributes
# from the system packages map file.
#
# This package set will be used when resolving system package
# dependencies of package descriptions.
pkgs:
let
buildEnvMaybe = name: paths:
if builtins.length paths == 1
then builtins.head paths
else pkgs.buildEnv { name = "${name}-env"; inherit paths; };
mapPackages = name: ps:
if builtins.typeOf ps == "list"
then buildEnvMaybe name ps
else ps;
in
# Base packages.
pkgs
# fetchgit should always come from the evalPackages
# if it comes from the targetPackages we won't even
# be able to execute it.
// { fetchgit = pkgs.evalPackages.fetchgit; }
# Apply the mapping.
// builtins.mapAttrs mapPackages (import ./system-nixpkgs-map.nix pkgs)