summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2019-09-11lib: fix typo in 'zipAttrsWith' documentationPeter Simons
2019-09-0920.03 is MarkhorSamuel Leathers
* Markhor is a spiral horned animal that is on the endangered species list * https://en.wikipedia.org/wiki/Markhor
2019-09-06Merge master into staging-nextFrederik Rietdijk
2019-09-06Merge pull request #67996 from roberth/cleanSourceWith-nameSilvan Mosberger
lib.cleanSourceWith: Allow name to be set, optional filter, doc
2019-09-06Fix typo in lists.nixRobert Hensing
2019-09-03lib.cleanSourceWith: Allow name to be set, optional filter, docRobert Hensing
This change is API-compatible and hash-compatible with the previous version. At first I considered to write a rename function too, but adding it name to cleanSourceWith was a no-brainer for ease of use. It turns out that a rename function isn't any more useful than cleanSourceWith. To avoid having to write the identity predicate when renaming, the filter is now optional. builtins.path is supported since Nix 2.0 which is required by nixpkgs
2019-09-02Merge branch 'master' into stagingVladimír Čunát
2019-09-02Fix typo in customisation.nixGabriel Féron
2019-09-02Merge remote-tracking branch 'upstream/master' into js-unknown-ghcjsJohn Ericson
2019-09-02lib: Further clean up systems listJohn Ericson
2019-09-02Merge lib sort into feature/js-unknown-ghcjsJohn Ericson
2019-09-02lib: Sort platform predicatesJohn Ericson
2019-09-02Merge remote-tracking branch 'upstream/master' into feature/js-unknown-ghcjsJohn Ericson
2019-09-02Add support for `js-unknown-ghcjs`Moritz Angermann
This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple.
2019-08-31lib/types: Make usage of types.string emit a warningSilvan Mosberger
2019-08-31Merge staging-next into stagingFrederik Rietdijk
2019-08-28treewide: remove redundant recvolth
2019-08-28Merge staging-next into stagingFrederik Rietdijk
2019-08-27Merge pull request #66407 from Infinisil/fix-option-renameSilvan Mosberger
lib/modules: Use options `apply` function even if no values are defined
2019-08-26treewide: remove redundant quotesvolth
2019-08-26lib/options: fix path in commentJan Tojnar
2019-08-18Merge branch 'master' into flip-map-foreachdanbst
2019-08-13Merge pull request #65728 from Infinisil/types-eithersAaron Andersen
lib/types: Add oneOf, extension of either to a list of types
2019-08-10lib/modules: Use options `apply` function even if no values are definedSilvan Mosberger
This allows `apply` functions to return a valid value if they completely ignore their argument, which is the case for the option renaming functions like `mkAliasOptionModule`. Therefore this solves issue #63693
2019-08-06lib/types: Add oneOf, extension of either to a list of typesSilvan Mosberger
2019-08-05and one more placedanbst
2019-08-05Merge branch 'master' into flip-map-foreachDanylo Hlynskyi
2019-08-05rename foreach -> forEachdanbst
2019-07-29Merge pull request #65380 from danbst/int-merge-one-optionSilvan Mosberger
lib/types: change merge strategy for `str`, `int`, `float`, `path` and `enum`
2019-07-25Add RISC-V embedded crossSystemsJay Kruer
2019-07-25lib/types: change merge strategy for `str`, `int`, `float` and `enum`danbst
Change to `mergeEqualOption`.
2019-07-19lib: allow sourceByRegex to be composed after cleanSourceWithBas van Dijk
`sourceByRegex src regexes` should include a source file if one of the regular expressions `regexes` matches the path of that file relative to `src`. However to compute this relative path `sourceByRegex` uses: ``` relPath = lib.removePrefix (toString src + "/") (toString path); ``` Note that `toString path` evaluates to an absolute file somewhere under `src` and not under `/nix/store`. The problem is that this doesn't work if `src` is a `cleanSourceWith` invocation as well because `toString src` will then evaluate to `src.outPath` which will evaluate to `builtins.filterSource ...` which evaluates to a path in `/nix/store` which is not a prefix of `path`. The solution is to replace `src` with `origSrc` where ``` origSrc = if isFiltered then src.origSrc else src; isFiltered = src ? _isLibCleanSourceWith; ``` Test this by executing the following from the nixpkgs repo: ``` (cat << 'EOI' let pkgs = import ./. {}; in pkgs.runCommand "test-sourceByRegex" { test_sourceByRegex = let src1 = pkgs.lib.sourceByRegex ./. [ "^test-sourceByRegex.nix$" ]; src2 = pkgs.lib.sourceByRegex src1 [ "^test-sourceByRegex.nix$" ]; in src2 + "/test-sourceByRegex.nix"; } '' cp $test_sourceByRegex $out '' EOI ) > test-sourceByRegex.nix nix-build test-sourceByRegex.nix ```
2019-07-14lib: introduce `foreach` = flip mapdanbst
The main purpose is to bring attention to `flip map`, which improves code readablity. It is useful when ad-hoc anonymous function grows two or more lines in `map` application: ``` map (lcfg: let port = lcfg.port; portStr = if port != defaultPort then ":${toString port}" else ""; scheme = if cfg.enableSSL then "https" else "http"; in "${scheme}://cfg.hostName${portStr}" ) (getListen cfg); ``` Compare this to `foreach`-style: ``` foreach (getListen cfg) (lcfg: let port = lcfg.port; portStr = if port != defaultPort then ":${toString port}" else ""; scheme = if cfg.enableSSL then "https" else "http"; in "${scheme}://cfg.hostName${portStr}" ); ``` This is similar to Haskell's `for` (http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Traversable.html#v:for)
2019-07-11make-tarball / lib-tests: reduce duplicationFrederik Rietdijk
The misc.nix and systems.nix tests were invoked at three different places. Let's not that.
2019-07-10Revert "Revert "systems/doubles.nix: add Apple doubles""Matthew Bauer
This reverts commit ce2f74df2cade57e74c235292c8b074281903e71. Doubles are treated as -darwin here, to provide some consistency. There is some ambiguity between “x86_64-darwin” and “i686-darwin” which could refer to binaries linked between iOS simulator or real macOS binaries. useiOSPrebuilt can be used to determine which to use, however.
2019-07-10Revert "systems/doubles.nix: add Apple doubles"Frederik Rietdijk
The lib tests need to be fixed as well. This unbreaks the tarball job. This reverts commit 00ba557856d6217121e50ea69c251e9458d9dc08.
2019-07-08systems/doubles.nix: add Apple doublesMatthew Bauer
These are used in cross-compilation to iOS devices and simulators. Fallout from #60349.
2019-06-16treewide: remove unused variables (#63177)volth
* treewide: remove unused variables * making ofborg happy
2019-06-13Merge pull request #62712 from danbst/module-conflict-namingDanylo Hlynskyi
NixOS module system: improve one of error messages
2019-06-12licenses: refer to libpng2 using spdxOrivej Desh
https://spdx.org/licenses/libpng-2.0.html
2019-06-06licenses: fix LGPL 2.1 full nameOrivej Desh
2019-06-05module system: prettify a bit error when unique option defined twicedanbst
The error can be reproduced like: ``` $ nix-instantiate ./nixos -A system --arg configuration ' { fileSystems."/".device = "nodev"; boot.loader.grub.devices = [ "nodev" ]; containers.t.config.imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ]; }' ``` Previously error was: ``` error: The unique option `containers.t.networking.hostName' is defined multiple times, in `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/virtualisation/amazon-image.nix' and `module at /home/danbst/dev/nixpkgs/nixos/modules/virtualisation/containers.nix:470'. (use '--show-trace' to show detailed location information) ``` Now it is: ``` error: The unique option `containers.t.networking.hostName' is defined multiple times, in: - /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/virtualisation/amazon-image.nix - module at /home/danbst/dev/nixpkgs/nixos/modules/virtualisation/containers.nix:470. (use '--show-trace' to show detailed location information) ``` Related: https://github.com/NixOS/nixpkgs/issues/15747
2019-06-04systems: fix lib-testsMatthew Bauer
These were broken by the added system doubles. This just adds those to the lib-tests.
2019-06-04systems: fixup from last commitMatthew Bauer
it’s powerpc-none not ppc-none
2019-06-04systems: add missing doublesMatthew Bauer
in https://github.com/NixOS/nixpkgs/pull/60349, the attr handling was removed. This means we rely on these double values for determing what we are compatible with. This adds some of the missing doubles to this list. https://hydra.nixos.org/eval/1523389#tabs-removed
2019-06-04Merge pull request #60349 from matthewbauer/fix-60345Matthew Bauer
check-meta: use system tuple in platforms
2019-06-04systems: allow passing in string for cross/localSystemMatthew Bauer
This makes things a little bit more convenient. Just pass in like: $ nix-build ’<nixpkgs>’ -A hello --argstr localSystem x86_64-linux --argstr crossSystem aarch64-linux
2019-06-04systems: remove forMetaMatthew Bauer
This is unused now.
2019-05-18Merge pull request #60406 from JohnAZoidberg/remove-isnullRobin Gloster
treewide: Remove usage of isNull
2019-05-05Adds pkgsCross.gnu32 and pkgsCross.gnu64 platformsLionello Lunesu