substituteAll: disallow invalid arguments, fix plasma-workspace (#350039)
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
{ stdenvNoCC }:
|
||||
|
||||
args:
|
||||
|
||||
{ lib, stdenvNoCC }:
|
||||
# see the substituteAll in the nixpkgs documentation for usage and constraints
|
||||
stdenvNoCC.mkDerivation ({
|
||||
name = if args ? name then args.name else baseNameOf (toString args.src);
|
||||
builder = ./substitute-all.sh;
|
||||
inherit (args) src;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
} // args)
|
||||
args:
|
||||
let
|
||||
# keep this in sync with substituteAll
|
||||
isInvalidArgName = x: builtins.match "^[a-z][a-zA-Z0-9_]*$" x == null;
|
||||
invalidArgs = builtins.filter isInvalidArgName (builtins.attrNames args);
|
||||
in
|
||||
if invalidArgs == [] then
|
||||
stdenvNoCC.mkDerivation ({
|
||||
name = if args ? name then args.name else baseNameOf (toString args.src);
|
||||
builder = ./substitute-all.sh;
|
||||
inherit (args) src;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
} // args)
|
||||
else throw ''
|
||||
Argument names for `pkgs.substituteAll` must:
|
||||
- start with a lower case ASCII letter
|
||||
- only contain ASCII letters, digits and underscores
|
||||
Found invalid argument names: ${lib.concatStringsSep ", " invalidArgs}.
|
||||
''
|
||||
|
||||
@@ -35,10 +35,10 @@ diff -Naur cron-old/pathnames.h cron-new/pathnames.h
|
||||
+#define _PATH_SENDMAIL "@sendmailPath@"
|
||||
+
|
||||
+#undef _PATH_VI
|
||||
+#define _PATH_VI "@VIPATH@"
|
||||
+#define _PATH_VI "@viPath@"
|
||||
+
|
||||
+#undef _PATH_DEFPATH
|
||||
+#define _PATH_DEFPATH "@DEFPATH@"
|
||||
+#define _PATH_DEFPATH "@defPath@"
|
||||
+
|
||||
+/* Nixpkgs-specific patch end */
|
||||
+
|
||||
|
||||
@@ -20,8 +20,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
(substituteAll {
|
||||
src = ./0000-nixpkgs-specific.diff;
|
||||
inherit sendmailPath;
|
||||
VIPATH = lib.getExe' vim "vim";
|
||||
DEFPATH = lib.concatStringsSep ":" [
|
||||
viPath = lib.getExe' vim "vim";
|
||||
defPath = lib.concatStringsSep ":" [
|
||||
"/run/wrappers/bin"
|
||||
"/nix/var/nix/profiles/default/bin"
|
||||
"/run/current-system/sw/bin"
|
||||
|
||||
@@ -12,7 +12,7 @@ index 4a21b94..0ac7911 100644
|
||||
- ${PROJECT_SOURCE_DIR}/third_party/antlr4/runtime/Cpp/runtime/src
|
||||
+ @libargs@/include
|
||||
+ @catch2@/include
|
||||
+ @yaml-cpp@/include
|
||||
+ @yamlCpp@/include
|
||||
+ @antlr4RuntimeCpp@/include/antlr4-runtime
|
||||
${PROJECT_SOURCE_DIR}/src/
|
||||
)
|
||||
|
||||
@@ -27,7 +27,8 @@ stdenv.mkDerivation rec {
|
||||
(substituteAll {
|
||||
src = ./fix-lib-paths.patch;
|
||||
antlr4RuntimeCpp = antlr4.runtime.cpp.dev;
|
||||
inherit libargs catch2 yaml-cpp;
|
||||
yamlCpp = yaml-cpp;
|
||||
inherit libargs catch2;
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!@runtimeShell@
|
||||
|
||||
@fish@/bin/fish \
|
||||
@OMF@/share/oh-my-fish/bin/install \
|
||||
@omf@/share/oh-my-fish/bin/install \
|
||||
--noninteractive \
|
||||
--offline=@OMF@/share/oh-my-fish
|
||||
--offline=@omf@/share/oh-my-fish
|
||||
|
||||
@@ -39,7 +39,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
cp -v ${substituteAll {
|
||||
name = "omf-install";
|
||||
src = ./omf-install;
|
||||
OMF = placeholder "out";
|
||||
omf = placeholder "out";
|
||||
inherit fish runtimeShell;
|
||||
}} $out/bin/omf-install
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ super: lib.trivial.pipe super [
|
||||
nativeBuildInputs = [ wrapGAppsHook3 ];
|
||||
patches = [
|
||||
(substituteAll {
|
||||
inherit gjs util-linux xdg-utils;
|
||||
inherit gjs;
|
||||
util_linux = util-linux;
|
||||
xdg_utils = xdg-utils;
|
||||
src = ./extensionOverridesPatches/gtk4-ding_at_smedius.gitlab.com.patch;
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ index b5877ed..455167c 100644
|
||||
QString provider = providerString;
|
||||
|
||||
- query.setFocus(QUrl("/usr/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
+ query.setFocus(QUrl("@mobile-broadband-provider-info@/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
+ query.setFocus(QUrl("@mobileBroadbandProviderInfo@/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
|
||||
if (provider.contains("\'")) {
|
||||
provider = provider.replace("\'", "'");
|
||||
@@ -25,7 +25,7 @@ index b5877ed..455167c 100644
|
||||
#ifdef QOFONO_PROVISIONING
|
||||
QXmlQuery query;
|
||||
- query.setFocus(QUrl("/usr/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
+ query.setFocus(QUrl("@mobile-broadband-provider-info@/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
+ query.setFocus(QUrl("@mobileBroadbandProviderInfo@/share/mobile-broadband-provider-info/serviceproviders.xml"));
|
||||
|
||||
QString providerStr = provider;
|
||||
if (providerStr.contains("\'")) {
|
||||
|
||||
@@ -23,7 +23,7 @@ mkDerivation rec {
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./0001-NixOS-provide-mobile-broadband-provider-info-path.patch;
|
||||
inherit mobile-broadband-provider-info;
|
||||
mobileBroadbandProviderInfo = mobile-broadband-provider-info;
|
||||
})
|
||||
./0001-NixOS-Skip-tests-they-re-shock-full-of-hardcoded-FHS.patch
|
||||
];
|
||||
|
||||
@@ -24,8 +24,8 @@ mkKdeDerivation {
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./dependency-paths.patch;
|
||||
dbus-send = lib.getExe' dbus "dbus-send";
|
||||
fc-match = lib.getExe' fontconfig "fc-match";
|
||||
dbusSend = lib.getExe' dbus "dbus-send";
|
||||
fcMatch = lib.getExe' fontconfig "fc-match";
|
||||
lsof = lib.getExe lsof;
|
||||
qdbus = lib.getExe' qttools "qdbus";
|
||||
xmessage = lib.getExe xorg.xmessage;
|
||||
|
||||
@@ -46,7 +46,7 @@ index f5034455c9..8ea57813a1 100644
|
||||
connect(m_proc, &QProcess::readyReadStandardOutput, this, &CFcQuery::data);
|
||||
|
||||
- m_proc->start(u"fc-match"_s, args);
|
||||
+ m_proc->start(u"@fc-match@"_s, args);
|
||||
+ m_proc->start(u"@fcMatch@"_s, args);
|
||||
}
|
||||
|
||||
void CFcQuery::procExited()
|
||||
@@ -143,5 +143,5 @@ index 1e903130a9..1d807a8526 100644
|
||||
[Service]
|
||||
Type=oneshot
|
||||
-ExecStart=dbus-send --session --reply-timeout=1 --type=method_call --dest=org.kde.KSplash /KSplash org.kde.KSplash.setStage string:ready
|
||||
+ExecStart=@dbus-send@ --session --reply-timeout=1 --type=method_call --dest=org.kde.KSplash /KSplash org.kde.KSplash.setStage string:ready
|
||||
+ExecStart=@dbusSend@ --session --reply-timeout=1 --type=method_call --dest=org.kde.KSplash /KSplash org.kde.KSplash.setStage string:ready
|
||||
Slice=session.slice
|
||||
|
||||
Reference in New Issue
Block a user