nits: update `--replace` uses to `--replace-{fail,quiet}` as appropriate

This commit is contained in:
Colin 2024-03-24 12:49:18 +00:00
parent aed5ea4b2e
commit febedb9323
9 changed files with 21 additions and 20 deletions

View File

@ -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 # 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 \ 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 \ 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 '' '' + lib.optionalString cfg.config.preferEarpiece ''
# decrease the priority of the internal speaker so that sounds are routed # decrease the priority of the internal speaker so that sounds are routed
# to the earpiece by default. # to the earpiece by default.
# this is just personal preference. # this is just personal preference.
substituteInPlace ucm2/Allwinner/A64/PinePhone/* \ substituteInPlace ucm2/Allwinner/A64/PinePhone/{HiFi.conf,VoiceCall.conf} \
--replace 'PlaybackPriority 300' 'PlaybackPriority 100' --replace-fail 'PlaybackPriority 300' 'PlaybackPriority 100'
''; '';
}); });

View File

@ -21,12 +21,12 @@
# note that invoking bwrap with capabilities in the 'init' namespace does NOT grant the sandboxed process # 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 # capabilities in the 'init' namespace. it's a limitation of namespaces that namespaced processes can
# never receive capabilities in their parent namespace. # 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?");' \
'// die ("Unexpected capabilities but not setuid, old file caps config?");' '// die ("Unexpected capabilities but not setuid, old file caps config?");'
# enable debug printing # enable debug printing
# substituteInPlace utils.h --replace \ # substituteInPlace utils.h --replace-fail \
# '#define __debug__(x)' \ # '#define __debug__(x)' \
# '#define __debug__(x) printf x' # '#define __debug__(x) printf x'
''; '';

View File

@ -28,7 +28,7 @@ in
# - <https://github.com/diamondburned/dissent/issues/139> # - <https://github.com/diamondburned/dissent/issues/139>
# - <https://github.com/zalando/go-keyring/issues/46> # - <https://github.com/zalando/go-keyring/issues/46>
substituteInPlace vendor/github.com/zalando/go-keyring/secret_service/secret_service.go \ substituteInPlace vendor/github.com/zalando/go-keyring/secret_service/secret_service.go \
--replace '"login"' '"Default_keyring"' --replace-fail '"login"' '"Default_keyring"'
''; '';
}); });
sandbox.method = "bwrap"; sandbox.method = "bwrap";

View File

@ -25,7 +25,7 @@ let
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
substituteAll "$src" sane-sandboxed \ substituteAll "$src" sane-sandboxed \
--replace '@out@' "$out" --replace-fail '@out@' "$out"
runHook postBuild runHook postBuild
''; '';

View File

@ -48,10 +48,10 @@ in stdenv.mkDerivation {
# #
# alternative would be to patchShebangs in the node_modules dir. # alternative would be to patchShebangs in the node_modules dir.
substituteInPlace src/Makefile \ substituteInPlace src/Makefile \
--replace "yarn install" "true" \ --replace-fail "yarn install" "true" \
--replace ' $(PRETTIER)' ' node $(PRETTIER)' \ --replace-fail ' $(PRETTIER)' ' node $(PRETTIER)' \
--replace ' $(LESSC)' ' node $(LESSC)' \ --replace-fail ' $(LESSC)' ' node $(LESSC)' \
--replace ' $(BROWSERIFY)' ' node $(BROWSERIFY)' --replace-fail ' $(BROWSERIFY)' ' node $(BROWSERIFY)'
''; '';
preBuild = '' preBuild = ''

View File

@ -26,8 +26,8 @@ stdenv.mkDerivation rec {
# which avoids breaking manual updates # which avoids breaking manual updates
postPatch = '' postPatch = ''
substituteAllInPlace background.js \ substituteAllInPlace background.js \
--replace 'ext_api.runtime.openOptionsPage()' 'true' \ --replace-fail 'ext_api.runtime.openOptionsPage()' 'true' \
--replace ' fetch(' ' false && fetch(' --replace-fail ' fetch(' ' false && fetch('
''; '';
nativeBuildInputs = [ zip ]; nativeBuildInputs = [ zip ];

View File

@ -185,6 +185,7 @@ in (lib.makeScope newScope (self: with self; {
# (if you have one, feel free to share your nix package) # (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 # 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 \ substituteInPlace js/*.js \
--replace 'alreadyInstalled:!1' 'alreadyInstalled:!0' --replace 'alreadyInstalled:!1' 'alreadyInstalled:!0'
''; '';

View File

@ -106,9 +106,9 @@ let
# patch so meson will invoke our `crate2nix_cmd.sh` instead of cargo # patch so meson will invoke our `crate2nix_cmd.sh` instead of cargo
postPatch = '' postPatch = ''
substituteInPlace src/meson.build \ substituteInPlace src/meson.build \
--replace 'cargo_options,' "" \ --replace-fail 'cargo_options,' "" \
--replace "cargo, 'build'," "'bash', 'crate2nix_cmd.sh'," \ --replace-fail "cargo, 'build'," "'bash', 'crate2nix_cmd.sh'," \
--replace "'src' / rust_target" "'target/bin'" --replace-fail "'src' / rust_target" "'target/bin'"
''; '';
postConfigure = '' postConfigure = ''
# copied from <pkgs/development/tools/build-managers/meson/setup-hook.sh> # copied from <pkgs/development/tools/build-managers/meson/setup-hook.sh>
@ -318,7 +318,7 @@ let
# just update this patch to reflect the right-hand side # just update this patch to reflect the right-hand side
# CARGO_MANIFEST_LINKS = "ring_core_0_17_7"; # CARGO_MANIFEST_LINKS = "ring_core_0_17_7";
postPatch = (attrs.postPatch or "") + '' 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();' 'links = std::env::var("CARGO_MANIFEST_LINKS").unwrap();' 'links = "ring_core_0_17_7".to_string();'
''; '';
}; };

View File

@ -485,8 +485,8 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
# patch for newer openssl # patch for newer openssl
substituteInPlace --fail base/ffi/crypto.lua \ substituteInPlace base/ffi/crypto.lua \
--replace 'ffi.load("libs/libcrypto.so.1.1")' 'ffi.load("libcrypto.so")' --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 # 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. # instead of just via $out/libs. this is required whenever we direct KOreader to use system libs instead of its vendored libs.