From 5058f9a5dfc5aece634d6f2a23df86b944603aa9 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Thu, 3 Jun 2021 20:12:16 -0700 Subject: [PATCH 01/16] nixos/doc: convert assertions and warnings section to CommonMark --- .../manual/development/assertions.section.md | 40 ++++++++++ nixos/doc/manual/development/assertions.xml | 74 ------------------- .../manual/development/writing-modules.xml | 2 +- .../development/assertions.section.xml | 58 +++++++++++++++ 4 files changed, 99 insertions(+), 75 deletions(-) create mode 100644 nixos/doc/manual/development/assertions.section.md delete mode 100644 nixos/doc/manual/development/assertions.xml create mode 100644 nixos/doc/manual/from_md/development/assertions.section.xml diff --git a/nixos/doc/manual/development/assertions.section.md b/nixos/doc/manual/development/assertions.section.md new file mode 100644 index 000000000000..cc6d81e56990 --- /dev/null +++ b/nixos/doc/manual/development/assertions.section.md @@ -0,0 +1,40 @@ +# Warnings and Assertions {#sec-assertions} + +When configuration problems are detectable in a module, it is a good idea to write an assertion or warning. Doing so provides clear feedback to the user and prevents errors after the build. + +Although Nix has the `abort` and `builtins.trace` [functions](https://nixos.org/nix/manual/#ssec-builtins) to perform such tasks, they are not ideally suited for NixOS modules. Instead of these functions, you can declare your warnings and assertions using the NixOS module system. + +## Warnings {#sec-assertions-warnings} + +This is an example of using `warnings`. + +```nix +{ config, lib, ... }: +{ + config = lib.mkIf config.services.foo.enable { + warnings = + if config.services.foo.bar + then [ ''You have enabled the bar feature of the foo service. + This is known to cause some specific problems in certain situations. + '' ] + else []; + } +} +``` + +## Assertions {#sec-assertions-assetions} + +This example, extracted from the [`syslogd` module](https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix) shows how to use `assertions`. Since there can only be one active syslog daemon at a time, an assertion is useful to prevent such a broken system from being built. + +```nix +{ config, lib, ... }: +{ + config = lib.mkIf config.services.syslogd.enable { + assertions = + [ { assertion = !config.services.rsyslogd.enable; + message = "rsyslogd conflicts with syslogd"; + } + ]; + } +} +``` diff --git a/nixos/doc/manual/development/assertions.xml b/nixos/doc/manual/development/assertions.xml deleted file mode 100644 index 32f90cf2e7c4..000000000000 --- a/nixos/doc/manual/development/assertions.xml +++ /dev/null @@ -1,74 +0,0 @@ -
- Warnings and Assertions - - - When configuration problems are detectable in a module, it is a good idea to - write an assertion or warning. Doing so provides clear feedback to the user - and prevents errors after the build. - - - - Although Nix has the abort and - builtins.trace - functions - to perform such tasks, they are not ideally suited for NixOS modules. Instead - of these functions, you can declare your warnings and assertions using the - NixOS module system. - - -
- Warnings - - - This is an example of using warnings. - - - - - -
- -
- Assertions - - - This example, extracted from the - - syslogd module shows how to use - assertions. Since there can only be one active syslog - daemon at a time, an assertion is useful to prevent such a broken system - from being built. - - - - - -
-
diff --git a/nixos/doc/manual/development/writing-modules.xml b/nixos/doc/manual/development/writing-modules.xml index fad4637f51f0..04497db77b89 100644 --- a/nixos/doc/manual/development/writing-modules.xml +++ b/nixos/doc/manual/development/writing-modules.xml @@ -182,7 +182,7 @@ in { - + diff --git a/nixos/doc/manual/from_md/development/assertions.section.xml b/nixos/doc/manual/from_md/development/assertions.section.xml new file mode 100644 index 000000000000..0844d484d60f --- /dev/null +++ b/nixos/doc/manual/from_md/development/assertions.section.xml @@ -0,0 +1,58 @@ +
+ Warnings and Assertions + + When configuration problems are detectable in a module, it is a good + idea to write an assertion or warning. Doing so provides clear + feedback to the user and prevents errors after the build. + + + Although Nix has the abort and + builtins.trace + functions + to perform such tasks, they are not ideally suited for NixOS + modules. Instead of these functions, you can declare your warnings + and assertions using the NixOS module system. + +
+ Warnings + + This is an example of using warnings. + + +{ config, lib, ... }: +{ + config = lib.mkIf config.services.foo.enable { + warnings = + if config.services.foo.bar + then [ ''You have enabled the bar feature of the foo service. + This is known to cause some specific problems in certain situations. + '' ] + else []; + } +} + +
+
+ Assertions + + This example, extracted from the + syslogd + module shows how to use assertions. + Since there can only be one active syslog daemon at a time, an + assertion is useful to prevent such a broken system from being + built. + + +{ config, lib, ... }: +{ + config = lib.mkIf config.services.syslogd.enable { + assertions = + [ { assertion = !config.services.rsyslogd.enable; + message = "rsyslogd conflicts with syslogd"; + } + ]; + } +} + +
+
From 53387621e5fd893947ec4924d320687f8c96c7cb Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Sun, 6 Jun 2021 02:37:32 -0600 Subject: [PATCH 02/16] remove chris-martin from maintainer list on various crypto packages --- pkgs/applications/blockchains/stellar-core.nix | 2 +- pkgs/development/compilers/serpent/default.nix | 2 +- pkgs/development/python-modules/secp256k1/default.nix | 2 +- pkgs/tools/misc/libbitcoin/libbitcoin-client.nix | 2 +- pkgs/tools/misc/libbitcoin/libbitcoin-explorer.nix | 2 +- pkgs/tools/misc/libbitcoin/libbitcoin.nix | 2 +- pkgs/tools/security/secp256k1/default.nix | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/blockchains/stellar-core.nix b/pkgs/applications/blockchains/stellar-core.nix index 197453599b28..6ecc4e241cb4 100644 --- a/pkgs/applications/blockchains/stellar-core.nix +++ b/pkgs/applications/blockchains/stellar-core.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { ''; homepage = "https://www.stellar.org/"; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ chris-martin ]; + maintainers = with maintainers; [ ]; license = licenses.asl20; }; } diff --git a/pkgs/development/compilers/serpent/default.nix b/pkgs/development/compilers/serpent/default.nix index fbcbf4485a47..227e8037eaee 100644 --- a/pkgs/development/compilers/serpent/default.nix +++ b/pkgs/development/compilers/serpent/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation { ''; homepage = "https://github.com/ethereum/wiki/wiki/Serpent"; license = with licenses; [ wtfpl ]; - maintainers = with maintainers; [ chris-martin ]; + maintainers = with maintainers; [ ]; platforms = platforms.all; }; } diff --git a/pkgs/development/python-modules/secp256k1/default.nix b/pkgs/development/python-modules/secp256k1/default.nix index 78ddb269f3db..bb5cc138a749 100644 --- a/pkgs/development/python-modules/secp256k1/default.nix +++ b/pkgs/development/python-modules/secp256k1/default.nix @@ -44,6 +44,6 @@ buildPythonPackage rec { homepage = "https://github.com/ludbb/secp256k1-py"; description = "Python FFI bindings for secp256k1"; license = with lib.licenses; [ mit ]; - maintainers = with lib.maintainers; [ chris-martin ]; + maintainers = with lib.maintainers; [ ]; }; } diff --git a/pkgs/tools/misc/libbitcoin/libbitcoin-client.nix b/pkgs/tools/misc/libbitcoin/libbitcoin-client.nix index 6f9c07209cf3..a940fba29676 100644 --- a/pkgs/tools/misc/libbitcoin/libbitcoin-client.nix +++ b/pkgs/tools/misc/libbitcoin/libbitcoin-client.nix @@ -30,7 +30,7 @@ in stdenv.mkDerivation { description = "Bitcoin client query library"; homepage = "https://github.com/libbitcoin/libbitcoin-client"; platforms = platforms.linux ++ platforms.darwin; - maintainers = with maintainers; [ chris-martin ]; + maintainers = with maintainers; [ ]; # AGPL with a lesser clause license = licenses.agpl3; diff --git a/pkgs/tools/misc/libbitcoin/libbitcoin-explorer.nix b/pkgs/tools/misc/libbitcoin/libbitcoin-explorer.nix index dd0ed857314b..7d00e4c09add 100644 --- a/pkgs/tools/misc/libbitcoin/libbitcoin-explorer.nix +++ b/pkgs/tools/misc/libbitcoin/libbitcoin-explorer.nix @@ -31,7 +31,7 @@ in stdenv.mkDerivation { description = "Bitcoin command line tool"; homepage = "https://github.com/libbitcoin/libbitcoin-explorer"; platforms = platforms.linux ++ platforms.darwin; - maintainers = with maintainers; [ chris-martin asymmetric ]; + maintainers = with maintainers; [ asymmetric ]; # AGPL with a lesser clause license = licenses.agpl3; diff --git a/pkgs/tools/misc/libbitcoin/libbitcoin.nix b/pkgs/tools/misc/libbitcoin/libbitcoin.nix index 122aed696fc1..b4f91bc936d2 100644 --- a/pkgs/tools/misc/libbitcoin/libbitcoin.nix +++ b/pkgs/tools/misc/libbitcoin/libbitcoin.nix @@ -31,7 +31,7 @@ in stdenv.mkDerivation { description = "C++ library for building bitcoin applications"; homepage = "https://libbitcoin.org/"; platforms = platforms.linux ++ platforms.darwin; - maintainers = with maintainers; [ chris-martin ]; + maintainers = with maintainers; [ ]; # AGPL with a lesser clause license = licenses.agpl3; diff --git a/pkgs/tools/security/secp256k1/default.nix b/pkgs/tools/security/secp256k1/default.nix index a8acf3586c9e..e82b544e66ca 100644 --- a/pkgs/tools/security/secp256k1/default.nix +++ b/pkgs/tools/security/secp256k1/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation { ''; homepage = "https://github.com/bitcoin-core/secp256k1"; license = with licenses; [ mit ]; - maintainers = with maintainers; [ chris-martin ]; + maintainers = with maintainers; [ ]; platforms = with platforms; unix; }; } From 77cfa5fd07fb5c501b9510a4058a438de3acc620 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Thu, 3 Jun 2021 20:55:01 -0700 Subject: [PATCH 03/16] nixos/doc: convert boot problems section to CommonMark --- .../administration/boot-problems.section.md | 35 +++++ .../manual/administration/boot-problems.xml | 126 ----------------- .../manual/administration/troubleshooting.xml | 2 +- .../administration/boot-problems.section.xml | 127 ++++++++++++++++++ 4 files changed, 163 insertions(+), 127 deletions(-) create mode 100644 nixos/doc/manual/administration/boot-problems.section.md delete mode 100644 nixos/doc/manual/administration/boot-problems.xml create mode 100644 nixos/doc/manual/from_md/administration/boot-problems.section.xml diff --git a/nixos/doc/manual/administration/boot-problems.section.md b/nixos/doc/manual/administration/boot-problems.section.md new file mode 100644 index 000000000000..eb9209602a32 --- /dev/null +++ b/nixos/doc/manual/administration/boot-problems.section.md @@ -0,0 +1,35 @@ +# Boot Problems {#sec-boot-problems} + +If NixOS fails to boot, there are a number of kernel command line parameters that may help you to identify or fix the issue. You can add these parameters in the GRUB boot menu by pressing “e” to modify the selected boot entry and editing the line starting with `linux`. The following are some useful kernel command line parameters that are recognised by the NixOS boot scripts or by systemd: + +`boot.shell_on_fail` + +: Allows the user to start a root shell if something goes wrong in stage 1 of the boot process (the initial ramdisk). This is disabled by default because there is no authentication for the root shell. + +`boot.debug1` + +: Start an interactive shell in stage 1 before anything useful has been done. That is, no modules have been loaded and no file systems have been mounted, except for `/proc` and `/sys`. + +`boot.debug1devices` + +: Like `boot.debug1`, but runs stage1 until kernel modules are loaded and device nodes are created. This may help with e.g. making the keyboard work. + +`boot.debug1mounts` + +: Like `boot.debug1` or `boot.debug1devices`, but runs stage1 until all filesystems that are mounted during initrd are mounted (see [neededForBoot](#opt-fileSystems._name_.neededForBoot)). As a motivating example, this could be useful if you've forgotten to set [neededForBoot](options.html#opt-fileSystems._name_.neededForBoot) on a file system. + +`boot.trace` + +: Print every shell command executed by the stage 1 and 2 boot scripts. + +`single` + +: Boot into rescue mode (a.k.a. single user mode). This will cause systemd to start nothing but the unit `rescue.target`, which runs `sulogin` to prompt for the root password and start a root login shell. Exiting the shell causes the system to continue with the normal boot process. + +`systemd.log_level=debug` `systemd.log_target=console` + +: Make systemd very verbose and send log messages to the console instead of the journal. For more parameters recognised by systemd, see systemd(1). + +Notice that for `boot.shell_on_fail`, `boot.debug1`, `boot.debug1devices`, and `boot.debug1mounts`, if you did **not** select "start the new shell as pid 1", and you `exit` from the new shell, boot will proceed normally from the point where it failed, as if you'd chosen "ignore the error and continue". + +If no login prompts or X11 login screens appear (e.g. due to hanging dependencies), you can press Alt+ArrowUp. If you’re lucky, this will start rescue mode (described above). (Also note that since most units have a 90-second timeout before systemd gives up on them, the `agetty` login prompts should appear eventually unless something is very wrong.) diff --git a/nixos/doc/manual/administration/boot-problems.xml b/nixos/doc/manual/administration/boot-problems.xml deleted file mode 100644 index e0f662840101..000000000000 --- a/nixos/doc/manual/administration/boot-problems.xml +++ /dev/null @@ -1,126 +0,0 @@ -
- Boot Problems - - - If NixOS fails to boot, there are a number of kernel command line parameters - that may help you to identify or fix the issue. You can add these parameters - in the GRUB boot menu by pressing “e” to modify the selected boot entry - and editing the line starting with linux. The following - are some useful kernel command line parameters that are recognised by the - NixOS boot scripts or by systemd: - - - - boot.shell_on_fail - - - - Allows the user to start a root shell if something goes wrong in stage 1 - of the boot process (the initial ramdisk). This is disabled by default - because there is no authentication for the root shell. - - - - - - boot.debug1 - - - - Start an interactive shell in stage 1 before anything useful has been - done. That is, no modules have been loaded and no file systems have been - mounted, except for /proc and - /sys. - - - - - - boot.debug1devices - - - - Like boot.debug1, but runs stage1 until kernel modules are loaded and device nodes are created. - This may help with e.g. making the keyboard work. - - - - - - boot.debug1mounts - - - - Like boot.debug1 or - boot.debug1devices, but runs stage1 until all - filesystems that are mounted during initrd are mounted (see - - ). As a motivating example, this could be useful if you've forgotten to set - - on a file system. - - - - - - boot.trace - - - - Print every shell command executed by the stage 1 and 2 boot scripts. - - - - - - single - - - - Boot into rescue mode (a.k.a. single user mode). This will cause systemd - to start nothing but the unit rescue.target, which - runs sulogin to prompt for the root password and start - a root login shell. Exiting the shell causes the system to continue with - the normal boot process. - - - - - - systemd.log_level=debug systemd.log_target=console - - - - Make systemd very verbose and send log messages to the console instead of - the journal. - - - - - For more parameters recognised by systemd, see - systemd - 1. - - - - Notice that for boot.shell_on_fail, - boot.debug1, boot.debug1devices, and - boot.debug1mounts, if you did not - select "start the new shell as pid 1", and you exit from - the new shell, boot will proceed normally from the point where it failed, as - if you'd chosen "ignore the error and continue". - - - - If no login prompts or X11 login screens appear (e.g. due to hanging - dependencies), you can press Alt+ArrowUp. If you’re lucky, this will start - rescue mode (described above). (Also note that since most units have a - 90-second timeout before systemd gives up on them, the - agetty login prompts should appear eventually unless - something is very wrong.) - -
diff --git a/nixos/doc/manual/administration/troubleshooting.xml b/nixos/doc/manual/administration/troubleshooting.xml index 6496e7bde387..b055acadacf3 100644 --- a/nixos/doc/manual/administration/troubleshooting.xml +++ b/nixos/doc/manual/administration/troubleshooting.xml @@ -8,7 +8,7 @@ This chapter describes solutions to common problems you might encounter when you manage your NixOS system. - + diff --git a/nixos/doc/manual/from_md/administration/boot-problems.section.xml b/nixos/doc/manual/from_md/administration/boot-problems.section.xml new file mode 100644 index 000000000000..89871e7aeb68 --- /dev/null +++ b/nixos/doc/manual/from_md/administration/boot-problems.section.xml @@ -0,0 +1,127 @@ +
+ Boot Problems + + If NixOS fails to boot, there are a number of kernel command line + parameters that may help you to identify or fix the issue. You can + add these parameters in the GRUB boot menu by pressing + e to modify the selected boot entry and editing the + line starting with linux. The following are some + useful kernel command line parameters that are recognised by the + NixOS boot scripts or by systemd: + + + + + boot.shell_on_fail + + + + Allows the user to start a root shell if something goes wrong + in stage 1 of the boot process (the initial ramdisk). This is + disabled by default because there is no authentication for the + root shell. + + + + + + boot.debug1 + + + + Start an interactive shell in stage 1 before anything useful + has been done. That is, no modules have been loaded and no + file systems have been mounted, except for + /proc and /sys. + + + + + + boot.debug1devices + + + + Like boot.debug1, but runs stage1 until + kernel modules are loaded and device nodes are created. This + may help with e.g. making the keyboard work. + + + + + + boot.debug1mounts + + + + Like boot.debug1 or + boot.debug1devices, but runs stage1 until + all filesystems that are mounted during initrd are mounted + (see + neededForBoot). + As a motivating example, this could be useful if you’ve + forgotten to set + neededForBoot + on a file system. + + + + + + boot.trace + + + + Print every shell command executed by the stage 1 and 2 boot + scripts. + + + + + + single + + + + Boot into rescue mode (a.k.a. single user mode). This will + cause systemd to start nothing but the unit + rescue.target, which runs + sulogin to prompt for the root password and + start a root login shell. Exiting the shell causes the system + to continue with the normal boot process. + + + + + + systemd.log_level=debug + systemd.log_target=console + + + + Make systemd very verbose and send log messages to the console + instead of the journal. For more parameters recognised by + systemd, see systemd(1). + + + + + + Notice that for boot.shell_on_fail, + boot.debug1, + boot.debug1devices, and + boot.debug1mounts, if you did + not select start the new + shell as pid 1, and you exit from the new + shell, boot will proceed normally from the point where it failed, as + if you’d chosen ignore the error and continue. + + + If no login prompts or X11 login screens appear (e.g. due to hanging + dependencies), you can press Alt+ArrowUp. If you’re lucky, this will + start rescue mode (described above). (Also note that since most + units have a 90-second timeout before systemd gives up on them, the + agetty login prompts should appear eventually + unless something is very wrong.) + +
From c702cc43213dce2573adb924ab9c67522616aea6 Mon Sep 17 00:00:00 2001 From: Jan Solanti Date: Wed, 2 Jun 2021 03:16:43 +0300 Subject: [PATCH 04/16] pipewire: 0.3.27 -> 0.3.30 --- .../desktops/pipewire/pipewire.conf.json | 13 +++++- .../pipewire/0080-pipewire-config-dir.patch | 24 +++++----- .../0090-pipewire-config-template-paths.patch | 28 ++++++++++++ .../libraries/pipewire/default.nix | 44 ++++++++++++++----- 4 files changed, 86 insertions(+), 23 deletions(-) create mode 100644 pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch diff --git a/nixos/modules/services/desktops/pipewire/pipewire.conf.json b/nixos/modules/services/desktops/pipewire/pipewire.conf.json index a9330f54f4f7..a923ab4db235 100644 --- a/nixos/modules/services/desktops/pipewire/pipewire.conf.json +++ b/nixos/modules/services/desktops/pipewire/pipewire.conf.json @@ -74,7 +74,18 @@ "args": { "factory.name": "support.node.driver", "node.name": "Dummy-Driver", - "priority.driver": 8000 + "node.group": "pipewire.dummy", + "priority.driver": 20000 + } + }, + { + "factory": "spa-node-factory", + "args": { + "factory.name": "support.node.driver", + "node.name": "Freewheel-Driver", + "priority.driver": 19000, + "node.group": "pipewire.freewheel", + "node.freewheel": true } } ], diff --git a/pkgs/development/libraries/pipewire/0080-pipewire-config-dir.patch b/pkgs/development/libraries/pipewire/0080-pipewire-config-dir.patch index b92e2818ea07..b8d8fcb0f905 100644 --- a/pkgs/development/libraries/pipewire/0080-pipewire-config-dir.patch +++ b/pkgs/development/libraries/pipewire/0080-pipewire-config-dir.patch @@ -1,30 +1,30 @@ diff --git a/meson.build b/meson.build -index a27569bd..fcf18344 100644 +index b6b4553b..f21c29d8 100644 --- a/meson.build +++ b/meson.build -@@ -36,7 +36,10 @@ pipewire_libexecdir = prefix / get_option('libexecdir') - pipewire_localedir = prefix / get_option('localedir') +@@ -37,7 +37,10 @@ pipewire_localedir = prefix / get_option('localedir') pipewire_sysconfdir = prefix / get_option('sysconfdir') --pipewire_configdir = pipewire_sysconfdir / 'pipewire' -+pipewire_configdir = get_option('pipewire_config_dir') -+if pipewire_configdir == '' -+ pipewire_configdir = pipewire_sysconfdir / 'pipewire' + pipewire_configdir = pipewire_sysconfdir / 'pipewire' +-pipewire_confdatadir = pipewire_datadir / 'pipewire' ++pipewire_confdatadir = get_option('pipewire_confdata_dir') ++if pipewire_confdatadir == '' ++ pipewire_confdatadir = pipewire_datadir / 'pipewire' +endif modules_install_dir = pipewire_libdir / pipewire_name if host_machine.system() == 'linux' diff --git a/meson_options.txt b/meson_options.txt -index 85beb86a..372e8faa 100644 +index 9bc33fcd..e4bd2dc1 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -67,6 +67,9 @@ option('jack-devel', +@@ -61,6 +61,9 @@ option('jack-devel', option('libjack-path', description: 'Where to install the libjack.so library', type: 'string') -+option('pipewire_config_dir', -+ type : 'string', -+ description : 'Directory for pipewire configuration (defaults to /etc/pipewire)') ++option('pipewire_confdata_dir', ++ type: 'string', ++ description: 'Directory for pipewire default configuration (defaults to /usr/share/pipewire)') option('spa-plugins', description: 'Enable spa plugins integration', type: 'feature', diff --git a/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch b/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch new file mode 100644 index 000000000000..966cb9579777 --- /dev/null +++ b/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch @@ -0,0 +1,28 @@ +diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in +index bbafa134..227d3e06 100644 +--- a/src/daemon/pipewire.conf.in ++++ b/src/daemon/pipewire.conf.in +@@ -116,7 +116,7 @@ context.modules = [ + # access.allowed to list an array of paths of allowed + # apps. + #access.allowed = [ +- # @media_session_path@ ++ # + #] + + # An array of rejected paths. +@@ -220,12 +220,12 @@ context.exec = [ + # but it is better to start it as a systemd service. + # Run the session manager with -h for options. + # +- @comment@{ path = "@media_session_path@" args = "" } ++ @comment@{ path = "" args = "" } + # + # You can optionally start the pulseaudio-server here as well + # but it is better to start it as a systemd service. + # It can be interesting to start another daemon here that listens + # on another address with the -a option (eg. -a tcp:4713). + # +- @comment@{ path = "@pipewire_path@" args = "-c pipewire-pulse.conf" } ++ @comment@{ path = "" args = "-c pipewire-pulse.conf" } + ] diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index b3e740f39c46..b8fb216e3583 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -2,6 +2,7 @@ , lib , fetchFromGitLab , removeReferencesTo +, python3 , meson , ninja , systemd @@ -19,6 +20,7 @@ , SDL2 , vulkan-headers , vulkan-loader +, webrtc-audio-processing , ncurses , makeFontsConf , callPackage @@ -31,6 +33,8 @@ , nativeHfpSupport ? true , ofonoSupport ? true , hsphfpdSupport ? true +, pulseTunnelSupport ? true, libpulseaudio ? null +, zeroconfSupport ? true, avahi ? null }: let @@ -42,7 +46,7 @@ let self = stdenv.mkDerivation rec { pname = "pipewire"; - version = "0.3.27"; + version = "0.3.30"; outputs = [ "out" @@ -60,7 +64,7 @@ let owner = "pipewire"; repo = "pipewire"; rev = version; - sha256 = "sha256-GfcMODQWtcahBvXnZ98/PKIm4pkqLaz09oOy7zQR4IA="; + sha256 = "sha256-DnaPvZoDaegjtJNKBmCJEAZe5FQBnSER79FPnxiWQUE="; }; patches = [ @@ -72,8 +76,10 @@ let ./0055-pipewire-media-session-path.patch # Move installed tests into their own output. ./0070-installed-tests-path.patch - # Add flag to specify configuration directory (different from the installation directory). + # Add option for changing the config install directory ./0080-pipewire-config-dir.patch + # Remove output paths from the comments in the config templates to break dependency cycles + ./0090-pipewire-config-template-paths.patch ]; nativeBuildInputs = [ @@ -82,6 +88,7 @@ let meson ninja pkg-config + python3 ]; buildInputs = [ @@ -94,12 +101,15 @@ let udev vulkan-headers vulkan-loader + webrtc-audio-processing valgrind SDL2 systemd ] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ] ++ lib.optional ffmpegSupport ffmpeg - ++ lib.optionals bluezSupport [ bluez libopenaptx ldacbt sbc fdk_aac ]; + ++ lib.optionals bluezSupport [ bluez libopenaptx ldacbt sbc fdk_aac ] + ++ lib.optional pulseTunnelSupport libpulseaudio + ++ lib.optional zeroconfSupport avahi; mesonFlags = [ "-Ddocs=enabled" @@ -112,6 +122,8 @@ let "-Dmedia-session-prefix=${placeholder "mediaSession"}" "-Dlibjack-path=${placeholder "jack"}/lib" "-Dlibcamera=disabled" + "-Dlibpulse=${mesonEnable pulseTunnelSupport}" + "-Davahi=${mesonEnable zeroconfSupport}" "-Dgstreamer=${mesonEnable gstreamerSupport}" "-Dffmpeg=${mesonEnable ffmpegSupport}" "-Dbluez5=${mesonEnable bluezSupport}" @@ -119,24 +131,35 @@ let "-Dbluez5-backend-hfp-native=${mesonEnable nativeHfpSupport}" "-Dbluez5-backend-ofono=${mesonEnable ofonoSupport}" "-Dbluez5-backend-hsphfpd=${mesonEnable hsphfpdSupport}" - "-Dpipewire_config_dir=/etc/pipewire" + "-Dsysconfdir=/etc" + "-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire" ]; FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file doCheck = true; + postUnpack = '' + patchShebangs source/doc/strip-static.sh + patchShebangs source/spa/tests/gen-cpp-test.py + ''; + postInstall = '' - pushd . - cd $out + pushd $lib/share mkdir -p $out/nix-support/etc/pipewire - for f in etc/pipewire/*.conf; do bin/spa-json-dump "$f" > "$out/nix-support/$f.json"; done + for f in pipewire/*.conf; do + echo "Generating JSON from $f" + $out/bin/spa-json-dump "$f" > "$out/nix-support/etc/$f.json" + done mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d - for f in etc/pipewire/media-session.d/*.conf; do bin/spa-json-dump "$f" > "$mediaSession/nix-support/$f.json"; done + for f in pipewire/media-session.d/*.conf; do + echo "Generating JSON from $f" + $out/bin/spa-json-dump "$f" > "$mediaSession/nix-support/etc/$f.json" + done popd - moveToOutput "etc/pipewire/media-session.d/*.conf" "$mediaSession" + moveToOutput "share/pipewire/media-session.d/*.conf" "$mediaSession" moveToOutput "share/systemd/user/pipewire-media-session.*" "$mediaSession" moveToOutput "lib/systemd/user/pipewire-media-session.*" "$mediaSession" moveToOutput "bin/pipewire-media-session" "$mediaSession" @@ -155,6 +178,7 @@ let test-paths = callPackage ./test-paths.nix { paths-out = [ "share/alsa/alsa.conf.d/50-pipewire.conf" + "nix-support/etc/pipewire/client-rt.conf.json" "nix-support/etc/pipewire/client.conf.json" "nix-support/etc/pipewire/jack.conf.json" "nix-support/etc/pipewire/pipewire.conf.json" From c5a63ebf394ecc7c81c0c7e1a88508721958355a Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Fri, 11 Jun 2021 13:21:18 +0100 Subject: [PATCH 05/16] tectonic: 0.4.1 -> 0.5.2 --- pkgs/tools/typesetting/tectonic/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/typesetting/tectonic/default.nix b/pkgs/tools/typesetting/tectonic/default.nix index ba722837026d..dd92477d1739 100644 --- a/pkgs/tools/typesetting/tectonic/default.nix +++ b/pkgs/tools/typesetting/tectonic/default.nix @@ -3,16 +3,17 @@ rustPlatform.buildRustPackage rec { pname = "tectonic"; - version = "0.4.1"; + version = "0.5.2"; src = fetchFromGitHub { owner = "tectonic-typesetting"; repo = "tectonic"; rev = "tectonic@${version}"; - sha256 = "sha256-XQ3KRM12X80JPFMnQs//8ZJEv+AV1sr3BH0Nw/PH0HQ="; + fetchSubmodules = true; + sha256 = "sha256-JQ78N+cfk1D6xZixoUvYiLP6ZwovBn/ro1CZoutBwp8="; }; - cargoSha256 = "sha256-930tFAKMCmTFS9faIWLSVtWN/gAA9UAUMuRo61XISYA="; + cargoSha256 = "sha256-disJme0UM6U+yWjGsPya0xDvW6iQsipqMkEALeJ99xU="; nativeBuildInputs = [ pkg-config ]; From 606bf6dc17b6cdc5217a27d9bc703bc0f43f8c58 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Sun, 6 Jun 2021 13:11:11 -0700 Subject: [PATCH 06/16] doc/functions/generators: convert to CommonMark --- doc/functions.xml | 2 +- doc/functions/generators.section.md | 56 ++++++++++++++++++++++ doc/functions/generators.xml | 74 ----------------------------- 3 files changed, 57 insertions(+), 75 deletions(-) create mode 100644 doc/functions/generators.section.md delete mode 100644 doc/functions/generators.xml diff --git a/doc/functions.xml b/doc/functions.xml index dd91d705aa99..8ef530d307cd 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -7,7 +7,7 @@ The nixpkgs repository has several utility functions to manipulate Nix expressions. - + diff --git a/doc/functions/generators.section.md b/doc/functions/generators.section.md new file mode 100644 index 000000000000..bb8426d8087b --- /dev/null +++ b/doc/functions/generators.section.md @@ -0,0 +1,56 @@ +# Generators {#sec-generators} +Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: `INI`, `JSON` and `YAML` + +All generators follow a similar call interface: `generatorName configFunctions data`, where `configFunctions` is an attrset of user-defined functions that format nested parts of the content. They each have common defaults, so often they do not need to be set manually. An example is `mkSectionName ? (name: libStr.escape [ "[" "]" ] name)` from the `INI` generator. It receives the name of a section and sanitizes it. The default `mkSectionName` escapes `[` and `]` with a backslash. + +Generators can be fine-tuned to produce exactly the file format required by your application/service. One example is an INI-file format which uses `: ` as separator, the strings `"yes"`/`"no"` as boolean values and requires all string values to be quoted: + +```nix +with lib; +let + customToINI = generators.toINI { + # specifies how to format a key/value pair + mkKeyValue = generators.mkKeyValueDefault { + # specifies the generated string for a subset of nix values + mkValueString = v: + if v == true then ''"yes"'' + else if v == false then ''"no"'' + else if isString v then ''"${v}"'' + # and delegats all other values to the default generator + else generators.mkValueStringDefault {} v; + } ":"; + }; + +# the INI file can now be given as plain old nix values +in customToINI { + main = { + pushinfo = true; + autopush = false; + host = "localhost"; + port = 42; + }; + mergetool = { + merge = "diff3"; + }; +} +``` + +This will produce the following INI file as nix string: + +```INI +[main] +autopush:"no" +host:"localhost" +port:42 +pushinfo:"yes" +str\:ange:"very::strange" + +[mergetool] +merge:"diff3" +``` + +::: note +Nix store paths can be converted to strings by enclosing a derivation attribute like so: `"${drv}"`. +::: + +Detailed documentation for each generator can be found in `lib/generators.nix`. diff --git a/doc/functions/generators.xml b/doc/functions/generators.xml deleted file mode 100644 index 9ce1f85eb173..000000000000 --- a/doc/functions/generators.xml +++ /dev/null @@ -1,74 +0,0 @@ -
- Generators - - - Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: INI, JSON and YAML - - - - All generators follow a similar call interface: generatorName configFunctions data, where configFunctions is an attrset of user-defined functions that format nested parts of the content. They each have common defaults, so often they do not need to be set manually. An example is mkSectionName ? (name: libStr.escape [ "[" "]" ] name) from the INI generator. It receives the name of a section and sanitizes it. The default mkSectionName escapes [ and ] with a backslash. - - - - Generators can be fine-tuned to produce exactly the file format required by your application/service. One example is an INI-file format which uses : as separator, the strings "yes"/"no" as boolean values and requires all string values to be quoted: - - - -with lib; -let - customToINI = generators.toINI { - # specifies how to format a key/value pair - mkKeyValue = generators.mkKeyValueDefault { - # specifies the generated string for a subset of nix values - mkValueString = v: - if v == true then ''"yes"'' - else if v == false then ''"no"'' - else if isString v then ''"${v}"'' - # and delegats all other values to the default generator - else generators.mkValueStringDefault {} v; - } ":"; - }; - -# the INI file can now be given as plain old nix values -in customToINI { - main = { - pushinfo = true; - autopush = false; - host = "localhost"; - port = 42; - }; - mergetool = { - merge = "diff3"; - }; -} - - - - This will produce the following INI file as nix string: - - - -[main] -autopush:"no" -host:"localhost" -port:42 -pushinfo:"yes" -str\:ange:"very::strange" - -[mergetool] -merge:"diff3" - - - - - Nix store paths can be converted to strings by enclosing a derivation attribute like so: "${drv}". - - - - - Detailed documentation for each generator can be found in lib/generators.nix. - -
From d555585281829ba4eb007d0b83bae6cb721c5886 Mon Sep 17 00:00:00 2001 From: Michael Adler Date: Fri, 11 Jun 2021 15:33:11 +0200 Subject: [PATCH 07/16] zsh-autosuggestions: 0.6.4 -> 0.7.0 --- pkgs/shells/zsh/zsh-autosuggestions/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/shells/zsh/zsh-autosuggestions/default.nix b/pkgs/shells/zsh/zsh-autosuggestions/default.nix index f9502152277f..e261cdedc74b 100644 --- a/pkgs/shells/zsh/zsh-autosuggestions/default.nix +++ b/pkgs/shells/zsh/zsh-autosuggestions/default.nix @@ -4,13 +4,13 @@ stdenv.mkDerivation rec { pname = "zsh-autosuggestions"; - version = "0.6.4"; + version = "0.7.0"; src = fetchFromGitHub { owner = "zsh-users"; repo = "zsh-autosuggestions"; rev = "v${version}"; - sha256 = "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6"; + sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"; }; buildInputs = [ zsh ]; From 07864c64aa106b6f9223973e1e6187828c684ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Fri, 11 Jun 2021 16:16:12 +0200 Subject: [PATCH 08/16] nginxQuic: 12f18e0bca09 -> 1fec68e322d0 --- pkgs/servers/http/nginx/quic.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/http/nginx/quic.nix b/pkgs/servers/http/nginx/quic.nix index 38a4bd9cdf44..a8864864721e 100644 --- a/pkgs/servers/http/nginx/quic.nix +++ b/pkgs/servers/http/nginx/quic.nix @@ -6,8 +6,8 @@ callPackage ./generic.nix args { src = fetchhg { url = "https://hg.nginx.org/nginx-quic"; - rev = "12f18e0bca09"; # branch=quic - sha256 = "1lr6zlny26kamczgk8ddscmy5fp5mzxqcppwhjhvq1a029a0r4b7"; + rev = "1fec68e322d0"; # branch=quic + sha256 = "0nr1mjic215yc6liyv1kfwhfdija3q2sw3qdwibds5vkg330vmw8"; }; preConfigure = '' From 44055b455747c850bc3d2bcf5d87d068349efa6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 11 Jun 2021 16:18:20 +0200 Subject: [PATCH 09/16] nixos/manual: update documentation on Qt themes --- nixos/doc/manual/configuration/x-windows.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/configuration/x-windows.xml b/nixos/doc/manual/configuration/x-windows.xml index e72193897068..315ed3acf971 100644 --- a/nixos/doc/manual/configuration/x-windows.xml +++ b/nixos/doc/manual/configuration/x-windows.xml @@ -191,9 +191,12 @@ GTK themes can be installed either to user profile or system-wide (via environment.systemPackages). To make Qt 5 applications - look similar to GTK2 ones, you can install qt5.qtbase.gtk - package into your system environment. It should work for all Qt 5 library - versions. + look similar to GTK ones, you can use the following configuration: + + = true; + = "gtk2"; + = "gtk2"; + From 99f12af681ebd3369a72580cccddc317841765c5 Mon Sep 17 00:00:00 2001 From: Kerstin Humm Date: Mon, 31 May 2021 21:24:17 +0200 Subject: [PATCH 10/16] imagemagick: 6.9.12-12 -> 6.9.12-14 --- pkgs/applications/graphics/ImageMagick/6.x.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/graphics/ImageMagick/6.x.nix b/pkgs/applications/graphics/ImageMagick/6.x.nix index e8a882493688..5d9bc4fdd365 100644 --- a/pkgs/applications/graphics/ImageMagick/6.x.nix +++ b/pkgs/applications/graphics/ImageMagick/6.x.nix @@ -16,13 +16,13 @@ in stdenv.mkDerivation rec { pname = "imagemagick"; - version = "6.9.12-12"; + version = "6.9.12-14"; src = fetchFromGitHub { owner = "ImageMagick"; repo = "ImageMagick6"; rev = version; - sha256 = "sha256-yqMYuayQjPlTqi3+CtwP5CdsAGud/fHR0I2LwUPIq00="; + sha256 = "sha256-RK6N4koHVAqol16QXLFWUgI6N5Rph2QCIHxmDFs3Jfk="; }; outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big From ad502ab5c59a49eaf0c92f90201dffd4255a005a Mon Sep 17 00:00:00 2001 From: misuzu Date: Thu, 10 Jun 2021 23:19:08 +0300 Subject: [PATCH 11/16] nixos/sourcehut: automatically build and import qemu image for docker --- nixos/modules/services/misc/sourcehut/builds.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/sourcehut/builds.nix b/nixos/modules/services/misc/sourcehut/builds.nix index e228665784e0..a17a1010dbf7 100644 --- a/nixos/modules/services/misc/sourcehut/builds.nix +++ b/nixos/modules/services/misc/sourcehut/builds.nix @@ -48,7 +48,6 @@ in default = false; description = '' Run workers for builds.sr.ht. - Perform manually on machine: `cd ${scfg.statePath}/images; docker build -t qemu -f qemu/Dockerfile .` ''; }; @@ -161,6 +160,21 @@ in partOf = [ "buildsrht.service" ]; description = "builds.sr.ht worker service"; path = [ pkgs.openssh pkgs.docker ]; + preStart = let qemuPackage = pkgs.qemu_kvm; + in '' + if [[ "$(docker images -q qemu:latest 2> /dev/null)" == "" || "$(cat ${statePath}/docker-image-qemu 2> /dev/null || true)" != "${qemuPackage.version}" ]]; then + # Create and import qemu:latest image for docker + ${ + pkgs.dockerTools.streamLayeredImage { + name = "qemu"; + tag = "latest"; + contents = [ qemuPackage ]; + } + } | docker load + # Mark down current package version + printf "%s" "${qemuPackage.version}" > ${statePath}/docker-image-qemu + fi + ''; serviceConfig = { Type = "simple"; User = user; From ea5956a2ed03bcd34b6d269cbb6613db47d9a957 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 10 Jun 2021 15:08:34 -0700 Subject: [PATCH 12/16] nixos-rebuild: remove repair, never used --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index 7441be07af32..c47a3b7c522e 100644 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -24,7 +24,6 @@ fast= rollback= upgrade= upgrade_all= -repair= profile=/nix/var/nix/profiles/system buildHost= targetHost= @@ -60,10 +59,6 @@ while [ "$#" -gt 0 ]; do upgrade=1 upgrade_all=1 ;; - --repair) - repair=1 - extraBuildFlags+=("$i") - ;; --max-jobs|-j|--cores|-I|--builders) j="$1"; shift 1 extraBuildFlags+=("$i" "$j") From 0e8e7968d1528ed4df50d6b86e0079ba94ccaf63 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 10 Jun 2021 15:14:49 -0700 Subject: [PATCH 13/16] nixos-rebuild: prevent masking return value with declaration --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index c47a3b7c522e..85df4ffb44b8 100644 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -171,6 +171,7 @@ nixBuild() { else local instArgs=() local buildArgs=() + local drv= while [ "$#" -gt 0 ]; do local i="$1"; shift 1 @@ -197,7 +198,7 @@ nixBuild() { esac done - local drv="$(nix-instantiate "${instArgs[@]}" "${extraBuildFlags[@]}")" + drv="$(nix-instantiate "${instArgs[@]}" "${extraBuildFlags[@]}")" if [ -a "$drv" ]; then NIX_SSHOPTS=$SSHOPTS nix-copy-closure --to "$buildHost" "$drv" buildHostCmd nix-store -r "$drv" "${buildArgs[@]}" @@ -217,6 +218,8 @@ nixFlakeBuild() { shift 1 local evalArgs=() local buildArgs=() + local drv= + while [ "$#" -gt 0 ]; do local i="$1"; shift 1 case "$i" in @@ -238,7 +241,7 @@ nixFlakeBuild() { esac done - local drv="$(nix "${flakeFlags[@]}" eval --raw "${attr}.drvPath" "${evalArgs[@]}" "${extraBuildArgs[@]}")" + drv="$(nix "${flakeFlags[@]}" eval --raw "${attr}.drvPath" "${evalArgs[@]}" "${extraBuildArgs[@]}")" if [ -a "$drv" ]; then NIX_SSHOPTS=$SSHOPTS nix "${flakeFlags[@]}" copy --derivation --to "ssh://$buildHost" "$drv" buildHostCmd nix-store -r "$drv" "${buildArgs[@]}" From 07da819bcff7dccac8407698b5144decba81b571 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 10 Jun 2021 15:20:12 -0700 Subject: [PATCH 14/16] nixos-rebuild: prevent wordsplitting --- .../linux/nixos-rebuild/nixos-rebuild.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index 85df4ffb44b8..d574758b87ca 100644 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -308,7 +308,7 @@ fi if [[ -z $_NIXOS_REBUILD_REEXEC && -n $canRun && -z $fast && -z $flake ]]; then if p=$(nix-build --no-out-link --expr 'with import {}; config.system.build.nixos-rebuild' "${extraBuildFlags[@]}"); then export _NIXOS_REBUILD_REEXEC=1 - exec $p/bin/nixos-rebuild "${origArgs[@]}" + exec "$p/bin/nixos-rebuild" "${origArgs[@]}" exit 1 fi fi @@ -396,9 +396,9 @@ remotePATH= if [[ -n $buildNix && -z $flake ]]; then echo "building Nix..." >&2 nixDrv= - if ! nixDrv="$(nix-instantiate '' --add-root $tmpDir/nix.drv --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then - if ! nixDrv="$(nix-instantiate '' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then - if ! nixStorePath="$(nix-instantiate --eval '' -A $(nixSystem) | sed -e 's/^"//' -e 's/"$//')"; then + if ! nixDrv="$(nix-instantiate '' --add-root "$tmpDir/nix.drv" --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then + if ! nixDrv="$(nix-instantiate '' --add-root "$tmpDir/nix.drv" --indirect -A nix "${extraBuildFlags[@]}")"; then + if ! nixStorePath="$(nix-instantiate --eval '' -A "$(nixSystem)" | sed -e 's/^"//' -e 's/"$//')"; then nixStorePath="$(prebuiltNix "$(uname -m)")" fi if ! nix-store -r $nixStorePath --add-root $tmpDir/nix --indirect \ @@ -406,11 +406,11 @@ if [[ -n $buildNix && -z $flake ]]; then echo "warning: don't know how to get latest Nix" >&2 fi # Older version of nix-store -r don't support --add-root. - [ -e $tmpDir/nix ] || ln -sf $nixStorePath $tmpDir/nix + [ -e "$tmpDir/nix" ] || ln -sf "$nixStorePath" "$tmpDir/nix" if [ -n "$buildHost" ]; then remoteNixStorePath="$(prebuiltNix "$(buildHostCmd uname -m)")" remoteNix="$remoteNixStorePath/bin" - if ! buildHostCmd nix-store -r $remoteNixStorePath \ + if ! buildHostCmd nix-store -r "$remoteNixStorePath" \ --option extra-binary-caches https://cache.nixos.org/ >/dev/null; then remoteNix= echo "warning: don't know how to get latest Nix" >&2 @@ -419,7 +419,7 @@ if [[ -n $buildNix && -z $flake ]]; then fi fi if [ -a "$nixDrv" ]; then - nix-store -r "$nixDrv"'!'"out" --add-root $tmpDir/nix --indirect >/dev/null + nix-store -r "$nixDrv"'!'"out" --add-root "$tmpDir/nix" --indirect >/dev/null if [ -n "$buildHost" ]; then nix-copy-closure --to "$buildHost" "$nixDrv" # The nix build produces multiple outputs, we add them all to the remote path @@ -436,7 +436,7 @@ fi # nixos-version shows something useful). if [[ -n $canRun && -z $flake ]]; then if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then - suffix=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true) + suffix=$($SHELL "$nixpkgs/nixos/modules/installer/tools/get-version-suffix" "${extraBuildFlags[@]}" || true) if [ -n "$suffix" ]; then echo -n "$suffix" > "$nixpkgs/.version-suffix" || true fi @@ -509,7 +509,7 @@ fi # If we're not just building, then make the new configuration the boot # default and/or activate it now. if [ "$action" = switch -o "$action" = boot -o "$action" = test -o "$action" = dry-activate ]; then - if ! targetHostCmd $pathToConfig/bin/switch-to-configuration "$action"; then + if ! targetHostCmd "$pathToConfig/bin/switch-to-configuration" "$action"; then echo "warning: error(s) occurred while switching to the new configuration" >&2 exit 1 fi From d6a829e7b703cb0453685e6490edfaf9c3d84b67 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 10 Jun 2021 15:21:25 -0700 Subject: [PATCH 15/16] nixos-rebuild: remove unused variable: remotePATH --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index d574758b87ca..c8db9520b6b3 100644 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -391,8 +391,6 @@ prebuiltNix() { fi } -remotePATH= - if [[ -n $buildNix && -z $flake ]]; then echo "building Nix..." >&2 nixDrv= From 971eb043411eef0d6d3010cf9673a6a88fe101eb Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 10 Jun 2021 15:24:49 -0700 Subject: [PATCH 16/16] nixos-rebuild: fix extraBuildFlags usage with flakes --- pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh index c8db9520b6b3..5522fa6a4569 100644 --- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh +++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh @@ -241,7 +241,7 @@ nixFlakeBuild() { esac done - drv="$(nix "${flakeFlags[@]}" eval --raw "${attr}.drvPath" "${evalArgs[@]}" "${extraBuildArgs[@]}")" + drv="$(nix "${flakeFlags[@]}" eval --raw "${attr}.drvPath" "${evalArgs[@]}" "${extraBuildFlags[@]}")" if [ -a "$drv" ]; then NIX_SSHOPTS=$SSHOPTS nix "${flakeFlags[@]}" copy --derivation --to "ssh://$buildHost" "$drv" buildHostCmd nix-store -r "$drv" "${buildArgs[@]}"