about summary refs log tree commit diff
path: root/pkgs/build-support/trivial-builders
AgeCommit message (Collapse)AuthorFilesLines
2022-03-10build-support/writeTextFile: add test for weird file namesK9001-0/+34
2022-01-26nixos/nix-daemon: use structural settingspolykernel1-1/+1
The `nix.*` options, apart from options for setting up the daemon itself, currently provide a lot of setting mappings for the Nix daemon configuration. The scope of the mapping yields convience, but the line where an option is considered essential is blurry. For instance, the `extra-sandbox-paths` mapping is provided without its primary consumer, and the corresponding `sandbox-paths` option is also not mapped. The current system increases the maintenance burden as maintainers have to closely follow upstream changes. In this case, there are two state versions of Nix which have to be maintained collectively, with different options avaliable. This commit aims to following the standard outlined in RFC 42[1] to implement a structural setting pattern. The Nix configuration is encoded at its core as key-value pairs which maps nicely to attribute sets, making it feasible to express in the Nix language itself. Some existing options are kept such as `buildMachines` and `registry` which present a simplified interface to managing the respective settings. The interface is exposed as `nix.settings`. Legacy configurations are mapped to their corresponding options under `nix.settings` for backwards compatibility. Various options settings in other nixos modules and relevant tests have been updated to use structural setting for consistency. The generation and validation of the configration file has been modified to use `writeTextFile` instead of `runCommand` for clarity. Note that validation is now mandatory as strict checking of options has been pushed down to the derivation level due to freeformType consuming unmatched options. Furthermore, validation can not occur when cross-compiling due to current limitations. A new option `publicHostKey` was added to the `buildMachines` submodule corresponding to the base64 encoded public host key settings exposed in the builder syntax. The build machine generation was subsequently rewritten to use `concatStringsSep` for better performance by grouping concatenations. [1] - https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
2022-01-10Merge branch 'staging-next' into stagingJan Tojnar1-0/+12
; Conflicts: ; nixos/doc/manual/from_md/release-notes/rl-2205.section.xml ; nixos/doc/manual/release-notes/rl-2205.section.md ; pkgs/build-support/libredirect/default.nix
2022-01-04tests.concat: added empty casePasquale1-1/+2
2021-12-30concatText: test now worksPasquale1-14/+7
2021-12-27tests.trivial-builders.overriding: update after shellDryRunNaïm Favier1-36/+27
2021-12-02concatText: add testPasquale1-0/+18
2021-11-01test.trivial-builders: Add test cases, fix test runner, renameRobert Hensing4-28/+41
The writeStringReferencesToFile didn't handle non-unique references to the same path correctly.
2021-10-28trivial-builders: Add writeStringReferencesToFiletalyz2-5/+27
Add writeStringReferencesToFile, a builder which extracts a string's references to derivations and paths and writes them to a text file, removing the input string itself from the dependency graph. This is useful when you want to make a derivation depend on the string's references, but not its content (to avoid unnecessary rebuilds, for example).
2021-06-18trivial-builders: refactor writeTextFile to be overridabledeliciouslytyped1-0/+119
This fixes #126344, specifically with the goal of enabling overriding the checkPhase argument. See `design notes` at the end for details. This allows among other things, enabling bash extension for the `checkPhase`. Previously using such bash extensions was prohibited by the `writeShellScript` code because there was no way to enable the extension in the checker. As an example: ```nix (writeShellScript "foo" '' shopt -s extglob echo @(foo|bar) '').overrideAttrs (old: { checkPhase = '' # use subshell to preserve outer environment ( export BASHOPTS shopt -s extglob ${old.checkPhase} ) ''; }) ``` This commit also adds tests for this feature to `pkgs/tests/default.nix`, under `trivial-overriding`. The test code is located at `pkgs/build-support/trivial-builders/test-overriding.nix`. Design notes: ------------- Per discussion with @sternenseemann, the original approach of just wrapping `writeTextFile` in `makeOverridable` had the issue that combined with `callPackage` in the following form, would shadow the `.override` attribute of the `writeTextFile`: ```nix with import <nixpkgs>; callPackage ({writeShellScript}: writeShellScript "foo" "echo foo") ``` A better approach can be seen in this commit, where `checkPhase` is moved from an argument of `writeTextFile`, which is substituted into `buildCommand`, into an `mkDerivation` argument, which is substituted from the environment and `eval`-ed. (see the source) This way we can simple use `.overideAttrs` as usual, and this also makes `checkPhase` a bit more conformant to `mkDerivation` naming, with respect to phases generally being overridable attrs. Co-authored-by: sterni <sternenseemann@systemli.org> Co-authored-by: Naïm Favier <n@monade.li>
2021-06-12tests.trivial: Add emptyFile, emptyDirectory to samplesRobert Hensing1-0/+4
2021-05-19tests.trivial: Add metaRobert Hensing1-0/+7
2021-05-19tests.trivial: Avoid evaluation and ${pkgs.path} depRobert Hensing5-28/+76
> There is an issue in the test added by #123111. > [it] introduces a dependency on the contents of nixpkgs, > making every change evaluate with a different hash.
2021-05-15writeReferencesToFile: docs and testsRobert Hensing1-0/+16
2021-05-15writeDirectReferencesToFile: initRobert Hensing2-0/+61