|
1 | 1 | {
|
2 | 2 | # inspired by: https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications
|
3 | 3 | description = "A Hello World in Haskell with a dependency and a devShell";
|
4 |
| - inputs.nixpkgs.url = "nixpkgs"; |
5 |
| - outputs = { self, nixpkgs }: |
| 4 | + inputs = |
| 5 | + { |
| 6 | + nixpkgs.url = "nixpkgs"; |
| 7 | + hs-web3 = |
| 8 | + { url = "hs-web3"; |
| 9 | + inputs.nixpkgs.url = "nixpkgs"; |
| 10 | + }; |
| 11 | + }; |
| 12 | + outputs = { self, nixpkgs, hs-web3 }: |
6 | 13 | let
|
7 | 14 | supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
|
8 | 15 | forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
9 | 16 | nixpkgsFor = forAllSystems (system: import nixpkgs {
|
10 | 17 | inherit system;
|
11 |
| - overlays = [ self.overlay ]; |
| 18 | + overlays = [ (self.overlay system) ]; |
12 | 19 | });
|
13 | 20 | in
|
14 | 21 | {
|
15 |
| - overlay = (final: prev: { |
16 |
| - pixura-contracts = final.haskell.packages.ghc923.callPackage (import ./default.nix) { |
| 22 | + overlay = (system: final: prev: { |
| 23 | + pixura-contracts = final.haskell.packages.ghc924.callPackage (import ./default.nix) { |
17 | 24 | inherit (final) zlib;
|
| 25 | + inherit (hs-web3.packages.${system}) web3; |
18 | 26 | };
|
19 | 27 | });
|
20 | 28 | packages = forAllSystems (system: {
|
21 | 29 | pixura-contracts = nixpkgsFor.${system}.pixura-contracts;
|
22 | 30 | });
|
23 | 31 | defaultPackage = forAllSystems (system: self.packages.${system}.pixura-contracts);
|
24 | 32 | checks = self.packages;
|
25 |
| - devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskell.packages.ghc923; |
26 |
| - in haskellPackages.shellFor { |
27 |
| - packages = p: [self.packages.${system}.pixura-contracts]; |
28 |
| - withHoogle = true; |
29 |
| - buildInputs = with haskellPackages; [ |
30 |
| - haskell-language-server |
31 |
| - ghcid |
32 |
| - cabal-install |
33 |
| - ]; |
34 |
| - # Change the prompt to show that you are in a devShell |
35 |
| - # shellHook = "export PS1='\\e[1;34mdev > \\e[0m'"; |
36 |
| - }); |
37 |
| - }; |
| 33 | + devShell = forAllSystems (system: |
| 34 | + let haskellPackages = nixpkgsFor.${system}.haskell.packages.ghc924; |
| 35 | + in haskellPackages.shellFor |
| 36 | + { |
| 37 | + packages = p: [self.packages.${system}.pixura-contracts]; |
| 38 | + withHoogle = true; |
| 39 | + buildInputs = with haskellPackages; |
| 40 | + [ |
| 41 | + haskell-language-server |
| 42 | + cabal-install |
| 43 | + ]; |
| 44 | + # Change the prompt to show that you are in a devShell |
| 45 | + # shellHook = "export PS1='\\e[1;34mdev > \\e[0m'"; |
| 46 | + }); |
| 47 | + }; |
38 | 48 | }
|
0 commit comments