about summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
AgeCommit message (Collapse)AuthorFilesLines
2024-05-27Revert "make-binary-wrapper: add cc to propagatedBuildInputs"Alyssa Ross1-1/+1
This reverts commit 0c34636a5690cf8d75ecbab62d41179c56571f79. Seems to be causing some weird side effects. pkgsMusl.systemd no longer builds: Command line: `clang /run/user/1008/tmp.WuVNjgdfHT/source/build/meson-private/tmpdd3qc57v/testfile.c -o /run/user/1008/tmp.WuVNjgdfHT/source/build/meson-private/tmpdd3qc57v/output.obj -c -D_FILE_OFFSET_BITS=64 -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -std=gnu11` -> 1 stderr: clang: error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
2024-05-26Merge pull request #311794 from rhelmot/freebsd-minimal3/make-binary-wrapperJohn Ericson1-1/+1
make-binary-wrapper: add cc to propagatedBuildInputs
2024-05-24setup-hooks/strip: uniqify files by inode number before strippingThomas Watson1-6/+10
https://github.com/NixOS/nixpkgs/pull/246164 but for hardlinks. Mesa, among other packages, has binaries that are linked together and can end up corrupted when the same binary is stripped through two different names. To resolve this, print out the device and inode number before each file name, sort/uniq based on that, then cut it back out before stripping. The symlink resolution logic is removed as the same file accessed through two different links in `$paths` will necessarily have the same numbers. File/directory within the paths listed in `$paths` are correctly not (and were never) processed due to the `-type f` predicate and (implied) `-P` option to `find`.
2024-05-17make-binary-wrapper: add cc to propagatedBuildInputsArtemis Tosini1-1/+1
Adding cc to propagatedBuildInputs makes derivations with makeBinaryWrapper in nativeBuildInputs run the cc-wrapper setup hook. This isn't an issue for derivations using stdenv, as the cc setup hook is already run by default. However, derivations that are made with stdenvNoCC, e.g. because they're made with runCommand, will not run the cc-wrapper setup hook without this change. For some reason the FreeBSD native compiler will not work correctly without the setup hook.
2024-04-27treewide: wrapGAppsHook → wrapGAppsHook3Jan Tojnar1-7/+7
This was achieved using the following command: sd 'wrapGAppsHook\b' wrapGAppsHook3 (rg -l 'wrapGAppsHook\b') And then manually reverted the following changes: - alias in top-level.nix - function name in wrap-gapps-hook.sh - comment in postFixup of at-spi2-core - comment in gtk4 - comment in preFixup of 1password-gui/linux.nix - comment in postFixup of qgis/unwrapped-ltr.nix and qgis/unwrapped.nix - comment in postFixup of telegram-desktop - comment in postFixup of fwupd - buildCommand of mongodb-compass - postFixup of xflux-gui - comment in a patch in kdePackages.kde-gtk-config and plasma5Packages.kde-gtk-config - description of programs.sway.wrapperFeatures.gtk NixOS option (manual rebuild)
2024-04-27wrapGAppsHook: Flip inheritance relationship with wrapGAppsNoGuiHookJan Tojnar1-1/+1
2024-04-02auditBlasHook: removePhilip Taron1-37/+0
This was added in https://github.com/NixOS/nixpkgs/commit/d83e9c95738df2e9f912c239201f50e53e40810b, but included substitution variables `@blas@` and `@lapack@` that were never substituted. It's not used anywhere in `nixpkgs`.
2024-03-22Merge pull request #297628 from cwp/python-env-venvDomen Kožar2-0/+50
Fix venv creation in Python environments
2024-03-21Fix venv creation in Python environmentsColin Putney2-0/+50
The way we build python environments is subtly broken. A python environment should be semantically identical to a vanilla Python installation in, say, /usr/local. The current implementation, however, differs in two important ways. The first is that it's impossible to use python packages from the environment in python virtual environments. The second is that the nix-generated environment appears to be a venv, but it's not. This commit changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We remove the sitecustomize.py file from the base python package. This file was used tweak the python configuration after it was incorrectly initialized. That's no longer necessary. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv.
2024-03-19Merge staging-next into staginggithub-actions[bot]2-16/+16
2024-03-17autoPatchelfHook: move multiline hook into a functionQyriad1-14/+13
In NixOS/nixpkgs#290081 it came to attention that autoPatchelfHook is one of if not the only hook in Nixpkgs that is a multiline string expression. Almost all hooks are functions, which guard with something like `if [ -z "${dontDoTheThing-}" ]; then ...` in the function, or single-line strings which include that guard inline and then call the real function, e.g. `if [ -z "${dontDoTheThing-} ]; then doTheThing; fi`. This commit moves autoPatchelfHook to the former, which seems to be the most common style now.
2024-03-17stripJavaArchivesHook: rename from canonicalize-jars-hook and use ↵TomaSajt2-16/+16
strip-nondeterminism
2024-02-16Merge pull request #255463 from ↵Rick van Schijndel1-1/+4
emilylange/stdenv/patch-shebangs-trailing-newline patch-shebangs: fix crash with shebang without trailing newline
2024-01-22postgresqlTestHook: add postgresqlExtraSettings variableMario Rodas1-0/+2
Add `postgresqlExtraSettings` to allow to setup the `postgresql.conf`. This would be useful in cases where we need to set `shared_preload_libraries`.
2023-12-14auto-patchelf: improve deprecation check by searching all elementsConnor Baker1-6/+11
2023-12-14auto-patchelf: add support for __structuredAttrsConnor Baker1-4/+12
2023-11-30separateDebugInfo: use NIX_RUSTFLAGSAlyssa Ross1-1/+1
Setting RUSTFLAGS causes Cargo to ignore other ways of configuring flags, including the target-specific RUSTFLAGS options. This broke pkgsCross.musl64.crosvm, and was surprising to users. Fixes: https://github.com/NixOS/nixpkgs/pull/261727
2023-11-17autoPatchelfHook: fix arguments parsingK9001-2/+5
2023-10-28darwin: fix also .so names in darwinJari Vetoniemi1-1/+1
Darwin does not actually require `*.dylib` extension, and some ports of unix software may still simply compile and install these as `*.so` files. Include `*.so` in the find in this case. Co-authored-by: Artturi <Artturin@artturin.com> Co-authored-by: toonn <toonn@toonn.io>
2023-09-30autoPatchelfHook: add `patchelfFlags` optionK9002-7/+17
This may be useful. Eventually. Maybe.
2023-09-20Merge pull request #255208 from rhendric/rhendric/make-binary-wrapperArtturi1-0/+15
2023-09-18makeBinaryWrapper: protect wildcards in flagsRyan Hendrickson1-0/+15
2023-09-16makeBinaryWrapper.extractCmd: fix use in cross compilationNick Cao1-1/+1
2023-09-16patch-shebangs: fix crash with shebang without trailing newlineemilylange1-1/+4
This fixes a bug where `patchShebangs` crashes when trying to patch files that contain only a shebang (e.g. `#!/bin/bash`) (and nothing else) and do not end with a newline. Such file can be produced using `printf "#!/bin/bash" > example` or `echo -n "#!/bin/bash" > example`. I don't understand why one would want to create such files, as they do literally nothing, but the chromium tarball we are using started shipping some 🫠 Full reproducer: ```nix with import <nixpkgs> { }; stdenv.mkDerivation { dontUnpack = true; name = "patch-shebangs-no-trailing-newline-reproducer"; postPatch = '' printf "#!/bin/bash" > reproducer chmod +x reproducer patchShebangs reproducer ''; } ``` ``` ❯ nix-build reproducer.nix this derivation will be built: /nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv building '/nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv'... patching sources patching script interpreter paths in reproducer /nix/store/vr6wwdxkmyy44sg0gwxi10b8fc5zhwz0-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context error: builder for '/nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv' failed with exit code 1; last 3 log lines: > patching sources > patching script interpreter paths in reproducer > /nix/store/vr6wwdxkmyy44sg0gwxi10b8fc5zhwz0-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context For full logs, run 'nix log /nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv'. ```
2023-09-14Merge pull request #249268 from Enzime/remmina-bundletoonn1-2/+2
writeDarwinBundle: use binary wrapper
2023-09-05Merge pull request #218783 from timbertson/stripExcludeExtensionsArtturi1-1/+9
2023-09-04Merge pull request #245909 from Artturin/setupshchanges2Artturi3-3/+6
2023-09-03setup-hooks/separate-debug-info.sh: Warn if necessary variables are not setArtturin1-0/+3
`$OBJCOPY` is not available in bootstrap tools `stdenv.__bootPackages.stdenv.__bootPackages.stdenv.__bootPackages.stdenv.__bootPackages.stdenv.__bootPackages.bash.stdenv.cc.bintools`
2023-09-03setup-hooks/strip: add stripExcludeTim Cuthbertson1-1/+9
2023-09-02stdenv: Fix possible issues discovered withArtturin2-3/+3
``` set -o errexit -o nounset -o pipefail shopt -s inherit_errexit ``` in `stdenv/default-builder.sh`
2023-08-31win-dll-links: also copy dll from dependenciesbrano5431-39/+83
Fixes running `pkgsCross.mingwW64._7zz` in wine. Fixes issue 38451 ``` tree result/bin result/bin ├── 7zz.exe └── mcfgthread-12.dll -> ../../wmgj476qjfw26f9aij1d64lxrjfv6kk0-mcfgthreads-x86_64-w64-mingw32-git/bin/mcfgthread-12.dll ``` Co-authored-by: marius david <marius@mariusdavid.fr>
2023-08-26Merge pull request #246867 from markuskowa/add-mpi-hookmarkuskowa2-0/+59
add mpiCheckPhaseHook
2023-08-22mpiCheckPhaseHook: add new setup hook for MPI aware check phasesMarkus Kowalewski2-0/+59
Add this hook to checkPhase to allow for running MPI application in the sandbox. It detects the MPI implementations and sets the respective environment variables.
2023-08-21writeDarwinBundle: use binary wrapperMichael Hoang1-2/+2
Previously `writeDarwinBundle` used a handcrafted shell wrapper, however this causes issues on Apple Silicon Macs as script-only application bundles are always run under Rosetta[0][1]. Replacing the handcrafted shell wrapper with a binary wrapper allows apps to run natively instead of requiring Rosetta. However, this means we can no longer use `$1` and `$@`. After checking nearly every current usage of `desktopToDarwinBundle`, there were no apps that used `%[fFuU]` before the last argument, meaning removing them naively is good enough for the current apps. [0]: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary [1]: https://stackoverflow.com/a/68208374
2023-08-07setup-hooks/strip: Create the log file in '$TMDPIR'Artturin1-1/+1
vcunat said > This invocation of mktemp creates the file in the current directory, which is bad practice. We should add "--tmpdir=$TMPDIR" or make the template absolute. > I noticed because one package did cd $src during installing, which is a read-only path...
2023-08-04makeBinaryWrapper: remove cc dependency on aarch64-darwinTheodore Ni1-5/+2
2023-08-04Merge pull request #238525 from tie/patch-shebang-update-store-pathsArtturi1-10/+32
2023-07-31Revert "stdenv: use improved strip.sh for aarch64-linux"Vladimír Čunát1-90/+0
This reverts commit 39919b8f215110c1516f5c6b300f5ee69df23fd4. The parent merge resolved this more properly.
2023-07-31Merge pull request #246164 from trofi/strip-no-symlinksLinus Heckemann1-0/+5
setup-hooks/strip: resolve/uniq symlinks before stripping
2023-07-30stdenv: use improved strip.sh for aarch64-linuxVladimír Čunát1-0/+90
Adapted from PR #246164 TODO: clean up / use it everywhere on the next rebuild.
2023-07-30setup-hooks/strip: resolve/uniq symlinks before strippingSergei Trofimovich1-0/+5
Before the change the hook had a chance to run `strip` against the same file using multiple link paths. In case of `gcc` `libgcc.a` was stripped multiple times in parallel and produces corrupted archive. The change runs inputs via `realpath | uniq` to make sure we don't attempt to strip the same files multiple times.
2023-07-21setup-hooks/strip: Exit if `cmd` or `ranlibCmd` are emptyArtturin1-0/+3
2023-07-21setup-hooks/strip: Add -- before $cmdArtturin1-1/+1
2023-07-21setup-hooks/strip: Print strip stderr if command failsArtturin1-2/+6
This is easiest to do through a file. mktemp needs six X because busybox only accepts exactly six X.
2023-07-10setup-hooks/strip: parallelise strippingLinus Heckemann1-1/+6
This makes bootstrapping to GNU hello ~1-2% faster on an 8-core machine and ~3-4% faster on a 64-core machine.
2023-06-19patch-shebangs: add a flag to update shebangs with store pathsIvan Trubach1-10/+32
This change adds a flag to update shebang paths that point to the Nix store. This is particularly useful when a cross-compiled package uses same script at compile-time and run-time, but the interpreter must be changed since hostPlatform != buildPlatform.
2023-06-11makeWrapper: fix flag handlingJames Kay1-3/+3
When `--add-flags` is not used, `flagsBefore` is unset. This causes an error when invoking `makeWrapper` from a context that sets `-o nounset`, as is done in `buildDotnetModule`. This change makes `makeWrapper` safe for use in these conditions.
2023-05-31pkgs/build-support: fix typosfetsorn1-3/+3
2023-05-30autoPatchelfHook: Add support for single filesGuillaume Maudoux1-5/+17
2023-05-01Merge #229154: staging: make wrapProgram<Type> use the right wrapperVladimír Čunát2-2/+2
...into staging