]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Remove private specificities from pure-ftpd package and lib
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 27 May 2019 22:34:01 +0000 (00:34 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 27 May 2019 22:39:25 +0000 (00:39 +0200)
lib/default.nix
lib/private/default.nix [new file with mode: 0644]
modules/private/ftp.nix
pkgs/pure-ftpd/default.nix
scripts/make-nur

index 1baee1f53e79cea08a6611fc87a28ead8e247520..6b3dfdf47fff4f964ec9ef7ea0cb8152fbcc7b5f 100644 (file)
@@ -61,22 +61,4 @@ rec {
         makeWrapper "$f" "$out" ${toString args}
       '';
 
-  # This adds header colors to the builds, but it rebuilds the whole
-  # world from scratch, so only use it to debug!
-  # add it as postHook in derivations
-  immaePostHook = ''
-    header() {
-      echo -ne "\033[1;36m"
-      echo -n "$1"
-      echo -e "\033[0m"
-    }
-
-    echoCmd() {
-      printf "\033[1;34m%s:\033[0m" "$1"
-      shift
-      printf ' %q' "$@"
-      echo
-    }
-  '';
-
-} // (if builtins.pathExists ./lib/private then import ./lib/private else {})
+} // (if builtins.pathExists ./private then callPackage ./private {} else {})
diff --git a/lib/private/default.nix b/lib/private/default.nix
new file mode 100644 (file)
index 0000000..c7d753a
--- /dev/null
@@ -0,0 +1,20 @@
+{}:
+{
+  # This adds header colors to the builds, but it rebuilds the whole
+  # world from scratch, so only use it to debug!
+  # add it as postHook in derivations
+  immaePostHook = ''
+    header() {
+      echo -ne "\033[1;36m"
+      echo -n "$1"
+      echo -e "\033[0m"
+    }
+
+    echoCmd() {
+      printf "\033[1;34m%s:\033[0m" "$1"
+      shift
+      printf ' %q' "$@"
+      echo
+    }
+  '';
+}
index 842d2d6540bbe65d0347c3989d0f243a24884b9f..ada5f416bed9ca0d82a68c72883986d48491fe57 100644 (file)
@@ -1,4 +1,7 @@
 { lib, pkgs, config, myconfig, ... }:
+let
+  package = pkgs.pure-ftpd.override { ldapFtpId = "immaeFtp"; };
+in
 {
   options = {
     services.pure-ftpd.enable = lib.mkOption {
       wantedBy = [ "multi-user.target" ];
       after = [ "network.target" ];
 
-      serviceConfig.ExecStart = "${pkgs.pure-ftpd}/bin/pure-ftpd ${configFile}";
+      serviceConfig.ExecStart = "${package}/bin/pure-ftpd ${configFile}";
       serviceConfig.Type = "forking";
       serviceConfig.PIDFile = "/run/pure-ftpd.pid";
     };
index 37ce6952c538bd3b21b2bdd099932a0c89769e8f..32a7a91e050da1dba37d02f2d916b35edb094d7b 100644 (file)
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, openssl, postgresql, openldap }:
+{ ldapFtpId ? null
+, stdenv, fetchurl, openssl, postgresql, openldap }:
 
 stdenv.mkDerivation rec {
   name = "pure-ftpd-1.0.47";
@@ -8,9 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "1b97ixva8m10vln8xrfwwwzi344bkgxqji26d0nrm1yzylbc6h27";
   };
 
-  preConfigure = ''
-    sed -i -e "s#FTPuid#immaeFtpUid#" src/log_ldap.h
-    sed -i -e "s#FTPgid#immaeFtpGid#" src/log_ldap.h
+  preConfigure = stdenv.lib.optionalString (!isNull ldapFtpId) ''
+    sed -i -e "s#FTPuid#${ldapFtpId}Uid#" src/log_ldap.h
+    sed -i -e "s#FTPgid#${ldapFtpId}Gid#" src/log_ldap.h
     '';
   postConfigure = ''
     sed -i 's/define MAX_DATA_SIZE (40/define MAX_DATA_SIZE (70/' src/ftpd.h
index 6766d95b140dfe2464bee2fc3f6383851a59f325..1fe5f7a0514700d1a0a159dc1c6d0c219913fd9f 100755 (executable)
@@ -17,14 +17,14 @@ first_commit="5145061e9b679ea1e5d2709d22d0ee53467fed15"
 git rebase --onto=$nur_root $first_commit master
 
 clean_folder='
-  rm -rf config modules/private pkgs/private nixops
-  for bad in pkgs/crypto/cardano/default.nix; do
-    if [ -f $bad ]; then
-      rm -f $bad
-      cat > $bad <<-EOF
-        { runCommand, mylibs }:
-        runCommand "empty" { preferLocalBuild = true; } "mkdir -p \$out"
-EOF
+  rm -rf config lib/private modules/private pkgs/private nixops
+  for broken in pkgs/crypto/cardano/default.nix; do
+    if [ -f $broken ]; then
+      rm -f $broken
+      cat > $broken <<-EOF
+       { runCommand, mylibs }:
+       runCommand "empty" { preferLocalBuild = true; } "mkdir -p \$out"
+       EOF
     fi
   done
 '