Commit Graph

5918 Commits

Author SHA1 Message Date
Naïm Favier
4d68c2f0ba
remove dead make-symlinks builder
Introduced in 5808ac7148, never used again
after b06335a835.
2022-11-16 11:20:50 +01:00
Nicolas Benes
c95d7d5a8c treewide: make sparseCheckout a list of strings 2022-11-15 19:46:12 +01:00
Nicolas Benes
f6b07f0e2f fetchgit: make sparseCheckout a list of strings
The `sparseCheckout` argument allows the user to specify directories or
patterns of files, which Git uses to filter files it should check-out.

Git expects a multi-line string on stdin ("newline-delimited list", see
`git-sparse-checkout(1)`), but within nixpkgs it is more consistent to
use a list of strings instead. The list elements are joined to a
multi-line string only before passing it to the builder script.

A deprecation warning is emitted if a (multi-line) string is passed to
`sparseCheckout`, but for the time being it is still accepted.
2022-11-15 19:45:33 +01:00
Bernardo Meurer
43bf542ccd
tests.trivial-builders.linkFarm: init 2022-11-15 11:47:36 -05:00
Bernardo Meurer
6382598677
linkFarm: make last entry win in case of list repeats 2022-11-15 11:45:20 -05:00
Robert Hensing
449ae7573b
Merge pull request #170048 from lovesegfault/link-farm-passthru
linkFarm: add entries to passthru
2022-11-15 17:39:43 +01:00
Bernardo Meurer
a93aed5bab
linkFarm: allow entries to be an attrset 2022-11-15 11:01:52 -05:00
Bernardo Meurer
b54257fb36
linkFarm: add entries to passthru 2022-11-15 10:59:31 -05:00
github-actions[bot]
f3a93620b1
Merge master into staging-next 2022-11-10 12:01:27 +00:00
Shamrock Lee
6386d79326 patchRcPath hooks: use the passthru argument 2022-11-10 09:27:40 +08:00
Shamrock Lee
da31bd5673 patchRcPathBash, patchRcPathCsh, patchRcPathFish, patchRcPathPosix: init
Init patchRcPath hooks, which provides
utilities to patch shell scripts to be sourced by users.

Add test cases and documentation.
2022-11-10 09:23:52 +08:00
github-actions[bot]
020ea91183
Merge master into staging-next 2022-11-10 00:02:27 +00:00
John Ericson
e94d54dd86 build-support/rust/lib: Add toTargetFamily
Taken from https://github.com/kolloch/crate2nix/pull/255/files, it
belongs in Nixpkgs not crate2nix.

I have been using that P.R. for a few months without incident.
2022-11-09 15:52:01 -05:00
github-actions[bot]
d99020653d
Merge master into staging-next 2022-11-09 18:01:11 +00:00
Winter
16722903aa buildNpmPackage: init 2022-11-09 10:35:59 -05:00
Hraban Luyat
24268b64b0 fetchzip: auto generate name from pname-version 2022-11-07 13:40:57 -05:00
Silvan Mosberger
a1cf249394 dockerTools.buildNixShellImage: Chown nix directories
To the user running the docker image. If a Nix binary is available in
the resulting derivation, this then behaves like a single-user Nix
installation, except that already-written /nix/store paths can't be
changed. Most notably it makes Nix work not have to rely on a chroot
store in the image
2022-11-07 19:38:09 +01:00
github-actions[bot]
e51ba60580
Merge master into staging-next 2022-11-07 00:03:30 +00:00
Yarny0
335a9083b0 patchPpdFilesHook: new setup hook for absolute executable paths
PostScript Printer Description (ppd) files
describe printer features and capabilities.
They are usually evaluated by CUPS to convert
print jobs into a format suitable for a printer.
The conversion is often accomplished by commands
or even short shell scripts inside the ppd files.

ppd files are included in many printer driver packages.
Their scripts sometimes refer to other executables;
some of them are more common (like `perl`),
others are more exotic (like `rastertohp`).
If an executable is called with its name alone,
the effects of the ppd file depend on whether
the executable is in the PATH of CUPS,
and on the executable's version.
If an executable is called with an absolut path
(like `/usr/bin/perl`), it won't work at all in NixOS.

The commit at hand adds a setup hook that uses
the `fixupPhase` to substitute certain executable's
invocations in pdd files with absolute paths.
To use it, add the hook to `nativeBuildInputs` and
provide a list of executable names in `ppdFileCommands`.
Each executable must be available in the
package that is being built, or in `buildInputs`.
The setup hook's script then looks for ppd files in
`share/cups/model` and `share/ppds` in each output,
and replaces executable names with their absolute paths.
If ppd files need to be patched in unorthodox locations or
the setup hook needs to be invoked manually for other reasons,
one may leave the list `ppdFileCommands` empty to
avoid automatic processing of ppd files, then call
the shell function `patchPpdFileCommands` directly.
Details are described in the file `patch-ppd-hook.sh`.

Notes on the motivation for this setup hook:

Most packages in nixpkgs that provide
ppd files do not patch those ppd files at all.
This is not fatal when the executables are just called
with their names since the user can add packages
with the executables to `services.printing.drivers`.
E.g. if the user adds `pkgs.perl`, then all ppd
files that invoke `perl` will work as expected.
Nevertheless, to make these ppd files independent of
their execution environment, command invocations should
be substituted with absolut paths into the nix store.
This is similar to patching shebang lines so scripts can be
called independently of having the interpreter in the PATH.

The hook script in this commit is meant to support new packages
`foomatic-db*` which will generate several thousands of
ppd files referencing a plethora of different executables.
During development of these packages, I realized that
it's quite hard to patch ppd files in a robust way.
While binary names like `rastertokpsl` seem to be sufficiently
unique to be patched with `sed`, names like `date` or `gs`
are hard to patch without producing "false positives",
i.e., coincidental occurences of the executable's name that do
*not* refer to the executable and should not be patched at all.
As this problem also affects other packages,
it seems reasonable to put a robust implementation
in its own setup hook so that other
packages can use it without much effort.

Notes on the implementation:

The ppd file format is far from trivial.
The basic structure are key-value pairs;
keys may occur multiple times.
Only a small subset of keys may contain
executable names or shell scripts in their values.
Some values may span multiple lines;
a linebreak might even occur in the middle of a token.
Some executable names also occur in other keys by accident
where they must not be substituted (e.g. `gs` or `date`).

It is necessary to provide the list of command
names that will be patched for two reasons:
ppd files often contain "tokens" that might look
like commands (e.g. "file" or "host") but aren't;
these would erroneously get patched.
Also, looking for everything that might be a command
would slow down the patching process considerably.

The implementation uses `awk` to detect
keys that might contain executable names;
only their values are treated for substitution.
This avoids most cases of "overzealous" substitutions.
Since values may span multiple lines,
`sed` alone (while faster than `awk`) cannot focus
its substitution capabilities on relevant keys.
An elaborate set of regular expressions further helps
to minimize the probability of "false positives".
Several tricks are employed to speed up `awk`.
Notably, relevant files are identified with
`grep` before `awk` is applied to those files only.
Note that the script probably cannot handle fancy command
names (like spaces or backslashes as part of the name).
Also, there are still edge cases that the script would
mistakenly skip, e.g. if a shell script contains a
line break in the middle of an executable's name;
although ppd files permit such constellations,
I have yet to see one.

ppd files may be gzipped.
The setup hook accepts gzipped ppd files:
It decompresses them, substitutes paths, then recompresses them.
However, Nix cannot detect substituted paths as
runtime dependencies in compressed ppd files.
To ensure substituted paths are propagated as
runtime dependencies, the script adds each substituted
path to the variable `propagatedBuildInputs`.
Since this might not be enough for multi-output packages,
those paths are also written directly to
`nix-support/propagated-build-inputs`.
See the comment in `patch-ppd-hook.sh` for details.

Finally, the setup hook comes with a small test that
probes some edge cases with an artificial ppd file.

References:

* https://www.cups.org/doc/spec-ppd.html
  * general ppd file specification
  * lists some keys that may contain
    executable names or shell scripts

* https://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Printing/LSB-Printing/ppdext.html
  * lists some keys that may contain
    executable names or shell scripts

* https://en.wikipedia.org/wiki/PostScript_Printer_Description#CUPS
  * lists the usual locations of ppd files
2022-11-06 16:19:22 +01:00
github-actions[bot]
cfd5f0bddc
Merge staging-next into staging 2022-11-05 00:02:45 +00:00
Artturi
1cdecacb79
Merge pull request #198489 from Artturin/fetchgitlabremoteavvt
fetchFromGitLab: don't passthruAttrs fetchGit specific attrs to fetchUrl
2022-11-04 20:29:38 +02:00
Mateusz Kowalczyk
233205c464
rustBuildCrate: properly handle cargo env pragmas with spaces
There are two problems: first that we end up splitting on spaces in the
loop. Even when that is fixed, we still would split on spaces in the
`export` inside the loop. We need to guard against both.

Fixes #199298

Confirmed that it fixes the case mentioned in the ticket:

```console
[nix-develop]$ $(nix-build -I nixpkgs=/home/shana/programming/nixpkgs Cargo.nix -A rootCrate.build  --no-out-link)/bin/nix-rustc-env-escape-repro
Expecting three words, got: first second third
```

I think this is going to cause a rebuild of every Rust package even if
they were unaffected, not much we can do here.
2022-11-03 14:49:24 +09:00
Yureka
c2eaaae50d cargoSetupHook: pass host config flags 2022-10-30 18:55:47 +01:00
Artturin
19d2bb4863 fetchFromGitLab: don't passthruAttrs fetchGit specific attrs to fetchUrl
if `fetchSubmodules = false` to 'fetchFromGitLab' then theres the
following error

error: anonymous function at /nix/store/9m8drnpifyl5qsx93g6ll2xw6wkps03z-source/pkgs/build-support/fetchurl/default.nix:41:1 called with unexpected argument 'fetchSubmodules'

       at /nix/store/9m8drnpifyl5qsx93g6ll2xw6wkps03z-source/pkgs/build-support/fetchzip/default.nix:36:1:

           35|
           36| fetchurl ((
             | ^
           37|   if (pname != "" && version != "") then
2022-10-29 19:12:07 +03:00
github-actions[bot]
c45b1c2226
Merge staging-next into staging 2022-10-29 00:02:59 +00:00
github-actions[bot]
f349a716a3
Merge master into staging-next 2022-10-29 00:02:26 +00:00
Anderson Torres
f367ac90aa
Merge pull request #197997 from atorres1985-contrib/hummingbird
skawarePackages: reformat
2022-10-28 17:10:53 -03:00
John Ericson
0c09b3d17c
Merge pull request #197937 from danielbarter/cc-wrapper-hook
cc-wrapper: adding a cc-wrapper-hook to the cc-wrapper
2022-10-28 17:30:03 +01:00
AndersonTorres
a76bd55090 skawarePackages: move all of them to development/skaware-packages 2022-10-28 11:30:49 -03:00
Vladimír Čunát
6890557c17
Revert "Merge #191724: cc-wrapper: remove duplicate include flags"
Let's redo this later, with more testing and less bugs.
This reverts commits 4f6e99870b and d700d8e8a2.
2022-10-28 10:28:12 +02:00
Robert Hensing
3cf3fef372 testers: Add missing doc link comments 2022-10-27 14:06:39 +02:00
Robert Hensing
e20a362908 testers.testEqualContents: init 2022-10-27 14:06:38 +02:00
Robert Hensing
44d0f37833 testers.testBuildFailure: init 2022-10-27 14:06:38 +02:00
Daniel Barter
77bd639c4c cc-wrapper: adding a cc-wrapper-hook to the cc-wrapper 2022-10-26 09:33:43 -07:00
github-actions[bot]
81a6c5a54c
Merge staging-next into staging 2022-10-25 18:16:24 +00:00
Sandro Jäckel
0f386859f5
build-dotnet-module: don't end with exit code 1 when update was sucessfull
otherwise scripts might end prematurely
2022-10-25 16:12:22 +02:00
github-actions[bot]
f332a666fb
Merge staging-next into staging 2022-10-25 12:02:09 +00:00
Vincent Laporte
8b11f0a513 ocamlPackages.buildOcaml: remove 2022-10-25 09:40:57 +02:00
github-actions[bot]
683aa50df6
Merge staging-next into staging 2022-10-23 06:08:06 +00:00
Anderson Torres
749231c9a2
Merge pull request #196681 from corngood/fix-nuget-to-nix
nuget-to-nix: fix warning when package is installed from sdk
2022-10-23 00:58:56 -03:00
github-actions[bot]
d86d8a1a3d
Merge staging-next into staging 2022-10-20 00:05:50 +00:00
github-actions[bot]
aac580f88f
Merge master into staging-next 2022-10-20 00:05:13 +00:00
Sandro
23d0060889
Merge pull request #192639 from ylecornec/ylecornec/buildBazelPackage-tests 2022-10-19 23:36:53 +02:00
github-actions[bot]
e9d710f780
Merge staging-next into staging 2022-10-19 06:25:17 +00:00
github-actions[bot]
cea1c3f0cd
Merge master into staging-next 2022-10-19 06:24:39 +00:00
Daniel Poelzleithner
9331c0c772 FHSEnv: export /etc/shells
/etc/shells is often read by programs to determine which shells should be
provided. Fixes problems with extensions in vscode-fhs
2022-10-18 22:59:26 -07:00
Stella
fbf83cda37 build-fhs-userenv-bubblewrap: use -m not -f for readlink
This change will let more inexistent paths be passed along, avoiding extremely weird and hard to debug behavior. See https://github.com/containers/bubblewrap/issues/520 for what I personally encountered.
2022-10-18 22:50:59 -07:00
David McFarland
abebf5f591 nuget-to-nix: fix warning when package is installed from sdk 2022-10-18 23:42:46 -03:00
github-actions[bot]
262bce30e8
Merge staging-next into staging 2022-10-17 00:04:53 +00:00
github-actions[bot]
18a6423900
Merge master into staging-next 2022-10-17 00:04:21 +00:00
Sergei Trofimovich
8480f40236
Merge pull request #191134 from Et7f3/remove-duplicate-code-cc-wrapper
cc-wrapper: remove duplicate C{C,XX}${role_post}
2022-10-16 21:02:04 +01:00
Maximilian Bosch
a914b9460d
Merge pull request #193075 from Ma27/nextcloud-pkg-fix
fetchNextcloudApp: rewrite with fetchzip & applyPatches
2022-10-16 20:07:57 +02:00
Vladimír Čunát
d700d8e8a2
stdenv cc-wrapper: revert a problematic change for non-Linux
The change from 0bea4a194f (PR #191724) broke stdenv bootstap
on *-darwin, and I didn't want to drop the *-linux binaries
that we have already.
2022-10-14 09:40:48 +02:00
Martin Weinelt
c728598b84 Merge remote-tracking branch 'origin/staging-next' into staging 2022-10-13 23:29:04 +02:00
Robert Hensing
8fca2fd4bf
Merge pull request #141050 from koenw/dockertools_too_many_arguments
build-support: Fix error when building images with many layers
2022-10-13 21:45:10 +01:00
github-actions[bot]
7df9a7a84c
Merge staging-next into staging 2022-10-13 18:07:50 +00:00
Koen Wilde
2f5fcda329 build-support: Fix error when building images with many layers
When building a docker image using `dockertools.buildLayeredImage`, the
resulting image layers are passed to `jq` through the command line. When
building an image with too many layers this would exceed the maximum
command line argument length.

Hence, we store the list of layers in the Nix store and pass them to
`jq` as a file argument using `--slurpfile`.

Fixes #140908.
2022-10-13 16:27:13 +02:00
Shea Levy
ee7722a7de
Merge pull request #100634 from fzakaria/faridzakaria/buildmaven-nix
buildMaven: Update buildMaven to pure Nix
2022-10-13 08:06:26 -04:00
Vladimír Čunát
00a757ed3f
Merge branch 'master' into staging 2022-10-13 08:27:55 +02:00
Artturi
e66d2fd89d
Merge pull request #194256 from Artturin/treewides2 2022-10-13 00:08:01 +03:00
lassulus
85a36f9146 writers.writeJS: pass arguments to script 2022-10-11 20:16:37 +02:00
github-actions[bot]
5d957f3dba
Merge staging-next into staging 2022-10-11 00:05:26 +00:00
Martin Weinelt
85713b7e37 Merge remote-tracking branch 'origin/master' into staging-next 2022-10-11 00:18:04 +02:00
pacien
0495b0217b writers.writeFish: avoid loading user config files
This makes the Fish interpreter ignore user configuration files.
This was not desirable for running scripts, especially system ones.
2022-10-10 23:10:36 +02:00
Martin Weinelt
294201004f Merge remote-tracking branch 'origin/master' into staging-next 2022-10-10 21:45:18 +02:00
pacien
6e4a14b54f writers: add writeFish and writeFishBin
This adds writers for Fish shell scripts, with syntax checking.
2022-10-10 15:59:23 +02:00
Artturin
7e49471316 treewide: optional -> optionals where the argument is a list
the argument to optional should not be list
2022-10-10 15:40:21 +03:00
Artturin
f4ea1208ec treewide: *Flags convert to list from str
*Flags implies a list

slightly relevant:
> stdenv: start deprecating non-list configureFlags https://github.com/NixOS/nixpkgs/pull/173172

the makeInstalledTests function in `nixos/tests/installed-tests/default.nix` isn't available outside of nixpkgs so
it's not a breaking change
2022-10-10 15:30:59 +03:00
adisbladis
01535ff0b0 autoPatchelfHook: support glob patterns
so for example cuda could be ignored by setting:
``` nix
autoPatchelfIgnoreMissingDeps = [ "*cuda*.so*" ];
```
2022-10-10 17:55:11 +13:00
adisbladis
41c09640e7 autoPatchelfHook: fix turning [ "*" ] into bash array
Previously globs were incorrectly handled and expanded by bash into the files in the temporary build directory.
2022-10-10 17:55:11 +13:00
github-actions[bot]
cdfb8a30a4
Merge staging-next into staging 2022-10-08 12:02:12 +00:00
Vladimír Čunát
6565abc264
Merge branch 'master' into staging-next 2022-10-08 10:20:07 +02:00
Sergei Trofimovich
7d7030c6d5
Merge pull request #193871 from trofi/FORTIFY-unset-and-set
cc-wrapper/add-hardening.sh: always unset _FORTIFY_SOURCE before re-s…
2022-10-08 07:30:17 +01:00
Silvan Mosberger
c36f929dee nixos/tests: Add tests for dockerTools.buildNixShellImage 2022-10-07 22:04:24 +02:00
Silvan Mosberger
8ec0837a72 Introduce dockerTools.buildNixShellImage 2022-10-07 22:04:22 +02:00
Alex Martens
bac7ee3208 rustc: fix build for no_std targets 2022-10-07 07:35:29 -07:00
Anderson Torres
10c7f50248
Merge pull request #194425 from SuperSandro2000/remove-double-fixed-output
Add support for pname+version to fetchzip/fetchurl
2022-10-06 22:24:11 -03:00
Vladimír Čunát
4f6e99870b
Merge #191724: cc-wrapper: remove duplicate include flags
...into staging
2022-10-05 20:01:34 +02:00
Sandro
1fd6cf192a
fixup! fetchurl: add pname+version support 2022-10-05 15:54:57 +02:00
github-actions[bot]
2ae4a931aa
Merge master into staging-next 2022-10-05 06:10:04 +00:00
Sandro Jäckel
01dfd3cb58
fetchzip: add pname+version support 2022-10-04 18:57:46 +02:00
Sandro Jäckel
7deac8b8f7
fetchurl: add pname+version support 2022-10-04 17:30:06 +02:00
Silvan Mosberger
79ae4eb997 fake-nss: Add support for extra passwd and group lines 2022-10-04 00:05:34 +02:00
Lin Jian
4f65cecd45
emacs: remove warning of xargs when doing AOT native-comp
Before, there is a warning:

xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value

According to the  manual[1], swap -I and -n can remove this warning.

[1]: https://www.gnu.org/software/findutils/manual/html_node/find_html/Conflicting-xargs-options.html
2022-10-04 02:53:55 +08:00
Yves-Stan Le Cornec
b739da0693 buildBazelPackage: optionally run bazel tests in checkPhase
Tests from the bazelTestTargets argument will be run before the build. The new  bazelTestFlags argument can be used to pass additional flags to this phase.
2022-10-03 12:52:57 +02:00
github-actions[bot]
74f2e36035
Merge master into staging-next 2022-10-03 00:04:07 +00:00
Yureka
aa3dc6440e
fetchYarnDeps: support passing src attribute (#193047) 2022-10-02 22:41:31 +02:00
Ivv
1a958fae46
Merge pull request #193033 from corngood/dotnet-deterministic-fetch-deps
dotnet: fix some problems with nuget-to-nix and make it deterministic
2022-10-02 21:31:01 +02:00
David McFarland
b60c9fd2fe nuget-to-nix: find sources deterministically
The source used to download a particular package still isn't
deterministic in nuget. Even worse, the hash of the package can vary
between sources. This makes nuget use the first enabled source
containing the package.

The order of the dependencies may be slightly different because it now
uses glob order of the lower-case package names and versions, instead of
sorting the output.

If the package actually downloaded was the first source that contains
the package, then it will be hashed from disk to avoid downloading it
again.
2022-10-02 16:09:27 -03:00
David McFarland
f8763b87e0 nuget-to-nix: exclude by package source, not list
This allows exclusions to be by version.
2022-10-02 16:09:27 -03:00
David McFarland
0eb6874732 build-dotnet-module: fix fetch-deps usage message 2022-10-02 16:09:27 -03:00
David McFarland
f716d092e2 build-dotnet-module: limit package platforms by sdk support 2022-10-02 16:09:27 -03:00
David McFarland
4b40579b2d build-dotnet-module: clean up tmp file handling
Having:

rm -rf "$src" "$HOME"

Was slightly terrifying IMO, especially where the trap was installed
before HOME was set.
2022-10-02 16:09:24 -03:00
github-actions[bot]
0ae3aa5345
Merge master into staging-next 2022-10-02 17:45:43 +00:00
Théo Zimmermann
2dc3552aa1 coqPackages.mkCoqDerivation: upgrade to Dune 3
And remove the version number from the corresponding attributes.
2022-10-02 14:42:28 +02:00
github-actions[bot]
e879e7d54e
Merge master into staging-next 2022-10-02 00:04:43 +00:00
figsoda
a1d50eecab
Merge pull request #193132 from figsoda/clean-up
treewide: clean up
2022-10-01 17:03:11 -04:00
Sergei Trofimovich
2a9fc04635 cc-wrapper/add-hardening.sh: always unset _FORTIFY_SOURCE before re-setting it
On darwin clang driver always sets -D_FORTIFY_SOURCE=0 under asan.
This causes -Werror to trip over macro redefinition:

    <command line>:1:9: error: '_FORTIFY_SOURCE' macro redefined [-Werror,-Wmacro-redefined]
    #define _FORTIFY_SOURCE 2
            ^

To avoid it let's always explicitly undefine it first before redefining.
2022-10-01 08:30:11 +01:00
github-actions[bot]
9c14978f84
Merge master into staging-next 2022-09-29 12:01:25 +00:00
Robert Hensing
aed1deab05 nixos/testing: Fix release.nix tests evaluation
Fixes the problem introduced by 12b3066aae
which caused nixos/release.nix to return the wrong attributes, while
intending to only affect nixos/lib's runTest.
This also removes callTest from the test options, because callTest is
only ever invoked by all-tests.nix.
2022-09-29 10:49:09 +02:00