Commit Graph

78 Commits

Author SHA1 Message Date
Martin Weinelt
93f4195fe0
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
- pkgs/applications/graphics/seamly2d/default.nix
2024-07-26 18:05:04 +02:00
Sigmanificient
6dd44107ac treewide: remove unused lib (and other) arguments 2024-07-26 11:18:09 +02:00
github-actions[bot]
401d4660b3
Merge staging-next into staging 2024-07-18 18:01:57 +00:00
Ivan Trubach
c2e1be3be0 doc: fixup doc/build-helpers references 2024-07-18 14:15:53 +03:00
Silvan Mosberger
f814e5cb8f Revert "trivial: make pkgs.writeText always fixed output"
This reverts commit 9f4b1064c6.

It caused problems: https://github.com/NixOS/nixpkgs/pull/318872#issuecomment-2196168990

FODs are not allowed to have references, but writeText is often used to create a file with references.

Leading to this error:

error: fixed output derivation 'packages.json' is not allowed to refer to other store paths.
2024-06-28 09:15:13 +02:00
Silvan Mosberger
5838e6883f
Merge pull request #318872 from hraban/trivial/fod-write-text
trivial: make pkgs.writeText always fixed output
2024-06-25 18:38:01 +02:00
Robert Hensing
cb5a0285b0
Merge pull request #292759 from ShamrockLee/test-references-darwin
tests.references: use `runNixOSTest` instead of `nixosTest`
2024-06-20 15:50:22 +02:00
Hraban Luyat
9f4b1064c6 trivial: make pkgs.writeText always fixed output
This can prevent a cascade of rebuilds across nixpkgs versions because these
small files tend to be found at the leaves of dependency trees.
2024-06-14 15:44:30 -04:00
Hraban Luyat
5aa55272c2 trivial: input type assertions for writeText 2024-06-14 15:44:17 -04:00
Hraban Luyat
d544b1259a trivial: fix pkgs.writeText test to pass string
Passing a non-string value and relying on pkgs.writeText to implicitly call
builtins.toString is incorrect.
2024-06-14 15:40:54 -04:00
Peder Bergebakken Sundt
088cdb337b
Merge pull request #300538 from ShamrockLee/write-shell-application-extra
writeShellApplication: add argument extraShellCheckFlags
2024-04-22 22:45:44 +02:00
Jacek Galowicz
8d3a38e8b1 NixOS Integration tests: Re-enable for macOS 2024-04-12 13:41:27 +02:00
Yueh-Shun Li
751e9b6c7f writeShellApplication: add argument extraShellCheckFlags 2024-04-01 03:50:14 +08:00
Yueh-Shun Li
8a8d07bc15 tests.trivial-builders.references: test writeClosure
Test writeClosure instead of writeReferencesToFile.

Add multiple-path test for writeReferenceClosureToFile.

Rename variables:
- references -> closures (passthru affected)
- REFERENCES -> CLOSURES
2024-03-19 05:30:42 +08:00
Yueh-Shun Li
e9fd4389d2 writeClosure: init, replacing writeReferencesToFile
Replace writeReferencesToFile with writeClosure.

Make writeClosure accept a list of paths instead of a path.

Re-implement with JSON-based exportReferencesGraph interface provided by
__structuredAttrs = true.

Reword the documentation.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Someone Serge <sergei.kozlukov@aalto.fi>
2024-03-19 02:45:50 +08:00
Yueh-Shun Li
abf7172bfa tests.references: migrate from nixosTest to runNixOSTest
- Use testers.runNixOSTest instead of testers.nixosTest as nixosTest
  has become obsolete.

- Prepare for cross-platform testing.
    - Use the testScriptBin passthru'd by the references test package
      inside the guest pkgs.
2024-03-17 04:21:26 +08:00
Robert Hensing
e99021ff75 trivial-builders: Deduplicate docs
I didn't have the opportunity to do all work at once, so I've added
TODOs to bring attention to the situation.
2024-03-11 11:33:14 +01:00
Thomas Lepoix
6aa4ed4487
applyPatches: Fix a bug (#283887) 2024-02-29 01:29:48 +01:00
Rebecca Turner
88ce0b0019
writeShellApplication: Expand test suite 2024-02-01 16:02:34 -08:00
Rebecca Turner
63f7c9b415
writeShellApplication: Document arguments 2024-02-01 16:02:33 -08:00
Rebecca Turner
863786b98b
writeTextFile,writeShellApplication: Allow setting extra arguments 2024-02-01 16:02:33 -08:00
Rebecca Turner
a64766913f
writeShellApplication: Add runtimeEnv argument 2024-02-01 16:02:33 -08:00
Rebecca Turner
ac20bcf449
writeShellApplication: Add bashOptions argument 2024-02-01 16:02:32 -08:00
Valentin Gagarin
eaebe13ebd doc: use markdown backticks for code tokens 2024-01-15 23:03:14 +01:00
Valentin Gagarin
2392daed23
Merge pull request #277534 from mcdonc/doc-trivial-builders-writetext
* doc: improve documentation for trivial text writing functions

Co-authored-by: Brian Merchant <bzm3r@proton.me>
Co-authored-by: Robert Hensing <robert@roberthensing.nl>
Co-authored-by: Alexander Groleau <alex@proof.construction>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-01-15 22:34:40 +01:00
Robert Hensing
559d06bbb2 trivial-builders: Remove redundant docs - link instead 2024-01-15 09:02:45 +01:00
Andrew Marshall
52c27352ce applyPatches: skip creating additional drv when no patches
If there are no `patches` or `postPatch`, then this will just do work to
make something equivalent to `src`. Instead, just return `src` in that
case.
2024-01-12 15:49:24 -05:00
Valentin Gagarin
25c0077a31 doc: add note on which variables are effective
The build log of the following won't output `foo` as one might expect, but the
`$PATH` set by stdenv.

```nix
with import <nixpkgs> {};
runCommand "foo" { PATH = "foo"; } "echo $PATH; touch $out"
```
2024-01-08 12:16:19 +01:00
Valentin Gagarin
7ae1fdc9a7 doc: reformat 2024-01-08 12:16:03 +01:00
Robert Hensing
6ac78f1174
Merge pull request #204462 from ShamrockLee/test-references
tests.trivial-builders.references: refactor and move expressions into trivial-builders/test/references
2023-12-09 14:45:20 +01:00
Yueh-Shun Li
7950a226f6
tests.trivial-builders.references: specify as empty set instead of null on non-Linux
Please Nix CI (OfBorg) with empty set instead of null on non-linux platforms,
where NixOS tests are not supported.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-09 13:08:10 +08:00
Yueh-Shun Li
9fba2b0fd7 tests.trivial-builders.references: add ShamrockLee as a maintainer 2023-12-08 09:28:47 +00:00
Yueh-Shun Li
1f4e8f3fad tests.trivial-buildrs.references: move expression files into trivial-builders/test/references/ 2023-12-08 09:27:48 +00:00
Yueh-Shun Li
79a1e9d729 tests.trivial-builders.references: refactor expression
Define package `testScriptBin` that contains the substituted test script.
* Add an `installCheckPhase` to check the result script with ShellCheck.
* Passthru as `references.testScriptBin` to run the
  (substituted) test script directly (without VM).
* Drop the logic in build script that detects if
  it is run in the Nix sandbox.
* Inline sample application; drop invoke-*.nix.

Format expressions.
* Format with `nixpkgs-fmt`.
* Use multi-line style of set patterns.

Call the samples with `callPackage`.
* Rename `sample` -> `samples`.
* Take individual packages / build helpers directly from the
  set pattern.
* Define `cleanSamples` to filter out overriders such as `<pkg>.override`.
  added by `callPackage`.

Passthru samples and invocation results for easier debugging.
* Passthru samples, references, directReferences
* Provide tests.trivial-builders.writeStringReferencesToFile with such
  samples argument.
2023-12-07 22:28:30 +00:00
Robert Scott
035d1e2cf9 trivial-builders: add onlyBin 2023-12-02 14:47:36 +00:00
Shamrock Lee
1d56e7909d trivial-builders/test/references-test.sh: lint with ShellCheck 2023-11-30 17:16:05 +08:00
Yueh-Shun Li
409f95731e shellcheck-minimal: init
Expose the minimal and stripped shellcheck package used by writeShellApplication.
2023-11-01 06:23:04 +08:00
con-f-use
0f3fa9e6ef writeShellApplication: exclude shell checks 2023-10-15 12:10:50 +02:00
Artturin
8a77757b7e writers.writeCBin: fix binary name when cross-compiling
`$name` contains cross-compilation info `bin/wrapped-argv0-aarch64-unknown-linux-gnu`

name should not be set directly.
2023-09-21 04:13:45 +03:00
figsoda
eee0a82ee0
Merge pull request #251369 from srid/writeShellApplication-meta 2023-09-01 16:53:49 -04:00
Sridhar Ratnakumar
250d324776
trivial-builders: add meta to writeShellApplication 2023-08-25 09:38:21 -04:00
Maximilian Bosch
850af44435
applyPatches: fix adding meta information 2023-08-20 11:51:21 +02:00
Raito Bezarius
ccbd98db50
trivial-builders/applyPatches: carry meta information to the patched source
There is no reason to not carry licenses and other information to any patched source.

This should improve our metadata in those situations.
2023-08-20 11:49:14 +02:00
Charlie Moog
0b4c5d23cd
trivial-builders: add meta.mainProgram to writeShellScriptBin
Derivations built with `writeShellScriptBin`
should always be runnable with `nix run`. At present,
the derivation is missing both `meta.mainProgram`
and `pname`– this means that `nix run` falls back
to inferring the bin path from `name`. This is
unreliable and depends on faulty heuristics.

For context, reference the following snippet from
`nix run --help`:

    If installable evaluates to a derivation, it will try to execute the
    program <out>/bin/<name>, where out is the primary output store path
    of the derivation, and name is the first of the following that exists:

      · The meta.mainProgram attribute of the derivation.
      · The pname attribute of the derivation.
      · The name part of the value of the name attribute of the derivation.
2023-08-11 00:40:37 -05:00
Francesco Gazzetta
b2e987dd16
Merge pull request #240348 from fgaz/write-shell-application/check-platforms
writeShellApplication: use shellcheck only where supported
2023-08-09 12:17:46 +02:00
Francesco Gazzetta
2c5990f03a writeShellApplication: use shellcheck only where supported 2023-08-05 18:31:20 +02:00
K900
8bd0cd850b requireFile: fix error message with SRI hashes 2023-08-04 15:34:30 +03:00
Robert Hensing
0dd3989cef tests.trivial-builders.writeTextFile: Test meta.mainProgram logic 2023-07-26 18:45:54 +02:00
Robert Hensing
a6aabd9d28 tests.trivial-builders.references: Only run where supported 2023-07-26 18:22:34 +02:00
Robert Hensing
89bdfd4687 trivial-builders: Move test list closer 2023-07-26 18:22:33 +02:00