diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-28 00:34:01 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-28 00:39:25 +0200 |
commit | fe696f35f5e0789d4bc448bca4bbaf93d1182175 (patch) | |
tree | 4b69c0186f4bf6cbaa8711feb073dff2a5ade43b | |
parent | 4506dbe51901f66406a02042b2097b3b3856e8a6 (diff) | |
download | Nix-fe696f35f5e0789d4bc448bca4bbaf93d1182175.tar.gz Nix-fe696f35f5e0789d4bc448bca4bbaf93d1182175.tar.zst Nix-fe696f35f5e0789d4bc448bca4bbaf93d1182175.zip |
Remove private specificities from pure-ftpd package and lib
-rw-r--r-- | lib/default.nix | 20 | ||||
-rw-r--r-- | lib/private/default.nix | 20 | ||||
-rw-r--r-- | modules/private/ftp.nix | 5 | ||||
-rw-r--r-- | pkgs/pure-ftpd/default.nix | 9 | ||||
-rwxr-xr-x | scripts/make-nur | 16 |
5 files changed, 38 insertions, 32 deletions
diff --git a/lib/default.nix b/lib/default.nix index 1baee1f..6b3dfdf 100644 --- a/lib/default.nix +++ b/lib/default.nix | |||
@@ -61,22 +61,4 @@ rec { | |||
61 | makeWrapper "$f" "$out" ${toString args} | 61 | makeWrapper "$f" "$out" ${toString args} |
62 | ''; | 62 | ''; |
63 | 63 | ||
64 | # This adds header colors to the builds, but it rebuilds the whole | 64 | } // (if builtins.pathExists ./private then callPackage ./private {} else {}) |
65 | # world from scratch, so only use it to debug! | ||
66 | # add it as postHook in derivations | ||
67 | immaePostHook = '' | ||
68 | header() { | ||
69 | echo -ne "\033[1;36m" | ||
70 | echo -n "$1" | ||
71 | echo -e "\033[0m" | ||
72 | } | ||
73 | |||
74 | echoCmd() { | ||
75 | printf "\033[1;34m%s:\033[0m" "$1" | ||
76 | shift | ||
77 | printf ' %q' "$@" | ||
78 | echo | ||
79 | } | ||
80 | ''; | ||
81 | |||
82 | } // (if builtins.pathExists ./lib/private then import ./lib/private else {}) | ||
diff --git a/lib/private/default.nix b/lib/private/default.nix new file mode 100644 index 0000000..c7d753a --- /dev/null +++ b/lib/private/default.nix | |||
@@ -0,0 +1,20 @@ | |||
1 | {}: | ||
2 | { | ||
3 | # This adds header colors to the builds, but it rebuilds the whole | ||
4 | # world from scratch, so only use it to debug! | ||
5 | # add it as postHook in derivations | ||
6 | immaePostHook = '' | ||
7 | header() { | ||
8 | echo -ne "\033[1;36m" | ||
9 | echo -n "$1" | ||
10 | echo -e "\033[0m" | ||
11 | } | ||
12 | |||
13 | echoCmd() { | ||
14 | printf "\033[1;34m%s:\033[0m" "$1" | ||
15 | shift | ||
16 | printf ' %q' "$@" | ||
17 | echo | ||
18 | } | ||
19 | ''; | ||
20 | } | ||
diff --git a/modules/private/ftp.nix b/modules/private/ftp.nix index 842d2d6..ada5f41 100644 --- a/modules/private/ftp.nix +++ b/modules/private/ftp.nix | |||
@@ -1,4 +1,7 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | 1 | { lib, pkgs, config, myconfig, ... }: |
2 | let | ||
3 | package = pkgs.pure-ftpd.override { ldapFtpId = "immaeFtp"; }; | ||
4 | in | ||
2 | { | 5 | { |
3 | options = { | 6 | options = { |
4 | services.pure-ftpd.enable = lib.mkOption { | 7 | services.pure-ftpd.enable = lib.mkOption { |
@@ -109,7 +112,7 @@ | |||
109 | wantedBy = [ "multi-user.target" ]; | 112 | wantedBy = [ "multi-user.target" ]; |
110 | after = [ "network.target" ]; | 113 | after = [ "network.target" ]; |
111 | 114 | ||
112 | serviceConfig.ExecStart = "${pkgs.pure-ftpd}/bin/pure-ftpd ${configFile}"; | 115 | serviceConfig.ExecStart = "${package}/bin/pure-ftpd ${configFile}"; |
113 | serviceConfig.Type = "forking"; | 116 | serviceConfig.Type = "forking"; |
114 | serviceConfig.PIDFile = "/run/pure-ftpd.pid"; | 117 | serviceConfig.PIDFile = "/run/pure-ftpd.pid"; |
115 | }; | 118 | }; |
diff --git a/pkgs/pure-ftpd/default.nix b/pkgs/pure-ftpd/default.nix index 37ce695..32a7a91 100644 --- a/pkgs/pure-ftpd/default.nix +++ b/pkgs/pure-ftpd/default.nix | |||
@@ -1,4 +1,5 @@ | |||
1 | { stdenv, fetchurl, openssl, postgresql, openldap }: | 1 | { ldapFtpId ? null |
2 | , stdenv, fetchurl, openssl, postgresql, openldap }: | ||
2 | 3 | ||
3 | stdenv.mkDerivation rec { | 4 | stdenv.mkDerivation rec { |
4 | name = "pure-ftpd-1.0.47"; | 5 | name = "pure-ftpd-1.0.47"; |
@@ -8,9 +9,9 @@ stdenv.mkDerivation rec { | |||
8 | sha256 = "1b97ixva8m10vln8xrfwwwzi344bkgxqji26d0nrm1yzylbc6h27"; | 9 | sha256 = "1b97ixva8m10vln8xrfwwwzi344bkgxqji26d0nrm1yzylbc6h27"; |
9 | }; | 10 | }; |
10 | 11 | ||
11 | preConfigure = '' | 12 | preConfigure = stdenv.lib.optionalString (!isNull ldapFtpId) '' |
12 | sed -i -e "s#FTPuid#immaeFtpUid#" src/log_ldap.h | 13 | sed -i -e "s#FTPuid#${ldapFtpId}Uid#" src/log_ldap.h |
13 | sed -i -e "s#FTPgid#immaeFtpGid#" src/log_ldap.h | 14 | sed -i -e "s#FTPgid#${ldapFtpId}Gid#" src/log_ldap.h |
14 | ''; | 15 | ''; |
15 | postConfigure = '' | 16 | postConfigure = '' |
16 | sed -i 's/define MAX_DATA_SIZE (40/define MAX_DATA_SIZE (70/' src/ftpd.h | 17 | sed -i 's/define MAX_DATA_SIZE (40/define MAX_DATA_SIZE (70/' src/ftpd.h |
diff --git a/scripts/make-nur b/scripts/make-nur index 6766d95..1fe5f7a 100755 --- a/scripts/make-nur +++ b/scripts/make-nur | |||
@@ -17,14 +17,14 @@ first_commit="5145061e9b679ea1e5d2709d22d0ee53467fed15" | |||
17 | git rebase --onto=$nur_root $first_commit master | 17 | git rebase --onto=$nur_root $first_commit master |
18 | 18 | ||
19 | clean_folder=' | 19 | clean_folder=' |
20 | rm -rf config modules/private pkgs/private nixops | 20 | rm -rf config lib/private modules/private pkgs/private nixops |
21 | for bad in pkgs/crypto/cardano/default.nix; do | 21 | for broken in pkgs/crypto/cardano/default.nix; do |
22 | if [ -f $bad ]; then | 22 | if [ -f $broken ]; then |
23 | rm -f $bad | 23 | rm -f $broken |
24 | cat > $bad <<-EOF | 24 | cat > $broken <<-EOF |
25 | { runCommand, mylibs }: | 25 | { runCommand, mylibs }: |
26 | runCommand "empty" { preferLocalBuild = true; } "mkdir -p \$out" | 26 | runCommand "empty" { preferLocalBuild = true; } "mkdir -p \$out" |
27 | EOF | 27 | EOF |
28 | fi | 28 | fi |
29 | done | 29 | done |
30 | ' | 30 | ' |