on iko/ghcjs-patch-master help sign in
Some smalls improvements (#1271)
1205c42Jean-Baptiste Giraudeau
lib/default.nix+7−2
@@ -334,20 +334,25 @@ in {
334 # Run evalModules passing the project function argument (m) as a module along with
334 # Run evalModules passing the project function argument (m) as a module along with
335 # the the a projectType module (../modules/cabal-project.nix or ../modules/stack-project.nix).
335 # the the a projectType module (../modules/cabal-project.nix or ../modules/stack-project.nix).
336 # The resulting config is then passed to the project function's implementation.
336 # The resulting config is then passed to the project function's implementation.
337− evalProjectModule = projectType: m: f: f
337+ evalProjectModule = projectType: m: f:
338+ let project = f
338 (lib.evalModules {
339 (lib.evalModules {
339 modules = (if builtins.isList m then m else [m]) ++ [
340 modules = (if builtins.isList m then m else [m]) ++ [
340 # Include ../modules/cabal-project.nix or ../modules/stack-project.nix
341 # Include ../modules/cabal-project.nix or ../modules/stack-project.nix
341 (import ../modules/project-common.nix)
342 (import ../modules/project-common.nix)
342 (import projectType)
343 (import projectType)
343− # Pass the pkgs to the modules
344+ # Pass the pkgs and the buildProject to the modules
344 ({ config, lib, ... }: {
345 ({ config, lib, ... }: {
345 _module.args = {
346 _module.args = {
346 inherit pkgs;
347 inherit pkgs;
348+ # to make it easy to depends on build packages in, eg., shell definition:
349+ inherit (project) buildProject;
347 };
350 };
351+ inherit (project) hsPkgs;
348 })
352 })
349 ];
353 ];
350 }).config;
354 }).config;
355+ in project;
351
356
352 # Converts from a `compoent.depends` value to a library derivation.
357 # Converts from a `compoent.depends` value to a library derivation.
353 # In the case of sublibs the `depends` value should already be the derivation.
358 # In the case of sublibs the `depends` value should already be the derivation.
lib/stack-cache-generator.nix+5−1
@@ -103,7 +103,11 @@ concatMap (dep:
103 }
103 }
104 else builtins.fetchGit ({
104 else builtins.fetchGit ({
105 inherit (dep) url rev;
105 inherit (dep) url rev;
106− } // pkgs.lib.optionalAttrs (branch != null) { ref = branch; });
106+ } // (if branch != null
107+ then { ref = branch; }
108+ # Don't fail if rev not in default branch:
109+ else { allRefs = true; })
110+ );
107 in map (subdir: {
111 in map (subdir: {
108 name = cabalName "${pkgsrc}/${subdir}";
112 name = cabalName "${pkgsrc}/${subdir}";
109 inherit (dep) url rev;
113 inherit (dep) url rev;
modules/project-common.nix+3
@@ -24,5 +24,8 @@ with lib.types;
24 shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
24 shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
25 '';
25 '';
26 };
26 };
27+ hsPkgs = lib.mkOption {
28+ type = lib.types.unspecified;
29+ };
27 };
30 };
28}
31}
overlays/haskell.nix+11−2
@@ -308,7 +308,10 @@ final: prev: {
308 assert isNull sha256;
308 assert isNull sha256;
309 builtins.fetchGit
309 builtins.fetchGit
310 ({ inherit url rev; } //
310 ({ inherit url rev; } //
311− final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
311+ (if ref != null
312+ then { inherit ref; }
313+ # Don't fail if rev not in default branch:
314+ else { allRefs = true; })
312 )
315 )
313 else
316 else
314 # Non-private repos must have sha256 set.
317 # Non-private repos must have sha256 set.
@@ -402,7 +405,10 @@ final: prev: {
402 then
405 then
403 builtins.fetchGit
406 builtins.fetchGit
404 ({ inherit url rev; } //
407 ({ inherit url rev; } //
405− final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
408+ (if ref != null
409+ then { inherit ref; }
410+ # don't fail if rev not in default branch:
411+ else { allRefs = true; })
406 )
412 )
407 else
413 else
408 final.evalPackages.fetchgit { inherit url rev sha256; };
414 final.evalPackages.fetchgit { inherit url rev sha256; };
@@ -725,6 +731,9 @@ final: prev: {
725 ++ final.lib.mapAttrsToList (n: v:
731 ++ final.lib.mapAttrsToList (n: v:
726 { name = "${prefix}${packageName}:test:${n}"; value = v; })
732 { name = "${prefix}${packageName}:test:${n}"; value = v; })
727 (package.components.tests)
733 (package.components.tests)
734+ ++ final.lib.mapAttrsToList (n: v:
735+ { name = "${prefix}${packageName}:benchmarks:${n}"; value = v; })
736+ (package.components.benchmarks)
728 ) (packageNames project);
737 ) (packageNames project);
729 checksForProject = prefix: project:
738 checksForProject = prefix: project:
730 final.lib.concatMap (packageName:
739 final.lib.concatMap (packageName: