1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-04-08 18:14:00 +00:00

Add a default value for systems

This commit is contained in:
Yang, Bo 2023-05-07 19:49:39 -07:00
parent 8caa44d021
commit b4ca8ac2e4
3 changed files with 27 additions and 2 deletions

18
flake.lock generated
View file

@ -20,7 +20,23 @@
},
"root": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": "nixpkgs-lib",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},

View file

@ -3,6 +3,7 @@
inputs = {
nixpkgs-lib.url = "github:NixOS/nixpkgs/nixos-unstable?dir=lib";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs-lib, ... }: {

View file

@ -1,4 +1,4 @@
{ config, lib, flake-parts-lib, self, ... }:
{ config, lib, flake-parts-lib, self, inputsByOutPath, ... }:
let
inherit (lib)
genAttrs
@ -64,8 +64,16 @@ in
All the system types to enumerate in the flake output subattributes.
In other words, all valid values for `system` in e.g. `packages.<system>.foo`.
The default value can be changed by switching to different [nix-systems](https://github.com/nix-systems/nix-systems)
input. For example, suppose you create a `my-flake`, which includes a `perSystem.packages.my-package` for
default systems, the user of `my-flake` should be able to try out `riscv64-linux` by specifying:
```
inputs.my-flake.inputs.flake-parts.inputs.systems.url = "github:nix-systems/riscv64-linux"
```
'';
type = types.listOf types.str;
default = import (inputsByOutPath ../.).systems;
};
perInput = mkOption {