This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathflake.nix
91 lines (80 loc) · 3.1 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
{
description = "geniusyield-orderbot";
inputs.haskell-nix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
inputs.plutus.url = "github:input-output-hk/plutus"; # used for libsodium-vrf
# Latest cardano-node: 1.35.2
inputs.cardano-node.url = "github:input-output-hk/cardano-node?ref=1.35.3";
outputs = { self, nixpkgs, haskell-nix, plutus, cardano-node }:
let
supportedSystems = [ "x86_64-linux" ];
perSystem = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = system: import nixpkgs { inherit system; overlays = [ haskell-nix.overlay ]; inherit (haskell-nix) config; };
projectFor = system:
let
deferPluginErrors = true;
pkgs = nixpkgsFor system;
# For adding cardano exes to the nix shell.
cardano-exes = [
cardano-node.apps.${system}.cardano-node
] ++ (with cardano-node.apps.${system}; [
cardano-cli
]);
cardanoExesPath = builtins.concatStringsSep ":" (map (x: builtins.dirOf x.program) cardano-exes);
project = pkgs.haskell-nix.project' {
src = ./.;
compiler-nix-name = "ghc8107";
projectFileName = "cabal.project";
modules = [{
packages = {
plutus-use-cases.flags.defer-plugin-errors = deferPluginErrors;
plutus-ledger.flags.defer-plugin-errors = deferPluginErrors;
plutus-contract.flags.defer-plugin-errors = deferPluginErrors;
cardano-crypto-praos.components.library.pkgconfig =
nixpkgs.lib.mkForce [ [ (import plutus { inherit system; }).pkgs.libsodium-vrf ] ];
cardano-crypto-class.components.library.pkgconfig =
nixpkgs.lib.mkForce [ [ (import plutus { inherit system; }).pkgs.libsodium-vrf ] ];
};
}];
shell = {
withHoogle = true;
nativeBuildInputs = (with pkgs; [
cabal-install
hlint
fd
bashInteractive
jq
haskellPackages.fourmolu
gnumake
gnused
]);
tools = {
haskell-language-server = { };
};
shellHook = ''
export PATH=$PATH:${cardanoExesPath}
export LC_CTYPE=C.UTF-8
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
'';
};
};
in
project;
in
{
project = perSystem projectFor;
flake = perSystem (system: (projectFor system).flake { });
packages = perSystem (system: self.flake.${system}.packages);
apps = perSystem (system: self.flake.${system}.apps);
devShell = perSystem (system:
let
pkgs = nixpkgsFor system;
devShell = self.flake.${system}.devShell;
in
pkgs.lib.overrideDerivation (devShell) (oldAttrs: {
buildInputs = pkgs.lib.lists.unique devShell.buildInputs;
})
);
};
}