Unverified Commit 2a958390 authored by K900's avatar K900 Committed by GitHub
Browse files

substituteAll: disallow invalid arguments, fix plasma-workspace (#350039)

parents 926039f1 05624e48
Loading
Loading
Loading
Loading
+21 −11
Original line number Diff line number Diff line
{ stdenvNoCC }:

args:

{ lib, stdenvNoCC }:
# see the substituteAll in the nixpkgs documentation for usage and constraints
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;
@@ -10,3 +14,9 @@ stdenvNoCC.mkDerivation ({
      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}.
  ''
+2 −2
Original line number Diff line number Diff line
@@ -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 */
+
+2 −2
Original line number Diff line number Diff line
@@ -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"
+1 −1
Original line number Diff line number Diff line
@@ -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/
   )
+2 −1
Original line number Diff line number Diff line
@@ -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;
    })
  ];

Loading