Skip to content

Commit e4e8f0a

Browse files
committed
Adopt nix-systems pattern
Somewhat described at https://github.com/nix-systems/nix-systems This is useful for Haskell projects, because commands like ```bash nix flake show --allow-import-from-derivation ``` can often fail, complaining that it can’t find some other architecture to build on. With nix-systems, you can append `--override-input systems github:nix-systems/x86_64-linux` to the command to ensure that x86_64-linux is the only platform in play.
1 parent cee4f47 commit e4e8f0a

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

flake.lock

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

flake.nix

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@
77
};
88

99
inputs = {
10+
flake-utils = {
11+
inputs.systems.follows = "systems";
12+
url = "github:numtide/flake-utils";
13+
};
1014
haskellNix.url = "github:input-output-hk/haskell.nix";
1115
nixpkgs.follows = "haskellNix/nixpkgs-2405";
12-
flake-utils.url = "github:numtide/flake-utils";
16+
systems = {
17+
flake = false;
18+
url = "./nix/systems.nix";
19+
};
1320
};
1421

1522
outputs = {
16-
self,
23+
flake-utils,
1724
haskellNix,
1825
nixpkgs,
19-
flake-utils,
26+
self,
27+
systems,
2028
}:
21-
flake-utils.lib.eachSystem [
22-
"x86_64-linux"
23-
"x86_64-darwin"
24-
"aarch64-darwin"
25-
]
29+
flake-utils.lib.eachSystem (import systems)
2630
(system: let
2731
## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some
2832
## configuration from the VS Code settings to avoid duplication.

nix/systems.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[ "aarch64-darwin"
2+
"x86_64-darwin"
3+
"x86_64-linux"
4+
]

0 commit comments

Comments
 (0)