Skip to content

Commit a883469

Browse files
committed
extra-hackages wip
1 parent 1ab405a commit a883469

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

flake.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
88

9+
haskell-nix-extra-hackage = {
10+
url = "github:mlabs-haskell/haskell-nix-extra-hackage/main";
11+
inputs.nixpkgs.follows = "nixpkgs";
12+
inputs.haskell-nix.follows = "haskell-nix";
13+
};
14+
915
iohk-nix.url = "github:input-output-hk/iohk-nix";
1016
iohk-nix.flake = false; # Bad Nix code
1117

@@ -316,16 +322,31 @@
316322
}
317323
];
318324

325+
extraHackagePackages = with nixpkgs.lib;
326+
(concatLists (map
327+
(extraSource: (map
328+
(subdir:
329+
if subdir == "." then extraSource.src.outPath else "${extraSource.src.outPath}/${subdir}")
330+
extraSource.subdirs))
331+
extraSources));
332+
319333
projectFor = system:
320334
let
321335
pkgs = nixpkgsFor system;
322336
pkgs' = nixpkgsFor' system;
337+
# Usage:
338+
extraHackage = inputs.haskell-nix-extra-hackage.mkHackage.${system} extraHackagePackages;
323339
in
324340
pkgs.haskell-nix.cabalProject' {
325341
src = ./.;
326-
inherit cabalProjectLocal extraSources;
342+
inherit cabalProjectLocal;
327343
name = "bot-plutus-interface";
328344
compiler-nix-name = "ghc8107";
345+
346+
extra-hackages = [ (import extraHackage.hackageNix) ];
347+
extra-hackage-tarballs = [{ name = "extraHackage"; index = extraHackage.hackageTarball; }];
348+
modules = [ extraHackage.module ] ++ haskellModules;
349+
329350
shell = {
330351
additional = ps: [
331352
ps.plutus-pab
@@ -345,7 +366,6 @@
345366
nixpkgs-fmt
346367
];
347368
};
348-
modules = haskellModules;
349369
};
350370

351371
formatCheckFor = system:

0 commit comments

Comments
 (0)