···77source $stdenv/setup
78```
7980-to let `stdenv` set up the environment (e.g., process the `buildInputs`). If you want, you can still use `stdenv`’s generic builder:
8182```bash
83source $stdenv/setup
···698699### The fixup phase {#ssec-fixup-phase}
700701-The fixup phase performs some (Nix-specific) post-processing actions on the files installed under `$out` by the install phase. The default `fixupPhase` does the following:
702703- It moves the `man/`, `doc/` and `info/` subdirectories of `$out` to `share/`.
704- It strips libraries and executables of debug information.
705- On Linux, it applies the `patchelf` command to ELF executables and libraries to remove unused directories from the `RPATH` in order to prevent unnecessary runtime dependencies.
706-- It rewrites the interpreter paths of shell scripts to paths found in `PATH`. E.g., `/usr/bin/perl` will be rewritten to `/nix/store/some-perl/bin/perl` found in `PATH`.
707708#### Variables controlling the fixup phase {#variables-controlling-the-fixup-phase}
709···749750##### `dontPatchShebangs` {#var-stdenv-dontPatchShebangs}
751752-If set, scripts starting with `#!` do not have their interpreter paths rewritten to paths in the Nix store.
753754##### `dontPruneLibtoolFiles` {#var-stdenv-dontPruneLibtoolFiles}
755···983984The *existence* of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, there’s little benefit from mandating it be stable for any period of time.
985986-First, let’s cover some setup hooks that are part of Nixpkgs default stdenv. This means that they are run for every package built using `stdenv.mkDerivation`. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa.
987988### `move-docs.sh` {#move-docs.sh}
989···9991000### `patch-shebangs.sh` {#patch-shebangs.sh}
10011002-This setup hook patches installed scripts to use the full path to the shebang interpreter. A shebang interpreter is the first commented line of a script telling the operating system which program will run the script (e.g `#!/bin/bash`). In Nix, we want an exact path to that interpreter to be used. This often replaces `/bin/sh` with a path in the Nix store.
00000000000000000000000000000000000000000000000000000000000000010031004### `audit-tmpdir.sh` {#audit-tmpdir.sh}
1005···13161317[^footnote-stdenv-ignored-build-platform]: The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always *specified* as interfaces, not concrete implementation.
1318[^footnote-stdenv-native-dependencies-in-path]: Currently, this means for native builds all dependencies are put on the `PATH`. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the `depsBuild*` and `nativeBuildInputs` would be added to the `PATH`.
1319-[^footnote-stdenv-propagated-dependencies]: Nix itself already takes a package’s transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like setup hooks (mentioned above) also are run as if the propagated dependency.
1320[^footnote-stdenv-find-inputs-location]: The `findInputs` function, currently residing in `pkgs/stdenv/generic/setup.sh`, implements the propagation logic.
1321[^footnote-stdenv-sys-lib-search-path]: It clears the `sys_lib_*search_path` variables in the Libtool script to prevent Libtool from using libraries in `/usr/lib` and such.
1322[^footnote-stdenv-build-time-guessing-impurity]: Eventually these will be passed building natively as well, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
···77source $stdenv/setup
78```
7980+to let `stdenv` set up the environment (e.g. by resetting `PATH` and populating it from build inputs). If you want, you can still use `stdenv`’s generic builder:
8182```bash
83source $stdenv/setup
···698699### The fixup phase {#ssec-fixup-phase}
700701+The fixup phase performs (Nix-specific) post-processing actions on the files installed under `$out` by the install phase. The default `fixupPhase` does the following:
702703- It moves the `man/`, `doc/` and `info/` subdirectories of `$out` to `share/`.
704- It strips libraries and executables of debug information.
705- On Linux, it applies the `patchelf` command to ELF executables and libraries to remove unused directories from the `RPATH` in order to prevent unnecessary runtime dependencies.
706+- It rewrites the interpreter paths of shell scripts to paths found in `PATH`. E.g., `/usr/bin/perl` will be rewritten to `/nix/store/some-perl/bin/perl` found in `PATH`. See [](#patch-shebangs.sh) for details.
707708#### Variables controlling the fixup phase {#variables-controlling-the-fixup-phase}
709···749750##### `dontPatchShebangs` {#var-stdenv-dontPatchShebangs}
751752+If set, scripts starting with `#!` do not have their interpreter paths rewritten to paths in the Nix store. See [](#patch-shebangs.sh) on how patching shebangs works.
753754##### `dontPruneLibtoolFiles` {#var-stdenv-dontPruneLibtoolFiles}
755···983984The *existence* of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, there’s little benefit from mandating it be stable for any period of time.
985986+First, let’s cover some setup hooks that are part of Nixpkgs default `stdenv`. This means that they are run for every package built using `stdenv.mkDerivation` or when using a custom builder that has `source $stdenv/setup`. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa.
987988### `move-docs.sh` {#move-docs.sh}
989···9991000### `patch-shebangs.sh` {#patch-shebangs.sh}
10011002+This setup hook patches installed scripts to add Nix store paths to their shebang interpreter as found in the build environment. The [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line tells a Unix-like operating system which interpreter to use to execute the script's contents.
1003+1004+::: note
1005+The [generic builder][generic-builder] populates `PATH` from inputs of the derivation.
1006+:::
1007+1008+[generic-builder]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/stdenv/generic/builder.sh
1009+1010+#### Invocation {#patch-shebangs.sh-invocation}
1011+1012+Multiple paths can be specified.
1013+1014+```
1015+patchShebangs [--build | --host] PATH...
1016+```
1017+1018+##### Flags
1019+1020+`--build`
1021+: Look up commands available at build time
1022+1023+`--host`
1024+: Look up commands available at run time
1025+1026+##### Examples
1027+1028+```sh
1029+patchShebangs --host /nix/store/<hash>-hello-1.0/bin
1030+```
1031+1032+```sh
1033+patchShebangs --build configure
1034+```
1035+1036+`#!/bin/sh` will be rewritten to `#!/nix/store/<hash>-some-bash/bin/sh`.
1037+1038+`#!/usr/bin/env` gets special treatment: `#!/usr/bin/env python` is rewritten to `/nix/store/<hash>/bin/python`.
1039+1040+Interpreter paths that point to a valid Nix store location are not changed.
1041+1042+::: note
1043+A script file must be marked as executable, otherwise it will not be
1044+considered.
1045+:::
1046+1047+This mechanism ensures that the interpreter for a given script is always found and is exactly the one specified by the build.
1048+1049+It can be disabled by setting [`dontPatchShebangs`](#var-stdenv-dontPatchShebangs):
1050+1051+```nix
1052+stdenv.mkDerivation {
1053+ # ...
1054+ dontPatchShebangs = true;
1055+ # ...
1056+}
1057+```
1058+1059+The file [`patch-shebangs.sh`][patch-shebangs.sh] defines the [`patchShebangs`][patchShebangs] function. It is used to implement [`patchShebangsAuto`][patchShebangsAuto], the [setup hook](#ssec-setup-hooks) that is registered to run during the [fixup phase](#ssec-fixup-phase) by default.
1060+1061+If you need to run `patchShebangs` at build time, it must be called explicitly within [one of the build phases](#sec-stdenv-phases).
1062+1063+[patch-shebangs.sh]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh
1064+[patchShebangs]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L24-L105
1065+[patchShebangsAuto]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L107-L119
10661067### `audit-tmpdir.sh` {#audit-tmpdir.sh}
1068···13791380[^footnote-stdenv-ignored-build-platform]: The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always *specified* as interfaces, not concrete implementation.
1381[^footnote-stdenv-native-dependencies-in-path]: Currently, this means for native builds all dependencies are put on the `PATH`. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the `depsBuild*` and `nativeBuildInputs` would be added to the `PATH`.
1382+[^footnote-stdenv-propagated-dependencies]: Nix itself already takes a package’s transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like [setup hooks](#ssec-setup-hooks) also are run as if it were a propagated dependency.
1383[^footnote-stdenv-find-inputs-location]: The `findInputs` function, currently residing in `pkgs/stdenv/generic/setup.sh`, implements the propagation logic.
1384[^footnote-stdenv-sys-lib-search-path]: It clears the `sys_lib_*search_path` variables in the Libtool script to prevent Libtool from using libraries in `/usr/lib` and such.
1385[^footnote-stdenv-build-time-guessing-impurity]: Eventually these will be passed building natively as well, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
+16-6
nixos/modules/virtualisation/proxmox-image.nix
···127 name = "proxmox-${cfg.filenameSuffix}";
128 postVM = let
129 # Build qemu with PVE's patch that adds support for the VMA format
130- vma = pkgs.qemu_kvm.overrideAttrs ( super: {
00000000131 patches = let
132- rev = "cc707c362ea5c8d832aac270d1ffa7ac66a8908f";
133- path = "debian/patches/pve/0025-PVE-Backup-add-vma-backup-format-code.patch";
134 vma-patch = pkgs.fetchpatch {
135- url = "https://git.proxmox.com/?p=pve-qemu.git;a=blob_plain;hb=${rev};f=${path}";
136- sha256 = "1z467xnmfmry3pjy7p34psd5xdil9x0apnbvfz8qbj0bf9fgc8zf";
137 };
138- in super.patches ++ [ vma-patch ];
0139 buildInputs = super.buildInputs ++ [ pkgs.libuuid ];
0140 });
141 in
142 ''
···127 name = "proxmox-${cfg.filenameSuffix}";
128 postVM = let
129 # Build qemu with PVE's patch that adds support for the VMA format
130+ vma = pkgs.qemu_kvm.overrideAttrs ( super: rec {
131+132+ # proxmox's VMA patch doesn't work with qemu 7.0 yet
133+ version = "6.2.0";
134+ src = pkgs.fetchurl {
135+ url= "https://download.qemu.org/qemu-${version}.tar.xz";
136+ hash = "sha256-aOFdjkWsVjJuC5pK+otJo9/oq6NIgiHQmMhGmLymW0U=";
137+ };
138+139 patches = let
140+ rev = "b37b17c286da3d32945fbee8ee4fd97a418a50db";
141+ path = "debian/patches/pve/0026-PVE-Backup-add-vma-backup-format-code.patch";
142 vma-patch = pkgs.fetchpatch {
143+ url = "https://git.proxmox.com/?p=pve-qemu.git;a=blob_plain;h=${rev};f=${path}";
144+ hash = "sha256-siuDWDUnM9Zq0/L2Faww3ELAOUHhVIHu5RAQn6L4Atc=";
145 };
146+ in [ vma-patch ];
147+148 buildInputs = super.buildInputs ++ [ pkgs.libuuid ];
149+150 });
151 in
152 ''
+23
nixos/release.nix
···221222 );
22300000000000000000000000224225 # A disk image that can be imported to Amazon EC2 and registered as an AMI
226 amazonImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
···221222 );
223224+ # KVM image for proxmox in VMA format
225+ proxmoxImage = forMatchingSystems [ "x86_64-linux" ] (system:
226+ with import ./.. { inherit system; };
227+228+ hydraJob ((import lib/eval-config.nix {
229+ inherit system;
230+ modules = [
231+ ./modules/virtualisation/proxmox-image.nix
232+ ];
233+ }).config.system.build.VMA)
234+ );
235+236+ # LXC tarball for proxmox
237+ proxmoxLXC = forMatchingSystems [ "x86_64-linux" ] (system:
238+ with import ./.. { inherit system; };
239+240+ hydraJob ((import lib/eval-config.nix {
241+ inherit system;
242+ modules = [
243+ ./modules/virtualisation/proxmox-lxc.nix
244+ ];
245+ }).config.system.build.tarball)
246+ );
247248 # A disk image that can be imported to Amazon EC2 and registered as an AMI
249 amazonImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
···33 "test_escape_double_quotes_in_filenames"
34 ];
350036 meta = with lib; {
37 description = "A tool that helps controlling nvim processes from a terminal";
38 homepage = "https://github.com/mhinz/neovim-remote/";
···33 "test_escape_double_quotes_in_filenames"
34 ];
3536+ doCheck = !stdenv.isDarwin;
37+38 meta = with lib; {
39 description = "A tool that helps controlling nvim processes from a terminal";
40 homepage = "https://github.com/mhinz/neovim-remote/";