about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorYueh-Shun Li <shamrocklee@posteo.net>2023-10-21 02:35:38 +0800
committerGitHub <noreply@github.com>2023-10-20 14:35:38 -0400
commit872fe27639c12600432eb2011f9e9f1d83148b55 (patch)
treee450df6c905aed8dd38e0bf730223ec1eb25c788 /pkgs/tools
parent1542bb6ef545ec47a35907d7fb293e4f31514a38 (diff)
voms, xrootd: clean up $out/etc.orig (#241466)
When externalEtc is not null, create an extra output "etc" and move the
"$out/etc" content into "$etc/etc" before creating the symlink at
"$out/etc".
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/networking/voms/default.nix15
-rw-r--r--pkgs/tools/networking/xrootd/default.nix5
2 files changed, 11 insertions, 9 deletions
diff --git a/pkgs/tools/networking/voms/default.nix b/pkgs/tools/networking/voms/default.nix
index a16648b9a8337..cafc812032b7a 100644
--- a/pkgs/tools/networking/voms/default.nix
+++ b/pkgs/tools/networking/voms/default.nix
@@ -13,7 +13,8 @@
 , zlib
   # Configuration overridable with .override
   # If not null, the builder will
-  # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc.
+  # create a new output "etc", move "$out/etc" to "$etc/etc"
+  # and symlink "$out/etc" to externalEtc.
 , externalEtc ? "/etc"
 }:
 
@@ -46,7 +47,8 @@ stdenv.mkDerivation rec{
     zlib
   ];
 
-  outputs = [ "bin" "out" "dev" "man" ];
+  outputs = [ "bin" "out" "dev" "man" ]
+    ++ lib.optional (externalEtc != null) "etc";
 
   preAutoreconf = ''
     mkdir -p aux src/autogen
@@ -65,13 +67,12 @@ stdenv.mkDerivation rec{
 
   configureFlags = [
     "--with-gsoap-wsdl2h=${gsoap}/bin/wsdl2h"
+    "--sysconfdir=${placeholder "out"}/etc"
   ];
 
-  postFixup = ''
-    ${lib.optionalString (externalEtc != null) ''
-      mv "$out"/etc{,.orig}
-      ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
-    ''}
+  postFixup = lib.optionalString (externalEtc != null) ''
+    moveToOutput etc "$etc"
+    ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
   '';
 
   meta = with lib; {
diff --git a/pkgs/tools/networking/xrootd/default.nix b/pkgs/tools/networking/xrootd/default.nix
index 47496173642c6..e32139fdfcebd 100644
--- a/pkgs/tools/networking/xrootd/default.nix
+++ b/pkgs/tools/networking/xrootd/default.nix
@@ -39,7 +39,8 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-SLmxv8opN7z4V07S9kLGo8HG7Ql62iZQLtf3zGemwA8=";
   };
 
-  outputs = [ "bin" "out" "dev" "man" ];
+  outputs = [ "bin" "out" "dev" "man" ]
+  ++ lib.optional (externalEtc != null) "etc";
 
   passthru.fetchxrd = callPackage ./fetchxrd.nix { xrootd = finalAttrs.finalPackage; };
   passthru.tests =
@@ -118,7 +119,7 @@ stdenv.mkDerivation (finalAttrs: {
       wrapProgram "$FILE" "''${makeWrapperArgs[@]}"
     done < <(find "$bin/bin" -mindepth 1 -maxdepth 1 -type f,l -perm -a+x)
   '' + lib.optionalString (externalEtc != null) ''
-    mv "$out"/etc{,.orig}
+    moveToOutput etc "$etc"
     ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
   '';