mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
stdenv: remove unix kernel family
System predicate patterns can now be specified as a list of OR'd attribute sets.
This commit is contained in:
parent
be75c5dffb
commit
4ac1901d54
@ -1,8 +1,9 @@
|
|||||||
with import ./parse.nix;
|
with import ./parse.nix;
|
||||||
with import ../attrsets.nix;
|
with import ../attrsets.nix;
|
||||||
|
with import ../lists.nix;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
patterns = {
|
patterns = rec {
|
||||||
"32bit" = { cpu = { bits = 32; }; };
|
"32bit" = { cpu = { bits = 32; }; };
|
||||||
"64bit" = { cpu = { bits = 64; }; };
|
"64bit" = { cpu = { bits = 64; }; };
|
||||||
i686 = { cpu = cpuTypes.i686; };
|
i686 = { cpu = cpuTypes.i686; };
|
||||||
@ -13,8 +14,8 @@ rec {
|
|||||||
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
|
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
|
||||||
LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
|
LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
|
||||||
|
|
||||||
Unix = { kernel = { families = { inherit (kernelFamilies) unix; }; }; };
|
|
||||||
BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
|
BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
|
||||||
|
Unix = [ BSD Linux SunOS Hurd Cygwin ];
|
||||||
|
|
||||||
Darwin = { kernel = kernels.darwin; };
|
Darwin = { kernel = kernels.darwin; };
|
||||||
Linux = { kernel = kernels.linux; };
|
Linux = { kernel = kernels.linux; };
|
||||||
@ -27,11 +28,15 @@ rec {
|
|||||||
Cygwin = { kernel = kernels.windows; abi = abis.cygnus; };
|
Cygwin = { kernel = kernels.windows; abi = abis.cygnus; };
|
||||||
MinGW = { kernel = kernels.windows; abi = abis.gnu; };
|
MinGW = { kernel = kernels.windows; abi = abis.gnu; };
|
||||||
|
|
||||||
Arm32 = recursiveUpdate patterns.Arm patterns."32bit";
|
Arm32 = recursiveUpdate Arm patterns."32bit";
|
||||||
Arm64 = recursiveUpdate patterns.Arm patterns."64bit";
|
Arm64 = recursiveUpdate Arm patterns."64bit";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
matchAnyAttrs = patterns:
|
||||||
|
if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns
|
||||||
|
else matchAttrs patterns;
|
||||||
|
|
||||||
predicates = mapAttrs'
|
predicates = mapAttrs'
|
||||||
(name: value: nameValuePair ("is" + name) (matchAttrs value))
|
(name: value: nameValuePair ("is" + name) (matchAnyAttrs value))
|
||||||
patterns;
|
patterns;
|
||||||
}
|
}
|
||||||
|
@ -68,21 +68,20 @@ rec {
|
|||||||
isKernelFamily = isType "kernel-family";
|
isKernelFamily = isType "kernel-family";
|
||||||
kernelFamilies = setTypes "kernel-family" {
|
kernelFamilies = setTypes "kernel-family" {
|
||||||
bsd = {};
|
bsd = {};
|
||||||
unix = {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
isKernel = x: isType "kernel" x;
|
isKernel = x: isType "kernel" x;
|
||||||
kernels = with execFormats; with kernelFamilies; setTypesAssert "kernel"
|
kernels = with execFormats; with kernelFamilies; setTypesAssert "kernel"
|
||||||
(x: isExecFormat x.execFormat && all isKernelFamily (attrValues x.families))
|
(x: isExecFormat x.execFormat && all isKernelFamily (attrValues x.families))
|
||||||
{
|
{
|
||||||
darwin = { execFormat = macho; families = { inherit unix; }; };
|
darwin = { execFormat = macho; families = { }; };
|
||||||
freebsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
freebsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||||
hurd = { execFormat = elf; families = { inherit unix; }; };
|
hurd = { execFormat = elf; families = { }; };
|
||||||
linux = { execFormat = elf; families = { inherit unix; }; };
|
linux = { execFormat = elf; families = { }; };
|
||||||
netbsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
netbsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||||
none = { execFormat = unknown; families = { inherit unix; }; };
|
none = { execFormat = unknown; families = { }; };
|
||||||
openbsd = { execFormat = elf; families = { inherit unix bsd; }; };
|
openbsd = { execFormat = elf; families = { inherit bsd; }; };
|
||||||
solaris = { execFormat = elf; families = { inherit unix; }; };
|
solaris = { execFormat = elf; families = { }; };
|
||||||
windows = { execFormat = pe; families = { }; };
|
windows = { execFormat = pe; families = { }; };
|
||||||
} // { # aliases
|
} // { # aliases
|
||||||
# TODO(@Ericson2314): Handle these Darwin version suffixes more generally.
|
# TODO(@Ericson2314): Handle these Darwin version suffixes more generally.
|
||||||
|
Loading…
Reference in New Issue
Block a user