nixpkgs-suyu/pkgs/development/idris-modules/default.nix
Matthew Pickering 40124cd0cf Add wrapper for idris exe for gcc/gmp runtime deps
Fixes #10450

When compiling packages with -o the executable invokes gcc.
There is no compile time flag to control this invocation so for
now we create a wrapper which provides the dependency at runtime.
2017-11-02 23:14:12 +00:00

46 lines
1.6 KiB
Nix

{ pkgs, idris-no-deps, overrides ? (self: super: {}) }: let
inherit (pkgs.lib) callPackageWith fix' extends;
/* Taken from haskell-modules/default.nix, should probably abstract this away */
callPackageWithScope = scope: drv: args: (callPackageWith scope drv args) // {
overrideScope = f: callPackageWithScope (mkScope (fix' (extends f scope.__unfix__))) drv args;
};
mkScope = scope : pkgs // pkgs.xorg // pkgs.gnome2 // scope;
idrisPackages = self: let
defaultScope = mkScope self;
callPackage = callPackageWithScope defaultScope;
builtins_ = pkgs.lib.mapAttrs self.build-builtin-package {
prelude = [];
base = [ self.prelude ];
contrib = [ self.prelude self.base ];
effects = [ self.prelude self.base ];
pruviloj = [ self.prelude self.base ];
};
files = builtins.filter (n: n != "default") (pkgs.lib.mapAttrsToList (name: type: let
m = builtins.match "(.*)\\.nix" name;
in if m == null then "default" else builtins.head m) (builtins.readDir ./.));
in (builtins.listToAttrs (map (name: {
inherit name;
value = callPackage (./. + "/${name}.nix") {};
}) files)) // {
inherit idris-no-deps callPackage;
# See #10450 about why we have to wrap the executable
idris =
(pkgs.callPackage ./idris-wrapper.nix {})
idris-no-deps
{ path = [ pkgs.gcc ]; lib = [pkgs.gmp]; };
# A list of all of the libraries that come with idris
builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_;
} // builtins_;
in fix' (extends overrides idrisPackages)