mirror of
https://github.com/numtide/flake-utils.git
synced 2025-03-16 21:38:26 +00:00
adds forAllSupported
This commit is contained in:
parent
5888499f0b
commit
f6ee9d535f
2 changed files with 33 additions and 0 deletions
26
default.nix
Normal file
26
default.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
rec {
|
||||||
|
# copied from <nixpkgs/lib>
|
||||||
|
genAttrs = names: f:
|
||||||
|
builtins.listToAttrs (map (n: { name = n; value = f n; }) names);
|
||||||
|
|
||||||
|
# The list of systems supported by nixpkgs and hydra
|
||||||
|
supportedSystems = [
|
||||||
|
"aarch64-linux"
|
||||||
|
"i686-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Returns an attribute set with all the supported systems as keys and the
|
||||||
|
# output of the passed function with each system passed to it.
|
||||||
|
#
|
||||||
|
# This is useful in the flake outputs because the outputs return static sets
|
||||||
|
# that map to the different systems.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# forAllSupported (x: null)
|
||||||
|
# > { aarch64-linux = null; i686-linux = null; x86_64-darwin = null;
|
||||||
|
# > x86_64-linux = null; }
|
||||||
|
# (system -> attrs) -> attrs
|
||||||
|
forAllSupported = genAttrs supportedSystems;
|
||||||
|
}
|
7
flake.nix
Normal file
7
flake.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
description = "Pure Nix flake utility functions";
|
||||||
|
edition = 201909;
|
||||||
|
outputs = { self }: {
|
||||||
|
lib = import ./.;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue