Compare commits

...

38 commits

Author SHA1 Message Date
Jeff Hykin dd6d59a04d improve test script 2024-05-26 10:31:46 -04:00
Jeff Hykin cac07bdeee get check-eval.nix working 2024-05-26 10:27:28 -04:00
Jeff Hykin 3b9a7b9277 temove tests that depend on pkgs 2024-05-26 10:27:11 -04:00
Jeff Hykin 5fc6685efe add basic test script 2024-05-26 10:26:37 -04:00
Jeff Hykin 7916f50847 remove top level nix inherits 2024-05-26 10:20:23 -04:00
Jeff Hykin 63c79d1b48 simplify top of lib 2024-05-26 10:05:03 -04:00
Jeff Hykin 590b181303 add note 2024-05-26 09:59:56 -04:00
Jeff Hykin a38922846e reduce indirection 2024-05-26 09:57:20 -04:00
Jeff Hykin 6ce2f22854 add WIP trivial 2024-05-25 13:19:19 -04:00
Jeff Hykin 0911efe6d2 add other static info 2024-05-25 13:17:55 -04:00
Jeff Hykin 06688e3ab8 fix logical or 2024-05-25 13:17:47 -04:00
Jeff Hykin 01b6beb111 add id, const, pipe, concat, or, and, xor, bitNot, boolToString, mergeAttrs, flip, mapNullable 2024-05-25 13:04:22 -04:00
Jeff Hykin 427ad23000 add throwIfNot 2024-05-25 12:58:35 -04:00
Jeff Hykin 2ca5e185ce - 2024-05-25 12:55:53 -04:00
Jeff Hykin e0f04630de change how static is handled 2024-05-25 12:55:31 -04:00
Jeff Hykin 9e3062a5d8 - 2024-05-25 12:33:24 -04:00
Jeff Hykin df3269bfeb add reverseList 2024-05-25 12:29:12 -04:00
Jeff Hykin 1462db9587 add setFunctionArgs 2024-05-25 12:26:31 -04:00
Jeff Hykin 2613fed53e add functionArgs 2024-05-25 12:22:03 -04:00
Jeff Hykin 415acdce94 improve foundation 2024-05-25 12:20:22 -04:00
Jeff Hykin a4c9fde3e9 start detangling lib 2024-05-25 12:14:33 -04:00
Jeff Hykin 9cb4ed1ffc - 2024-05-25 12:13:51 -04:00
Jeff Hykin 11c40a8dcf add release to setup.toml 2024-05-25 11:44:27 -04:00
Jeff Hykin 97466d7f6d start to untangle lib 2024-05-25 11:44:17 -04:00
Jeff Hykin ab9110a43b move minNixVersion into meta.toml 2024-05-25 11:32:17 -04:00
Jeff Hykin 68d28c7f95 add teams for backwards compat (intentional duplicated entries) 2024-05-25 11:29:14 -04:00
Jeff Hykin f144947b81 add maintainers for backwards compatibility 2024-05-25 11:26:35 -04:00
Jeff Hykin e987e7b28b switch everything to toml 2024-05-25 11:18:25 -04:00
Jeff Hykin 7dc5f8db8e clean unused 2024-05-25 11:02:20 -04:00
Jeff Hykin 8f0b52892c make sourceTypes json 2024-05-25 11:02:11 -04:00
Jeff Hykin 735f118b90 add todo 2024-05-25 10:59:28 -04:00
Jeff Hykin adff8800eb make licenses static 2024-05-25 10:39:23 -04:00
Jeff Hykin ff9633d02b clean up lib 2024-05-25 10:31:17 -04:00
Jeff Hykin acb415f94f add WIP stage0_darwin 2024-05-25 10:30:52 -04:00
Jeff Hykin 040494bb21 new bootTools is working 2024-05-21 23:53:33 -04:00
Jeff Hykin 3864986c18 git subrepo clone (merge) git@github.com:nix-community/nixpkgs.lib.git lib
subrepo:
  subdir:   "lib"
  merged:   "0df131b5"
upstream:
  origin:   "git@github.com:nix-community/nixpkgs.lib.git"
  branch:   "master"
  commit:   "0df131b5"
git-subrepo:
  version:  "0.4.5"
  origin:   "???"
  commit:   "???"
2024-05-21 22:12:54 -04:00
Jeff Hykin 91911cb438 WIP bootstrap tools 2024-05-21 22:12:38 -04:00
Jeff Hykin 4e14b7b16c clear out everything 2024-05-21 21:36:48 -04:00
2676 changed files with 31430 additions and 305887 deletions

View file

@ -1,28 +0,0 @@
let requiredVersion = import ./lib/minver.nix; in
if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
abort ''
This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:
- If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.
- Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
upgrade Nix. You may use `nix-env --version' to check which version you have.
- If you installed Nix using the install script (https://nixos.org/nix/install),
it is safe to upgrade by running it again:
curl -L https://nixos.org/nix/install | sh
For more information, please see the NixOS release notes at
https://nixos.org/nixos/manual or locally at
${toString ./nixos/doc/manual/release-notes}.
If you need further help, see https://nixos.org/nixos/support.html
''
else
import ./pkgs/top-level/impure.nix

View file

@ -1,46 +1,5 @@
{
outputs = { self, ... }:
let
forAllSystems = self.lib.genAttrs self.lib.systems.flakeExposed;
in
{
lib = import ./lib;
auxPackages = forAllSystems (system:
(
let requiredVersion = import ./lib/minver.nix; in
if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
abort ''
This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:
- If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.
- Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
upgrade Nix. You may use `nix-env --version' to check which version you have.
- If you installed Nix using the install script (https://nixos.org/nix/install),
it is safe to upgrade by running it again:
curl -L https://nixos.org/nix/install | sh
For more information, please see the NixOS release notes at
https://nixos.org/nixos/manual or locally at
${toString ./nixos/doc/manual/release-notes}.
If you need further help, see https://nixos.org/nixos/support.html
''
else
import ./pkgs/top-level/default.nix { localSystem = system; }
)
);
legacyPackages = forAllSystems (system: import ./. { inherit system; });
# To test, run nix build .#tests.x86_64-linux.release
tests = forAllSystems (system: {
systems = import ./lib/tests/systems.nix;
release = import ./lib/tests/release.nix { pkgs = self.auxPackages.${system}; };
});
};
{}
;
}

View file

@ -1,171 +0,0 @@
/* Library of low-level helper functions for nix expressions.
*
* Please implement (mostly) exhaustive unit tests
* for new functions in `./tests.nix`.
*/
let
inherit (import ./fixed-points.nix { inherit lib; }) makeExtensible;
lib = makeExtensible (self: let
callLibs = file: import file { lib = self; };
in {
# often used, or depending on very little
trivial = callLibs ./trivial.nix;
fixedPoints = callLibs ./fixed-points.nix;
# datatypes
attrsets = callLibs ./attrsets.nix;
lists = callLibs ./lists.nix;
strings = callLibs ./strings.nix;
stringsWithDeps = callLibs ./strings-with-deps.nix;
# packaging
customisation = callLibs ./customisation.nix;
derivations = callLibs ./derivations.nix;
maintainers = import ../maintainers/maintainer-list.nix;
teams = callLibs ../maintainers/team-list.nix;
meta = callLibs ./meta.nix;
versions = callLibs ./versions.nix;
# module system
modules = callLibs ./modules.nix;
options = callLibs ./options.nix;
types = callLibs ./types.nix;
# constants
licenses = callLibs ./licenses.nix;
sourceTypes = callLibs ./source-types.nix;
systems = callLibs ./systems;
# serialization
cli = callLibs ./cli.nix;
gvariant = callLibs ./gvariant.nix;
generators = callLibs ./generators.nix;
# misc
asserts = callLibs ./asserts.nix;
debug = callLibs ./debug.nix;
misc = callLibs ./deprecated/misc.nix;
# domain-specific
fetchers = callLibs ./fetchers.nix;
# Eval-time filesystem handling
path = callLibs ./path;
filesystem = callLibs ./filesystem.nix;
fileset = callLibs ./fileset;
sources = callLibs ./sources.nix;
# back-compat aliases
platforms = self.systems.doubles;
# linux kernel configuration
kernel = callLibs ./kernel.nix;
inherit (builtins) add addErrorContext attrNames concatLists
deepSeq elem elemAt filter genericClosure genList getAttr
hasAttr head isAttrs isBool isInt isList isPath isString length
lessThan listToAttrs pathExists readFile replaceStrings seq
stringLength sub substring tail trace;
inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
info showWarnings nixpkgsVersion version isInOldestRelease
mod compare splitByAndCompare
functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs
toHexString toBaseDigits inPureEvalMode;
inherit (self.fixedPoints) fix fix' converge extends composeExtensions
composeManyExtensions makeExtensible makeExtensibleWithCustomName;
inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs
filterAttrsRecursive foldlAttrs foldAttrs collect nameValuePair mapAttrs
mapAttrs' mapAttrsToList attrsToList concatMapAttrs mapAttrsRecursive
mapAttrsRecursiveCond genAttrs isDerivation toDerivation optionalAttrs
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput
getBin getLib getDev getMan chooseDevOutputs zipWithNames zip
recurseIntoAttrs dontRecurseIntoAttrs cartesianProduct cartesianProductOfSets
mapCartesianProduct updateManyAttrsByPath;
inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
ifilter0 concatMap flatten remove findSingle findFirst any all count
optional optionals toList range replicate partition zipListsWith zipLists
reverseList listDfs toposort sort sortOn naturalSort compareLists take
drop sublist last init crossLists unique allUnique intersectLists
subtractLists mutuallyExclusive groupBy groupBy';
inherit (self.strings) concatStrings concatMapStrings concatImapStrings
intersperse concatStringsSep concatMapStringsSep
concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput
makeLibraryPath makeIncludePath makeBinPath optionalString
hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
escapeShellArg escapeShellArgs
isStorePath isStringLike
isValidPosixName toShellVar toShellVars
escapeRegex escapeURL escapeXML replaceChars lowerChars
upperChars toLower toUpper addContextFrom splitString
removePrefix removeSuffix versionOlder versionAtLeast
getName getVersion
cmakeOptionType cmakeBool cmakeFeature
mesonOption mesonBool mesonEnable
nameFromURL enableFeature enableFeatureAs withFeature
withFeatureAs fixedWidthString fixedWidthNumber
toInt toIntBase10 readPathsFromFile fileContents;
inherit (self.stringsWithDeps) textClosureList textClosureMap
noDepEntry fullDepEntry packEntry stringAfter;
inherit (self.customisation) overrideDerivation makeOverridable
callPackageWith callPackagesWith extendDerivation hydraJob
makeScope makeScopeWithSplicing makeScopeWithSplicing';
inherit (self.derivations) lazyDerivation optionalDrvAttr;
inherit (self.meta) addMetaAttrs dontDistribute setName updateName
appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
hiPrioSet getLicenseFromSpdxId getExe getExe';
inherit (self.filesystem) pathType pathIsDirectory pathIsRegularFile
packagesFromDirectoryRecursive;
inherit (self.sources) cleanSourceFilter
cleanSource sourceByRegex sourceFilesBySuffices
commitIdFromGitRepo cleanSourceWith pathHasContext
canCleanSource pathIsGitRepo;
inherit (self.modules) evalModules setDefaultModuleLocation
unifyModuleSyntax applyModuleArgsIfFunction mergeModules
mergeModules' mergeOptionDecls mergeDefinitions
pushDownProperties dischargeProperties filterOverrides
sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride
mkOptionDefault mkDefault mkImageMediaOverride mkForce mkVMOverride
mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions
mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule
mkRenamedOptionModule mkRenamedOptionModuleWith
mkMergedOptionModule mkChangedOptionModule
mkAliasOptionModule mkDerivedConfig doRename
mkAliasOptionModuleMD;
evalOptionValue = lib.warn "External use of `lib.evalOptionValue` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/." self.modules.evalOptionValue;
inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
mergeDefaultOption mergeOneOption mergeEqualOption mergeUniqueOption
getValues getFiles
optionAttrSetToDocList optionAttrSetToDocList'
scrubOptionValue literalExpression literalExample
showOption showOptionWithDefLocs showFiles
unknownModule mkOption mkPackageOption mkPackageOptionMD
mdDoc literalMD;
inherit (self.types) isType setType defaultTypeMerge defaultFunctor
isOptionType mkOptionType;
inherit (self.asserts)
assertMsg assertOneOf;
inherit (self.debug) traceIf traceVal traceValFn
traceSeq traceSeqN traceValSeq
traceValSeqFn traceValSeqN traceValSeqNFn traceFnSeqN
runTests testAllTrue;
inherit (self.misc) maybeEnv defaultMergeArg defaultMerge foldArgs
maybeAttrNullable maybeAttr ifEnable checkFlag getValue
checkReqs uniqList uniqListExt condConcat lazyGenericClosure
innerModifySumArgs modifySumArgs innerClosePropagation
closePropagation mapAttrsFlatten nvs setAttr setAttrMerge
mergeAttrsWithFunc mergeAttrsConcatenateValues
mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
mergeAttrsByFuncDefaultsClean mergeAttrBy
fakeHash fakeSha256 fakeSha512
nixType imap;
inherit (self.versions)
splitVersion;
});
in lib

View file

@ -1,309 +0,0 @@
{ lib, ... }:
rec {
/*
`fix f` computes the fixed point of the given function `f`. In other words, the return value is `x` in `x = f x`.
`f` must be a lazy function.
This means that `x` must be a value that can be partially evaluated,
such as an attribute set, a list, or a function.
This way, `f` can use one part of `x` to compute another part.
**Relation to syntactic recursion**
This section explains `fix` by refactoring from syntactic recursion to a call of `fix` instead.
For context, Nix lets you define attributes in terms of other attributes syntactically using the [`rec { }` syntax](https://nixos.org/manual/nix/stable/language/constructs.html#recursive-sets).
```nix
nix-repl> rec {
foo = "foo";
bar = "bar";
foobar = foo + bar;
}
{ bar = "bar"; foo = "foo"; foobar = "foobar"; }
```
This is convenient when constructing a value to pass to a function for example,
but an equivalent effect can be achieved with the `let` binding syntax:
```nix
nix-repl> let self = {
foo = "foo";
bar = "bar";
foobar = self.foo + self.bar;
}; in self
{ bar = "bar"; foo = "foo"; foobar = "foobar"; }
```
But in general you can get more reuse out of `let` bindings by refactoring them to a function.
```nix
nix-repl> f = self: {
foo = "foo";
bar = "bar";
foobar = self.foo + self.bar;
}
```
This is where `fix` comes in, it contains the syntactic recursion that's not in `f` anymore.
```nix
nix-repl> fix = f:
let self = f self; in self;
```
By applying `fix` we get the final result.
```nix
nix-repl> fix f
{ bar = "bar"; foo = "foo"; foobar = "foobar"; }
```
Such a refactored `f` using `fix` is not useful by itself.
See [`extends`](#function-library-lib.fixedPoints.extends) for an example use case.
There `self` is also often called `final`.
Type: fix :: (a -> a) -> a
Example:
fix (self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; })
=> { bar = "bar"; foo = "foo"; foobar = "foobar"; }
fix (self: [ 1 2 (elemAt self 0 + elemAt self 1) ])
=> [ 1 2 3 ]
*/
fix = f: let x = f x; in x;
/*
A variant of `fix` that records the original recursive attribute set in the
result, in an attribute named `__unfix__`.
This is useful in combination with the `extends` function to
implement deep overriding.
*/
fix' = f: let x = f x // { __unfix__ = f; }; in x;
/*
Return the fixpoint that `f` converges to when called iteratively, starting
with the input `x`.
```
nix-repl> converge (x: x / 2) 16
0
```
Type: (a -> a) -> a -> a
*/
converge = f: x:
let
x' = f x;
in
if x' == x
then x
else converge f x';
/*
Extend a function using an overlay.
Overlays allow modifying and extending fixed-point functions, specifically ones returning attribute sets.
A fixed-point function is a function which is intended to be evaluated by passing the result of itself as the argument.
This is possible due to Nix's lazy evaluation.
A fixed-point function returning an attribute set has the form
```nix
final: { # attributes }
```
where `final` refers to the lazily evaluated attribute set returned by the fixed-point function.
An overlay to such a fixed-point function has the form
```nix
final: prev: { # attributes }
```
where `prev` refers to the result of the original function to `final`, and `final` is the result of the composition of the overlay and the original function.
Applying an overlay is done with `extends`:
```nix
let
f = final: { # attributes };
overlay = final: prev: { # attributes };
in extends overlay f;
```
To get the value of `final`, use `lib.fix`:
```nix
let
f = final: { # attributes };
overlay = final: prev: { # attributes };
g = extends overlay f;
in fix g
```
:::{.note}
The argument to the given fixed-point function after applying an overlay will *not* refer to its own return value, but rather to the value after evaluating the overlay function.
The given fixed-point function is called with a separate argument than if it was evaluated with `lib.fix`.
:::
:::{.example}
# Extend a fixed-point function with an overlay
Define a fixed-point function `f` that expects its own output as the argument `final`:
```nix-repl
f = final: {
# Constant value a
a = 1;
# b depends on the final value of a, available as final.a
b = final.a + 2;
}
```
Evaluate this using [`lib.fix`](#function-library-lib.fixedPoints.fix) to get the final result:
```nix-repl
fix f
=> { a = 1; b = 3; }
```
An overlay represents a modification or extension of such a fixed-point function.
Here's an example of an overlay:
```nix-repl
overlay = final: prev: {
# Modify the previous value of a, available as prev.a
a = prev.a + 10;
# Extend the attribute set with c, letting it depend on the final values of a and b
c = final.a + final.b;
}
```
Use `extends overlay f` to apply the overlay to the fixed-point function `f`.
This produces a new fixed-point function `g` with the combined behavior of `f` and `overlay`:
```nix-repl
g = extends overlay f
```
The result is a function, so we can't print it directly, but it's the same as:
```nix-repl
g' = final: {
# The constant from f, but changed with the overlay
a = 1 + 10;
# Unchanged from f
b = final.a + 2;
# Extended in the overlay
c = final.a + final.b;
}
```
Evaluate this using [`lib.fix`](#function-library-lib.fixedPoints.fix) again to get the final result:
```nix-repl
fix g
=> { a = 11; b = 13; c = 24; }
```
:::
Type:
extends :: (Attrs -> Attrs -> Attrs) # The overlay to apply to the fixed-point function
-> (Attrs -> Attrs) # A fixed-point function
-> (Attrs -> Attrs) # The resulting fixed-point function
Example:
f = final: { a = 1; b = final.a + 2; }
fix f
=> { a = 1; b = 3; }
fix (extends (final: prev: { a = prev.a + 10; }) f)
=> { a = 11; b = 13; }
fix (extends (final: prev: { b = final.a + 5; }) f)
=> { a = 1; b = 6; }
fix (extends (final: prev: { c = final.a + final.b; }) f)
=> { a = 1; b = 3; c = 4; }
*/
extends =
# The overlay to apply to the fixed-point function
overlay:
# The fixed-point function
f:
# Wrap with parenthesis to prevent nixdoc from rendering the `final` argument in the documentation
# The result should be thought of as a function, the argument of that function is not an argument to `extends` itself
(
final:
let
prev = f final;
in
prev // overlay final prev
);
/*
Compose two extending functions of the type expected by 'extends'
into one where changes made in the first are available in the
'super' of the second
*/
composeExtensions =
f: g: final: prev:
let fApplied = f final prev;
prev' = prev // fApplied;
in fApplied // g final prev';
/*
Compose several extending functions of the type expected by 'extends' into
one where changes made in preceding functions are made available to
subsequent ones.
```
composeManyExtensions : [packageSet -> packageSet -> packageSet] -> packageSet -> packageSet -> packageSet
^final ^prev ^overrides ^final ^prev ^overrides
```
*/
composeManyExtensions =
lib.foldr (x: y: composeExtensions x y) (final: prev: {});
/*
Create an overridable, recursive attribute set. For example:
```
nix-repl> obj = makeExtensible (self: { })
nix-repl> obj
{ __unfix__ = «lambda»; extend = «lambda»; }
nix-repl> obj = obj.extend (self: super: { foo = "foo"; })
nix-repl> obj
{ __unfix__ = «lambda»; extend = «lambda»; foo = "foo"; }
nix-repl> obj = obj.extend (self: super: { foo = super.foo + " + "; bar = "bar"; foobar = self.foo + self.bar; })
nix-repl> obj
{ __unfix__ = «lambda»; bar = "bar"; extend = «lambda»; foo = "foo + "; foobar = "foo + bar"; }
```
*/
makeExtensible = makeExtensibleWithCustomName "extend";
/*
Same as `makeExtensible` but the name of the extending attribute is
customized.
*/
makeExtensibleWithCustomName = extenderName: rattrs:
fix' (self: (rattrs self) // {
${extenderName} = f: makeExtensibleWithCustomName extenderName (extends f rattrs);
});
}

File diff suppressed because it is too large Load diff

View file

@ -1,2 +0,0 @@
# Expose the minimum required version for evaluating Nixpkgs
"2.3"

View file

@ -1,19 +0,0 @@
{ lib }:
let
defaultSourceType = tname: {
shortName = tname;
isSource = false;
};
in lib.mapAttrs (tname: tset: defaultSourceType tname // tset) {
fromSource = {
isSource = true;
};
binaryNativeCode = {};
binaryBytecode = {};
binaryFirmware = {};
}

View file

@ -1,68 +0,0 @@
/* List of NixOS maintainers.
```nix
handle = {
# Required
name = "Your name";
# Optional, but at least one of email, matrix or githubId must be given
email = "address@example.org";
matrix = "@user:example.org";
github = "GithubUsername";
githubId = your-github-id;
keys = [{
fingerprint = "AAAA BBBB CCCC DDDD EEEE FFFF 0000 1111 2222 3333";
}];
};
```
where
- `handle` is the handle you are going to use in nixpkgs expressions,
- `name` is a name that people would know and recognize you by,
- `email` is your maintainer email address,
- `matrix` is your Matrix user ID,
- `github` is your GitHub handle (as it appears in the URL of your profile page, `https://github.com/<userhandle>`),
- `githubId` is your GitHub user ID, which can be found at `https://api.github.com/users/<userhandle>`,
- `keys` is a list of your PGP/GPG key fingerprints.
Specifying a GitHub account ensures that you automatically:
- get invited to the @NixOS/nixpkgs-maintainers team ;
- once you are part of the @NixOS org, OfBorg will request you review
pull requests that modify a package for which you are a maintainer.
`handle == github` is strongly preferred whenever `github` is an acceptable attribute name and is short and convenient.
If `github` begins with a numeral, `handle` should be prefixed with an underscore.
```nix
_1example = {
github = "1example";
};
```
Add PGP/GPG keys only if you actually use them to sign commits and/or mail.
To get the required PGP/GPG values for a key run
```shell
gpg --fingerprint <email> | head -n 2
```
!!! Note that PGP/GPG values stored here are for informational purposes only, don't use this file as a source of truth.
More fields may be added in the future, however, in order to comply with GDPR this file should stay as minimal as possible.
When editing this file:
* keep the list alphabetically sorted, check with:
nix-instantiate --eval maintainers/scripts/check-maintainers-sorted.nix
* test the validity of the format with:
nix-build lib/tests/maintainers.nix
See `./scripts/check-maintainer-github-handles.sh` for an example on how to work with this data.
When adding a new maintainer, be aware of the current commit conventions
documented at [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions)
file located in the root of the Nixpkgs repo.
*/
{
}

View file

@ -1,48 +0,0 @@
/* List of maintainer teams.
name = {
# Required
members = [ maintainer1 maintainer2 ];
scope = "Maintain foo packages.";
shortName = "foo";
# Optional
enableFeatureFreezePing = true;
githubTeams = [ "my-subsystem" ];
};
where
- `members` is the list of maintainers belonging to the group,
- `scope` describes the scope of the group.
- `shortName` short human-readable name
- `enableFeatureFreezePing` will ping this team during the Feature Freeze announcements on releases
- There is limited mention capacity in a single post, so this should be reserved for critical components
or larger ecosystems within nixpkgs.
- `githubTeams` will ping specified GitHub teams as well
More fields may be added in the future.
When editing this file:
* keep the list alphabetically sorted
* test the validity of the format with:
nix-build lib/tests/teams.nix
*/
{ lib }:
with lib.maintainers; {
llvm = {
members = [];
scope = "Maintain LLVM package sets and related packages";
shortName = "LLVM";
enableFeatureFreezePing = true;
};
lix = {
members = [];
};
python = {
members = [];
};
rust = {
members = [];
};
}

459
nodes/1_lib/default.nix Normal file
View file

@ -0,0 +1,459 @@
let
# no "external"dependencies
in
let # internal dependencies
foundation = import ./source/detangled/1_foundation.nix;
static = import ./source/detangled/2_static.nix;
fixedPoints = import ./source/detangled/3_fixed-points.nix;
in
let
untangledBase = {
# constants
sourceTypes = static.setup.sourceTypes;
licenses = static.setup.licenses;
maintainers = static.setup.maintainers;
teams = static.setup.teams;
# just to be overridable
builtins = builtins;
# top level helpers
loadStatic = foundation.loadStatic;
foldr = foundation.foldr;
# namespaces
fixedPoints = fixedPoints;
};
#
# legacy lib
#
lib = fixedPoints.makeExtensible (
self:
untangledBase // {
trivial = import ./source/trivial.nix { lib = self; };
attrsets = import ./source/attrsets.nix { lib = self; };
lists = import ./source/lists.nix { lib = self; };
strings = import ./source/strings.nix { lib = self; };
stringsWithDeps = import ./source/strings-with-deps.nix { lib = self; };
customisation = import ./source/customisation.nix { lib = self; };
derivations = import ./source/derivations.nix { lib = self; };
meta = import ./source/meta.nix { lib = self; };
versions = import ./source/versions.nix { lib = self; };
modules = import ./source/modules.nix { lib = self; };
options = import ./source/options.nix { lib = self; };
types = import ./source/types.nix { lib = self; };
systems = import ./source/systems { lib = self; };
cli = import ./source/cli.nix { lib = self; };
gvariant = import ./source/gvariant.nix { lib = self; };
generators = import ./source/generators.nix { lib = self; };
asserts = import ./source/asserts.nix { lib = self; };
debug = import ./source/debug.nix { lib = self; };
fetchers = import ./source/fetchers.nix { lib = self; };
path = import ./source/path { lib = self; };
filesystem = import ./source/filesystem.nix { lib = self; };
fileset = import ./source/fileset { lib = self; };
sources = import ./source/sources.nix { lib = self; };
kernel = import ./source/kernel.nix { lib = self; };
platforms = self.systems.doubles; # back-compat aliases # TODO: these are not the same as system.platform, we should probably try and unify them
# builtin aliases
add = builtins.add;
addErrorContext = builtins.addErrorContext;
attrNames = builtins.attrNames;
concatLists = builtins.concatLists;
deepSeq = builtins.deepSeq;
elem = builtins.elem;
elemAt = builtins.elemAt;
filter = builtins.filter;
genericClosure = builtins.genericClosure;
genList = builtins.genList;
getAttr = builtins.getAttr;
hasAttr = builtins.hasAttr;
head = builtins.head;
isAttrs = builtins.isAttrs;
isBool = builtins.isBool;
isInt = builtins.isInt;
isList = builtins.isList;
isPath = builtins.isPath;
isString = builtins.isString;
length = builtins.length;
lessThan = builtins.lessThan;
listToAttrs = builtins.listToAttrs;
pathExists = builtins.pathExists;
readFile = builtins.readFile;
replaceStrings = builtins.replaceStrings;
seq = builtins.seq;
stringLength = builtins.stringLength;
sub = builtins.sub;
substring = builtins.substring;
tail = builtins.tail;
trace = builtins.trace;
# trivial to top level
id = self.trivial.id;
const = self.trivial.const;
pipe = self.trivial.pipe;
concat = self.trivial.concat;
or = self.trivial.or;
and = self.trivial.and;
xor = self.trivial.xor;
bitAnd = self.trivial.bitAnd;
bitOr = self.trivial.bitOr;
bitXor = self.trivial.bitXor;
bitNot = self.trivial.bitNot;
boolToString = self.trivial.boolToString;
mergeAttrs = self.trivial.mergeAttrs;
flip = self.trivial.flip;
mapNullable = self.trivial.mapNullable;
inNixShell = self.trivial.inNixShell;
isFloat = self.trivial.isFloat;
min = self.trivial.min;
max = self.trivial.max;
importJSON = self.trivial.importJSON;
importTOML = self.trivial.importTOML;
warn = self.trivial.warn;
warnIf = self.trivial.warnIf;
warnIfNot = self.trivial.warnIfNot;
throwIf = self.trivial.throwIf;
throwIfNot = self.trivial.throwIfNot;
checkListOfEnum = self.trivial.checkListOfEnum;
info = self.trivial.info;
showWarnings = self.trivial.showWarnings;
nixpkgsVersion = self.trivial.nixpkgsVersion;
version = self.trivial.version;
isInOldestRelease = self.trivial.isInOldestRelease;
mod = self.trivial.mod;
compare = self.trivial.compare;
splitByAndCompare = self.trivial.splitByAndCompare;
functionArgs = self.trivial.functionArgs;
setFunctionArgs = self.trivial.setFunctionArgs;
isFunction = self.trivial.isFunction;
toFunction = self.trivial.toFunction;
mirrorFunctionArgs = self.trivial.mirrorFunctionArgs;
toHexString = self.trivial.toHexString;
toBaseDigits = self.trivial.toBaseDigits;
inPureEvalMode = self.trivial.inPureEvalMode;
# fixed points to top level
fix = self.fixedPoints.fix;
fix' = self.fixedPoints.fix';
converge = self.fixedPoints.converge;
extends = self.fixedPoints.extends;
composeExtensions = self.fixedPoints.composeExtensions;
composeManyExtensions = self.fixedPoints.composeManyExtensions;
makeExtensible = self.fixedPoints.makeExtensible;
makeExtensibleWithCustomName = self.fixedPoints.makeExtensibleWithCustomName;
# attrsets to top level
attrByPath = self.attrsets.attrByPath;
hasAttrByPath = self.attrsets.hasAttrByPath;
setAttrByPath = self.attrsets.setAttrByPath;
getAttrFromPath = self.attrsets.getAttrFromPath;
attrVals = self.attrsets.attrVals;
attrValues = self.attrsets.attrValues;
getAttrs = self.attrsets.getAttrs;
catAttrs = self.attrsets.catAttrs;
filterAttrs = self.attrsets.filterAttrs;
filterAttrsRecursive = self.attrsets.filterAttrsRecursive;
foldlAttrs = self.attrsets.foldlAttrs;
foldAttrs = self.attrsets.foldAttrs;
collect = self.attrsets.collect;
nameValuePair = self.attrsets.nameValuePair;
mapAttrs = self.attrsets.mapAttrs;
mapAttrs' = self.attrsets.mapAttrs';
mapAttrsToList = self.attrsets.mapAttrsToList;
attrsToList = self.attrsets.attrsToList;
concatMapAttrs = self.attrsets.concatMapAttrs;
mapAttrsRecursive = self.attrsets.mapAttrsRecursive;
mapAttrsRecursiveCond = self.attrsets.mapAttrsRecursiveCond;
genAttrs = self.attrsets.genAttrs;
isDerivation = self.attrsets.isDerivation;
toDerivation = self.attrsets.toDerivation;
optionalAttrs = self.attrsets.optionalAttrs;
zipAttrsWithNames = self.attrsets.zipAttrsWithNames;
zipAttrsWith = self.attrsets.zipAttrsWith;
zipAttrs = self.attrsets.zipAttrs;
recursiveUpdateUntil = self.attrsets.recursiveUpdateUntil;
recursiveUpdate = self.attrsets.recursiveUpdate;
matchAttrs = self.attrsets.matchAttrs;
mergeAttrsList = self.attrsets.mergeAttrsList;
overrideExisting = self.attrsets.overrideExisting;
showAttrPath = self.attrsets.showAttrPath;
getOutput = self.attrsets.getOutput;
getBin = self.attrsets.getBin;
getLib = self.attrsets.getLib;
getDev = self.attrsets.getDev;
getMan = self.attrsets.getMan;
chooseDevOutputs = self.attrsets.chooseDevOutputs;
zipWithNames = self.attrsets.zipWithNames;
zip = self.attrsets.zip;
recurseIntoAttrs = self.attrsets.recurseIntoAttrs;
dontRecurseIntoAttrs = self.attrsets.dontRecurseIntoAttrs;
cartesianProduct = self.attrsets.cartesianProduct;
cartesianProductOfSets = self.attrsets.cartesianProductOfSets;
mapCartesianProduct = self.attrsets.mapCartesianProduct;
updateManyAttrsByPath = self.attrsets.updateManyAttrsByPath;
# lists to top level
singleton = self.lists.singleton;
forEach = self.lists.forEach;
foldr = self.lists.foldr;
fold = self.lists.fold;
foldl = self.lists.foldl;
foldl' = self.lists.foldl';
imap0 = self.lists.imap0;
imap1 = self.lists.imap1;
ifilter0 = self.lists.ifilter0;
concatMap = self.lists.concatMap;
flatten = self.lists.flatten;
remove = self.lists.remove;
findSingle = self.lists.findSingle;
findFirst = self.lists.findFirst;
any = self.lists.any;
all = self.lists.all;
count = self.lists.count;
optional = self.lists.optional;
optionals = self.lists.optionals;
toList = self.lists.toList;
range = self.lists.range;
replicate = self.lists.replicate;
partition = self.lists.partition;
zipListsWith = self.lists.zipListsWith;
zipLists = self.lists.zipLists;
reverseList = self.lists.reverseList;
listDfs = self.lists.listDfs;
toposort = self.lists.toposort;
sort = self.lists.sort;
sortOn = self.lists.sortOn;
naturalSort = self.lists.naturalSort;
compareLists = self.lists.compareLists;
take = self.lists.take;
drop = self.lists.drop;
sublist = self.lists.sublist;
last = self.lists.last;
init = self.lists.init;
crossLists = self.lists.crossLists;
unique = self.lists.unique;
allUnique = self.lists.allUnique;
intersectLists = self.lists.intersectLists;
subtractLists = self.lists.subtractLists;
mutuallyExclusive = self.lists.mutuallyExclusive;
groupBy = self.lists.groupBy;
groupBy' = self.lists.groupBy';
# strings to top level
concatStrings = self.strings.concatStrings;
concatMapStrings = self.strings.concatMapStrings;
concatImapStrings = self.strings.concatImapStrings;
intersperse = self.strings.intersperse;
concatStringsSep = self.strings.concatStringsSep;
concatMapStringsSep = self.strings.concatMapStringsSep;
concatImapStringsSep = self.strings.concatImapStringsSep;
concatLines = self.strings.concatLines;
makeSearchPath = self.strings.makeSearchPath;
makeSearchPathOutput = self.strings.makeSearchPathOutput;
makeLibraryPath = self.strings.makeLibraryPath;
makeIncludePath = self.strings.makeIncludePath;
makeBinPath = self.strings.makeBinPath;
optionalString = self.strings.optionalString;
hasInfix = self.strings.hasInfix;
hasPrefix = self.strings.hasPrefix;
hasSuffix = self.strings.hasSuffix;
stringToCharacters = self.strings.stringToCharacters;
stringAsChars = self.strings.stringAsChars;
escape = self.strings.escape;
escapeShellArg = self.strings.escapeShellArg;
escapeShellArgs = self.strings.escapeShellArgs;
isStorePath = self.strings.isStorePath;
isStringLike = self.strings.isStringLike;
isValidPosixName = self.strings.isValidPosixName;
toShellVar = self.strings.toShellVar;
toShellVars = self.strings.toShellVars;
escapeRegex = self.strings.escapeRegex;
escapeURL = self.strings.escapeURL;
escapeXML = self.strings.escapeXML;
replaceChars = self.strings.replaceChars;
lowerChars = self.strings.lowerChars;
upperChars = self.strings.upperChars;
toLower = self.strings.toLower;
toUpper = self.strings.toUpper;
addContextFrom = self.strings.addContextFrom;
splitString = self.strings.splitString;
removePrefix = self.strings.removePrefix;
removeSuffix = self.strings.removeSuffix;
versionOlder = self.strings.versionOlder;
versionAtLeast = self.strings.versionAtLeast;
getName = self.strings.getName;
getVersion = self.strings.getVersion;
cmakeOptionType = self.strings.cmakeOptionType;
cmakeBool = self.strings.cmakeBool;
cmakeFeature = self.strings.cmakeFeature;
mesonOption = self.strings.mesonOption;
mesonBool = self.strings.mesonBool;
mesonEnable = self.strings.mesonEnable;
nameFromURL = self.strings.nameFromURL;
enableFeature = self.strings.enableFeature;
enableFeatureAs = self.strings.enableFeatureAs;
withFeature = self.strings.withFeature;
withFeatureAs = self.strings.withFeatureAs;
fixedWidthString = self.strings.fixedWidthString;
fixedWidthNumber = self.strings.fixedWidthNumber;
toInt = self.strings.toInt;
toIntBase10 = self.strings.toIntBase10;
readPathsFromFile = self.strings.readPathsFromFile;
fileContents = self.strings.fileContents;
# stringsWithDeps to top level
textClosureList = self.stringsWithDeps.textClosureList;
textClosureMap = self.stringsWithDeps.textClosureMap;
noDepEntry = self.stringsWithDeps.noDepEntry;
fullDepEntry = self.stringsWithDeps.fullDepEntry;
packEntry = self.stringsWithDeps.packEntry;
stringAfter = self.stringsWithDeps.stringAfter;
# customisation to top level
overrideDerivation = self.customisation.overrideDerivation;
makeOverridable = self.customisation.makeOverridable;
callPackageWith = self.customisation.callPackageWith;
callPackagesWith = self.customisation.callPackagesWith;
extendDerivation = self.customisation.extendDerivation;
hydraJob = self.customisation.hydraJob;
makeScope = self.customisation.makeScope;
makeScopeWithSplicing = self.customisation.makeScopeWithSplicing;
makeScopeWithSplicing' = self.customisation.makeScopeWithSplicing';
# derivations to top level
lazyDerivation = self.derivations.lazyDerivation;
optionalDrvAttr = self.derivations.optionalDrvAttr;
# meta to top level
addMetaAttrs = self.meta.addMetaAttrs;
dontDistribute = self.meta.dontDistribute;
setName = self.meta.setName;
updateName = self.meta.updateName;
appendToName = self.meta.appendToName;
mapDerivationAttrset = self.meta.mapDerivationAttrset;
setPrio = self.meta.setPrio;
lowPrio = self.meta.lowPrio;
lowPrioSet = self.meta.lowPrioSet;
hiPrio = self.meta.hiPrio;
hiPrioSet = self.meta.hiPrioSet;
getLicenseFromSpdxId = self.meta.getLicenseFromSpdxId;
getExe = self.meta.getExe;
getExe' = self.meta.getExe';
# filesystem to top level
pathType = self.filesystem.pathType;
pathIsDirectory = self.filesystem.pathIsDirectory;
pathIsRegularFile = self.filesystem.pathIsRegularFile;
packagesFromDirectoryRecursive = self.filesystem.packagesFromDirectoryRecursive;
# sources to top level
cleanSourceFilter = self.sources.cleanSourceFilter;
cleanSource = self.sources.cleanSource;
sourceByRegex = self.sources.sourceByRegex;
sourceFilesBySuffices = self.sources.sourceFilesBySuffices;
commitIdFromGitRepo = self.sources.commitIdFromGitRepo;
cleanSourceWith = self.sources.cleanSourceWith;
pathHasContext = self.sources.pathHasContext;
canCleanSource = self.sources.canCleanSource;
pathIsGitRepo = self.sources.pathIsGitRepo;
# modules to top level
evalModules = self.modules.evalModules;
setDefaultModuleLocation = self.modules.setDefaultModuleLocation;
unifyModuleSyntax = self.modules.unifyModuleSyntax;
applyModuleArgsIfFunction = self.modules.applyModuleArgsIfFunction;
mergeModules = self.modules.mergeModules;
mergeModules' = self.modules.mergeModules';
mergeOptionDecls = self.modules.mergeOptionDecls;
mergeDefinitions = self.modules.mergeDefinitions;
pushDownProperties = self.modules.pushDownProperties;
dischargeProperties = self.modules.dischargeProperties;
filterOverrides = self.modules.filterOverrides;
sortProperties = self.modules.sortProperties;
fixupOptionType = self.modules.fixupOptionType;
mkIf = self.modules.mkIf;
mkAssert = self.modules.mkAssert;
mkMerge = self.modules.mkMerge;
mkOverride = self.modules.mkOverride;
mkOptionDefault = self.modules.mkOptionDefault;
mkDefault = self.modules.mkDefault;
mkImageMediaOverride = self.modules.mkImageMediaOverride;
mkForce = self.modules.mkForce;
mkVMOverride = self.modules.mkVMOverride;
mkFixStrictness = self.modules.mkFixStrictness;
mkOrder = self.modules.mkOrder;
mkBefore = self.modules.mkBefore;
mkAfter = self.modules.mkAfter;
mkAliasDefinitions = self.modules.mkAliasDefinitions;
mkAliasAndWrapDefinitions = self.modules.mkAliasAndWrapDefinitions;
fixMergeModules = self.modules.fixMergeModules;
mkRemovedOptionModule = self.modules.mkRemovedOptionModule;
mkRenamedOptionModule = self.modules.mkRenamedOptionModule;
mkRenamedOptionModuleWith = self.modules.mkRenamedOptionModuleWith;
mkMergedOptionModule = self.modules.mkMergedOptionModule;
mkChangedOptionModule = self.modules.mkChangedOptionModule;
mkAliasOptionModule = self.modules.mkAliasOptionModule;
mkDerivedConfig = self.modules.mkDerivedConfig;
doRename = self.modules.doRename;
mkAliasOptionModuleMD = self.modules.mkAliasOptionModuleMD;
# options to top level
isOption = self.options.isOption;
mkEnableOption = self.options.mkEnableOption;
mkSinkUndeclaredOptions = self.options.mkSinkUndeclaredOptions;
mergeDefaultOption = self.options.mergeDefaultOption;
mergeOneOption = self.options.mergeOneOption;
mergeEqualOption = self.options.mergeEqualOption;
mergeUniqueOption = self.options.mergeUniqueOption;
getValues = self.options.getValues;
getFiles = self.options.getFiles;
optionAttrSetToDocList = self.options.optionAttrSetToDocList;
optionAttrSetToDocList' = self.options.optionAttrSetToDocList';
scrubOptionValue = self.options.scrubOptionValue;
literalExpression = self.options.literalExpression;
literalExample = self.options.literalExample;
showOption = self.options.showOption;
showOptionWithDefLocs = self.options.showOptionWithDefLocs;
showFiles = self.options.showFiles;
unknownModule = self.options.unknownModule;
mkOption = self.options.mkOption;
mkPackageOption = self.options.mkPackageOption;
mkPackageOptionMD = self.options.mkPackageOptionMD;
mdDoc = self.options.mdDoc;
literalMD = self.options.literalMD;
# types to top level
isType = self.types.isType;
setType = self.types.setType;
defaultTypeMerge = self.types.defaultTypeMerge;
defaultFunctor = self.types.defaultFunctor;
isOptionType = self.types.isOptionType;
mkOptionType = self.types.mkOptionType;
# asserts to top level
assertMsg = self.asserts.assertMsg;
assertOneOf = self.asserts.assertOneOf;
# debug to top level
traceIf = self.debug.traceIf;
traceVal = self.debug.traceVal;
traceValFn = self.debug.traceValFn;
traceSeq = self.debug.traceSeq;
traceSeqN = self.debug.traceSeqN;
traceValSeq = self.debug.traceValSeq;
traceValSeqFn = self.debug.traceValSeqFn;
traceValSeqN = self.debug.traceValSeqN;
traceValSeqNFn = self.debug.traceValSeqNFn;
traceFnSeqN = self.debug.traceFnSeqN;
runTests = self.debug.runTests;
testAllTrue = self.debug.testAllTrue;
# versions to top level
splitVersion = self.versions.splitVersion;
}
);
in lib

19
nodes/1_lib/scripts/test Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# this just runs tests/check-eval.nix
#
result="$(
echo 'import ./nodes/1_lib/source/tests/check-eval.nix' | nix repl --show-trace 2>&1 | grep -v 'Inappropriate ioctl for device'
)"
expected='Welcome to Nix 2.18.1. Type :? for help.
null'
if [ "$(echo "$result")" = "$expected" ]
then
echo test passed
else
echo "test failed"
echo "$result"
fi

View file

@ -19,7 +19,6 @@ This file evaluates to an attribute set containing two separate kinds of attribu
Example: `lib.take` is an alias for `lib.lists.take`.
Most files in this directory are definitions of sub-libraries, but there are a few others:
- [`minver.nix`](minver.nix): A string of the minimum version of Nix that is required to evaluate Nixpkgs.
- [`tests`](tests): Tests, see [Running tests](#running-tests)
- [`release.nix`](tests/release.nix): A derivation aggregating all tests
- [`misc.nix`](tests/misc.nix): Evaluation unit tests for most sub-libraries