From febedb9323aaec6d918d36920103db28d2a74eb2 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 24 Mar 2024 12:49:18 +0000 Subject: [PATCH] nits: update `--replace` uses to `--replace-{fail,quiet}` as appropriate --- hosts/common/programs/alsa-ucm-conf/default.nix | 8 ++++---- hosts/common/programs/bubblewrap.nix | 4 ++-- hosts/common/programs/dissent.nix | 2 +- modules/programs/sane-sandboxed.nix | 2 +- .../firefox-extensions/browserpass-extension/default.nix | 8 ++++---- .../firefox-extensions/bypass-paywalls-clean/default.nix | 4 ++-- pkgs/additional/firefox-extensions/default.nix | 1 + pkgs/additional/fractal-nixified/default.nix | 8 ++++---- pkgs/additional/koreader-from-src/default.nix | 4 ++-- 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/hosts/common/programs/alsa-ucm-conf/default.nix b/hosts/common/programs/alsa-ucm-conf/default.nix index 1a180aa5..5fd177fd 100644 --- a/hosts/common/programs/alsa-ucm-conf/default.nix +++ b/hosts/common/programs/alsa-ucm-conf/default.nix @@ -35,15 +35,15 @@ in # fix the self-contained ucm files i source from to have correct path within the alsa-ucm-conf source tree substituteInPlace ucm2/Allwinner/A64/PinePhone/PinePhone.conf \ - --replace 'HiFi.conf' '/Allwinner/A64/PinePhone/HiFi.conf' + --replace-fail 'HiFi.conf' '/Allwinner/A64/PinePhone/HiFi.conf' substituteInPlace ucm2/Allwinner/A64/PinePhone/PinePhone.conf \ - --replace 'VoiceCall.conf' '/Allwinner/A64/PinePhone/VoiceCall.conf' + --replace-fail 'VoiceCall.conf' '/Allwinner/A64/PinePhone/VoiceCall.conf' '' + lib.optionalString cfg.config.preferEarpiece '' # decrease the priority of the internal speaker so that sounds are routed # to the earpiece by default. # this is just personal preference. - substituteInPlace ucm2/Allwinner/A64/PinePhone/* \ - --replace 'PlaybackPriority 300' 'PlaybackPriority 100' + substituteInPlace ucm2/Allwinner/A64/PinePhone/{HiFi.conf,VoiceCall.conf} \ + --replace-fail 'PlaybackPriority 300' 'PlaybackPriority 100' ''; }); diff --git a/hosts/common/programs/bubblewrap.nix b/hosts/common/programs/bubblewrap.nix index 25fb4124..b46c6f32 100644 --- a/hosts/common/programs/bubblewrap.nix +++ b/hosts/common/programs/bubblewrap.nix @@ -21,12 +21,12 @@ # note that invoking bwrap with capabilities in the 'init' namespace does NOT grant the sandboxed process # capabilities in the 'init' namespace. it's a limitation of namespaces that namespaced processes can # never receive capabilities in their parent namespace. - substituteInPlace bubblewrap.c --replace \ + substituteInPlace bubblewrap.c --replace-fail \ 'die ("Unexpected capabilities but not setuid, old file caps config?");' \ '// die ("Unexpected capabilities but not setuid, old file caps config?");' # enable debug printing - # substituteInPlace utils.h --replace \ + # substituteInPlace utils.h --replace-fail \ # '#define __debug__(x)' \ # '#define __debug__(x) printf x' ''; diff --git a/hosts/common/programs/dissent.nix b/hosts/common/programs/dissent.nix index 4d999193..66865a27 100644 --- a/hosts/common/programs/dissent.nix +++ b/hosts/common/programs/dissent.nix @@ -28,7 +28,7 @@ in # - # - substituteInPlace vendor/github.com/zalando/go-keyring/secret_service/secret_service.go \ - --replace '"login"' '"Default_keyring"' + --replace-fail '"login"' '"Default_keyring"' ''; }); sandbox.method = "bwrap"; diff --git a/modules/programs/sane-sandboxed.nix b/modules/programs/sane-sandboxed.nix index 973ced77..55d56cda 100644 --- a/modules/programs/sane-sandboxed.nix +++ b/modules/programs/sane-sandboxed.nix @@ -25,7 +25,7 @@ let buildPhase = '' runHook preBuild substituteAll "$src" sane-sandboxed \ - --replace '@out@' "$out" + --replace-fail '@out@' "$out" runHook postBuild ''; diff --git a/pkgs/additional/firefox-extensions/browserpass-extension/default.nix b/pkgs/additional/firefox-extensions/browserpass-extension/default.nix index dacb4df1..24b45976 100644 --- a/pkgs/additional/firefox-extensions/browserpass-extension/default.nix +++ b/pkgs/additional/firefox-extensions/browserpass-extension/default.nix @@ -48,10 +48,10 @@ in stdenv.mkDerivation { # # alternative would be to patchShebangs in the node_modules dir. substituteInPlace src/Makefile \ - --replace "yarn install" "true" \ - --replace ' $(PRETTIER)' ' node $(PRETTIER)' \ - --replace ' $(LESSC)' ' node $(LESSC)' \ - --replace ' $(BROWSERIFY)' ' node $(BROWSERIFY)' + --replace-fail "yarn install" "true" \ + --replace-fail ' $(PRETTIER)' ' node $(PRETTIER)' \ + --replace-fail ' $(LESSC)' ' node $(LESSC)' \ + --replace-fail ' $(BROWSERIFY)' ' node $(BROWSERIFY)' ''; preBuild = '' diff --git a/pkgs/additional/firefox-extensions/bypass-paywalls-clean/default.nix b/pkgs/additional/firefox-extensions/bypass-paywalls-clean/default.nix index 43bacc2d..1818109c 100644 --- a/pkgs/additional/firefox-extensions/bypass-paywalls-clean/default.nix +++ b/pkgs/additional/firefox-extensions/bypass-paywalls-clean/default.nix @@ -26,8 +26,8 @@ stdenv.mkDerivation rec { # which avoids breaking manual updates postPatch = '' substituteAllInPlace background.js \ - --replace 'ext_api.runtime.openOptionsPage()' 'true' \ - --replace ' fetch(' ' false && fetch(' + --replace-fail 'ext_api.runtime.openOptionsPage()' 'true' \ + --replace-fail ' fetch(' ' false && fetch(' ''; nativeBuildInputs = [ zip ]; diff --git a/pkgs/additional/firefox-extensions/default.nix b/pkgs/additional/firefox-extensions/default.nix index 9186c239..90760967 100644 --- a/pkgs/additional/firefox-extensions/default.nix +++ b/pkgs/additional/firefox-extensions/default.nix @@ -185,6 +185,7 @@ in (lib.makeScope newScope (self: with self; { # (if you have one, feel free to share your nix package) # # NB: in source this is `alreadyInstalled: false`, but the build process hates Booleans or something + # TODO(2024/03/23): this is broken (replacement doesn't match). but maybe not necessary anymore? substituteInPlace js/*.js \ --replace 'alreadyInstalled:!1' 'alreadyInstalled:!0' ''; diff --git a/pkgs/additional/fractal-nixified/default.nix b/pkgs/additional/fractal-nixified/default.nix index 3f21635a..9a67a24d 100644 --- a/pkgs/additional/fractal-nixified/default.nix +++ b/pkgs/additional/fractal-nixified/default.nix @@ -106,9 +106,9 @@ let # patch so meson will invoke our `crate2nix_cmd.sh` instead of cargo postPatch = '' substituteInPlace src/meson.build \ - --replace 'cargo_options,' "" \ - --replace "cargo, 'build'," "'bash', 'crate2nix_cmd.sh'," \ - --replace "'src' / rust_target" "'target/bin'" + --replace-fail 'cargo_options,' "" \ + --replace-fail "cargo, 'build'," "'bash', 'crate2nix_cmd.sh'," \ + --replace-fail "'src' / rust_target" "'target/bin'" ''; postConfigure = '' # copied from @@ -318,7 +318,7 @@ let # just update this patch to reflect the right-hand side # CARGO_MANIFEST_LINKS = "ring_core_0_17_7"; postPatch = (attrs.postPatch or "") + '' - substituteInPlace build.rs --replace \ + substituteInPlace build.rs --replace-fail \ 'links = std::env::var("CARGO_MANIFEST_LINKS").unwrap();' 'links = "ring_core_0_17_7".to_string();' ''; }; diff --git a/pkgs/additional/koreader-from-src/default.nix b/pkgs/additional/koreader-from-src/default.nix index 50ab0451..b88f5d1c 100644 --- a/pkgs/additional/koreader-from-src/default.nix +++ b/pkgs/additional/koreader-from-src/default.nix @@ -485,8 +485,8 @@ stdenv.mkDerivation rec { postPatch = '' # patch for newer openssl - substituteInPlace --fail base/ffi/crypto.lua \ - --replace 'ffi.load("libs/libcrypto.so.1.1")' 'ffi.load("libcrypto.so")' + substituteInPlace base/ffi/crypto.lua \ + --replace-fail 'ffi.load("libs/libcrypto.so.1.1")' 'ffi.load("libcrypto.so")' # dlopen libraries by name only, allowing them to be found via LD_LIBRARY_PATH # instead of just via $out/libs. this is required whenever we direct KOreader to use system libs instead of its vendored libs.