forked from IntersectMBO/cardano-addresses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
97 lines (86 loc) · 3.13 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
description = "Cardano Addresses";
inputs = {
nixpkgs.follows = "haskellNix/nixpkgs-2105";
haskellNix = {
url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
iohkNix = {
url = "github:input-output-hk/iohk-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:input-output-hk/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, haskellNix, iohkNix, ... }:
let
inherit (nixpkgs) lib;
inherit (flake-utils.lib) eachSystem mkApp;
supportedSystems = import ./nix/supported-systems.nix;
defaultSystem = lib.head supportedSystems;
overlay = final: prev:
{
cardanoAddressesHaskellProject = self.legacyPackages.${final.system};
inherit (final.cardanoAddressesHaskellProject.cardano-addresses-cli.components.exes) cardano-address;
inherit (final.cardanoAddressesHaskellProject.projectCross.ghcjs.hsPkgs) cardano-addresses-jsapi;
inherit (self.packages.${final.system}) cardano-addresses-js cardano-addresses-demo-js;
};
in
{
inherit overlay;
} // eachSystem supportedSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
inherit (haskellNix) config;
overlays = [
haskellNix.overlay
iohkNix.overlays.utils
iohkNix.overlays.crypto
(final: prev: {
cabal = final.haskell-nix.tool haskellProject.pkg-set.config.compiler.nix-name "cabal" {
version = "latest";
};
})
overlay
];
};
haskellProject = (import ./nix/haskell.nix pkgs.haskell-nix);
cardano-addresses-js = pkgs.callPackage ./nix/cardano-addresses-js.nix { };
cardano-addresses-demo-js = pkgs.callPackage ./nix/cardano-addresses-demo-js.nix { };
cardano-addresses-js-shell = pkgs.callPackage ./nix/cardano-addresses-js-shell.nix { };
flake = haskellProject.flake {
crossPlatforms = p: with p; [ ghcjs ]
++ (lib.optionals (system == "x86_64-linux") [
mingwW64
musl64
]);
};
in
lib.recursiveUpdate flake {
legacyPackages = haskellProject;
# Built by `nix build .`
defaultPackage = flake.packages."cardano-addresses-cli:exe:cardano-address";
# Run by `nix run .`
defaultApp = flake.apps."cardano-addresses-cli:exe:cardano-address";
packages = {
inherit cardano-addresses-js cardano-addresses-demo-js cardano-addresses-js-shell;
};
apps = {
repl = mkApp {
drv = pkgs.writeShellScriptBin "repl" ''
confnix=$(mktemp)
echo "builtins.getFlake (toString $(git rev-parse --show-toplevel))" >$confnix
trap "rm $confnix" EXIT
nix repl $confnix
'';
};
};
}
);
}