Skip to content

Commit

Permalink
Adopt nix-systems pattern
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sellout committed Dec 10, 2024
1 parent cee4f47 commit e4e8f0a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
23 changes: 12 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@
};

inputs = {
flake-utils = {
inputs.systems.follows = "systems";
url = "github:numtide/flake-utils";
};
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-2405";
flake-utils.url = "github:numtide/flake-utils";
systems = {
flake = false;
url = "./nix/systems.nix";
};
};

outputs = {
self,
flake-utils,
haskellNix,
nixpkgs,
flake-utils,
self,
systems,
}:
flake-utils.lib.eachSystem [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
flake-utils.lib.eachSystem (import systems)
(system: let
## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some
## configuration from the VS Code settings to avoid duplication.
Expand Down
4 changes: 4 additions & 0 deletions nix/systems.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ "aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
]

0 comments on commit e4e8f0a

Please sign in to comment.