New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sympa: init at 6.2.52 + NixOS module #65397
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the high amount of comments, but it's also a huge PR :/
cc @Scriptkiddi maybe you can have a look here?
nixos/modules/misc/ids.nix
Outdated
@@ -340,6 +340,7 @@ | |||
cockroachdb = 313; | |||
zoneminder = 314; | |||
paperless = 315; | |||
sympa = 316; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think sympa needs to be added here. Just create a user with isSystemUser = true
and it will get some free UID. If you want to go wild, you can try systemd's DynamicUser
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, DynamicUser
looks good though it's not obvious if it works with the kind of setup w/ multiple unit files and multiple daemon processes we have here.
pkgs/servers/mail/sympa/default.nix
Outdated
stdenv.mkDerivation rec { | ||
name = "${pname}-${version}"; | ||
|
||
src = fetchurl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use fetchFromGitHub
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on this. Is building from git generally preferred to building from release tarballs?
pkgs/servers/mail/sympa/default.nix
Outdated
for i in chown chgrp chmod; do | ||
echo '#!${stdenv.shell}' >> "$TMP/bin/$i" | ||
chmod +x "$TMP/bin/$i" | ||
PATH="$TMP/bin:$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this one line lower. Also can't you just omit that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Omitting causes the build to fail in install phase:
make install-exec-hook
make[4]: Entering directory '/build/sympa-6.2.44/src/cgi'
chown sympa /nix/store/2yv66g71p9bmy7i1gxry4gvp25wl203y-sympa-6.2.44/bin/wwsympa-wrapper.fcgi
chown: invalid user: 'sympa'
make[4]: [Makefile:783: install-exec-hook] Error 1 (ignored)
chgrp sympa /nix/store/2yv66g71p9bmy7i1gxry4gvp25wl203y-sympa-6.2.44/bin/wwsympa-wrapper.fcgi
chgrp: invalid group: 'sympa'
make[4]: [Makefile:784: install-exec-hook] Error 1 (ignored)
chmod 6755 /nix/store/2yv66g71p9bmy7i1gxry4gvp25wl203y-sympa-6.2.44/bin/wwsympa-wrapper.fcgi
chmod: changing permissions of '/nix/store/2yv66g71p9bmy7i1gxry4gvp25wl203y-sympa-6.2.44/bin/wwsympa-wrapper.fcgi': Operation not permitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey first of really nice that you are packaging sympa, I know the config is not something that is fun to read.
I would add an option to add files and folders to the dataDir because that covers pretty much all the other options sympa has, like plugins, list templates and list families, but thats something that can be done after this pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dasJ @Scriptkiddi thank you for your feedback! I tried to address most of the issues and marked them as resolved. Still working on structural fetchFromGitHub
andsettings
.
Sorry for the high amount of comments, but it's also a huge PR :/
Don't worry, that's expected in order to achieve quality;) Would splitting this PR e.g. into one w/ package and another with NixOS module help?
I would add an option to add files and folders to the dataDir because that covers pretty much all the other options sympa has
Something like environment.etc
? Is there other module that has option like this for me to copy it study?
@infinisil I've refactored the module to use structural |
Forgot to push? |
Yep ... pushed now. |
something like it, the Gams package is doing it. |
Regarding the rest of the configuration, it doesn't seem feasible to model the structure of all the config files, so we'd have to have something like I'd propose to leave the rest of the configuration (i.e. other than
|
Works for me, most of the files are not editable from the web ui but I'm fine with just adding them under /var/lib/sympa |
}; | ||
|
||
database = { | ||
type = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A big 👍 for using services.mysql.ensureDatabases
, services.mysql.ensureUsers
, services.postgresql.ensureDatabases
, and services.postgresql.ensureUsers
. I highly suggest adding a database.createLocally
option which defaults to true
so users don't have to do any additional steps to provision a database. A decent example can be seen here:
nixpkgs/nixos/modules/services/monitoring/zabbix-server.nix
Lines 205 to 224 in c4ce832
services.mysql = optionalAttrs mysqlLocal { | |
enable = true; | |
package = mkDefault pkgs.mariadb; | |
ensureDatabases = [ cfg.database.name ]; | |
ensureUsers = [ | |
{ name = cfg.database.user; | |
ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; }; | |
} | |
]; | |
}; | |
services.postgresql = optionalAttrs pgsqlLocal { | |
enable = true; | |
ensureDatabases = [ cfg.database.name ]; | |
ensureUsers = [ | |
{ name = cfg.database.user; | |
ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; }; | |
} | |
]; | |
}; |
Please let me know if anything isn't clear from the example or you have any questions as I'm always happy to help (especially when it comes to utilizing ensureDatabases
and ensureUsers
.
pkgs/servers/mail/sympa/default.nix
Outdated
]; | ||
nativeBuildInputs = [ autoreconfHook ]; | ||
buildInputs = [ perlPackages.perl makeWrapper ]; | ||
propagatedBuildInputs = with perlPackages; [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! Are all of these direct dependencies of every program? This could probably benefit from using perl.withPackages
like so:
prog1Env = perl.withPackages (p: with p; [ ArchiveZip CGI DateTime ... ]);
prog2Env = perl.withPackages (p: with p; [ DBI FGCI ]);
Note you can explicitly list dependencies for each program and a 'better' perl environment will be built. From there you can pass prog1Env
and prog2Env
into buildInputs
and patchShebangs
can take care of the perl
binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know ... I'm not familiar with Sympa internals (nor can I read Perl very well) but it seems that the programs mostly depend on Sympa library/package which in turn depends on these packages.
Is there a way to determine which program depends on which package that doesn't involve reviewing the whole source code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I suppose I shouldn't have bothered mentioning about multiple perl
environments.
The point you should takeaway is that you can avoid PERL5LIB
if you want to by creating a dedicated (custom) perl
environment using perl.withPackages
, if you want to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand how that works. Do I define a custom perlEnv
and then use it instead of perlPackages.perl
in buildInputs
and use patchShebangs
instead of makeWrapper
? How do I pass the environment to patchShebangs
? Will propagatedBuildInputs
be empty? Got an example I can look at?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#64646 is a simple example which should help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified the package to use perl.withPackages
, please take a look if this is what you meant.
96398dc
to
39e6ad2
Compare
@infinisil @aanderse thank you for the comments, I think I addressed most of them, please take a look! |
pkgs/servers/mail/sympa/default.nix
Outdated
]; | ||
nativeBuildInputs = [ autoreconfHook ]; | ||
buildInputs = [ perlPackages.perl makeWrapper ]; | ||
propagatedBuildInputs = with perlPackages; [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I suppose I shouldn't have bothered mentioning about multiple perl
environments.
The point you should takeaway is that you can avoid PERL5LIB
if you want to by creating a dedicated (custom) perl
environment using perl.withPackages
, if you want to.
Changes:
@aanderse @infinisil @Scriptkiddi PTAL & please advise how to proceed with this pull request. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/62 |
Changes:
|
The mysql.sock thing should be solved by #70010. |
FYI I'd still like to get this merged but it needs some more work from my side which will hopefully happen soon. |
Other than fixing the merge conflicts, what's left? |
I think bumping packages to current versions would be nice to have (e.g. sympa 6.2.52). |
Changes:
|
Cool! Let's merge this for now so it gets into 20.03 (https://discourse.nixos.org/t/nixos-20-03-feature-freeze/5655/13). We can fix any potential issues later (hopefully before 20.03 is released). |
@infinisil thanks!!! |
Motivation for this change
Adds Sympa mailing list manager and its dependencies to nixpkgs, with NixOS module.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)(joint effort w/ @sorki)