Skip to content

Commit c9ffefb

Browse files
committed
Support for overriding package src
1 parent 2758551 commit c9ffefb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/package.nix

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, config, pkgs, haskellLib, ... }:
1+
{ lib, options, config, pkgs, haskellLib, ... }:
22

33
# Work around issue that can cause _lots_ of files to be copied into the store.
44
# See https://github.com/NixOS/nixpkgs/pull/64691
@@ -209,12 +209,15 @@ in
209209
};
210210

211211
src = lib.mkOption {
212-
type = types.either path types.package;
212+
type = types.nullOr (types.either path types.package);
213213
default =
214-
pkgs.fetchurl {
215-
url = "mirror://hackage/${config.name}.tar.gz";
216-
inherit (config) sha256;
217-
};
214+
if options.package.identifier.name.isDefined && options.package.identifier.version.isDefined && options.sha256.isDefined
215+
then
216+
pkgs.fetchurl {
217+
url = "mirror://hackage/${config.name}.tar.gz";
218+
inherit (config) sha256;
219+
}
220+
else null;
218221
defaultText = ''
219222
pkgs.fetchurl {
220223
url = "mirror://hackage/$'{config.name}.tar.gz";

0 commit comments

Comments
 (0)