-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
110 lines (103 loc) · 3.79 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
98
99
100
101
102
103
104
105
106
107
108
109
110
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
flake-compat.url = "github:input-output-hk/flake-compat";
flake-compat.flake = false;
cardano-node.url = "github:IntersectMBO/cardano-node/10.1.4";
cardano-node.flake = false; # otherwise, +2k dependencies we don’t really use
testgen-hs.url = "github:input-output-hk/testgen-hs/10.1.4.0"; # make sure it follows cardano-node
testgen-hs.flake = false; # otherwise, +2k dependencies we don’t really use
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
cardano-playground.url = "github:input-output-hk/cardano-playground/b4f47fd78beec0ea1ed880d6f0b794919e0c0463";
cardano-playground.flake = false; # otherwise, +9k dependencies in flake.lock…
};
outputs = inputs: let
inherit (inputs.nixpkgs) lib;
in
inputs.flake-parts.lib.mkFlake {inherit inputs;} ({config, ...}: {
imports = [
inputs.devshell.flakeModule
inputs.treefmt-nix.flakeModule
];
flake.internal =
lib.genAttrs config.systems (
targetSystem: import ./nix/internal/unix.nix {inherit inputs targetSystem;}
)
// lib.genAttrs ["x86_64-windows"] (
targetSystem: import ./nix/internal/windows.nix {inherit inputs targetSystem;}
);
systems = [
"x86_64-linux"
# "aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem = {
config,
system,
pkgs,
...
}: {
packages = let
internal = inputs.self.internal.${system};
in
{
default = internal.package;
inherit (internal) tx-build cardano-address testgen-hs;
}
// (lib.optionalAttrs (system == "x86_64-linux") {
default-x86_64-windows = inputs.self.internal.x86_64-windows.package;
});
devshells.default = import ./nix/devshells.nix {inherit inputs;};
treefmt = {pkgs, ...}: {
projectRootFile = "flake.nix";
programs.alejandra.enable = true; # Nix
programs.prettier.enable = true;
settings.formatter.prettier.options = [
"--config"
(builtins.path {
path = ./docs/.prettierrc;
name = "prettierrc.json";
})
];
programs.rustfmt.enable = true;
programs.yamlfmt.enable = pkgs.system != "x86_64-darwin"; # a treefmt-nix+yamlfmt bug on Intel Macs
programs.taplo.enable = true; # TOML
programs.shfmt.enable = true;
};
};
flake.hydraJobs = let
allJobs = {
blockfrost-platform =
lib.genAttrs (
config.systems
# ++ ["x86_64-windows"]
) (
targetSystem: inputs.self.internal.${targetSystem}.package
);
devshell = lib.genAttrs config.systems (
targetSystem: inputs.self.devShells.${targetSystem}.default
);
inherit (inputs.self) checks;
};
in
allJobs
// {
required = inputs.nixpkgs.legacyPackages.x86_64-linux.releaseTools.aggregate {
name = "github-required";
meta.description = "All jobs required to pass CI";
constituents = lib.collect lib.isDerivation allJobs;
};
};
flake.nixConfig = {
extra-substituters = ["https://cache.iog.io"];
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
allow-import-from-derivation = "true";
};
});
}