Skip to content
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

nixos/prosody: add user/group options, fix pidfile path #38820

Merged
merged 2 commits into from Apr 13, 2018

Conversation

brainrake
Copy link
Contributor

Motivation for this change

Prosody service options needed improvement

  • There were no user/group setting
  • The pidfile was in the dataDir, not under /run as usual
Things done
  • added services.prosody.user and services.prosody.group options and implementation
  • changed pidfile path, added RuntimeDirectory to systemd service config
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@brainrake
Copy link
Contributor Author

@GrahamcOfBorg test prosody

@brainrake
Copy link
Contributor Author

related: #35540 #38643
thanks @gnidorah

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: tests.prosody

Partial log (click to expand)

building '/nix/store/wzd2arnq16jp33l7lbvvckgh7aahn6dp-system-units.drv'...
building '/nix/store/ipdc5nicy3p22gsd3w90h3x4nrg6w3wy-user-units.drv'...
cannot build derivation '/nix/store/0arjcl48hdh3rr07c9mxwzzjg89n2rp0-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/79hyj98whlr68vjjradzfzv41p8daiir-nixos-system-machine-18.09.git.6fffa53.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/vmj1xn1l7b741islzcg27sn1c3g0yh6w-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/z5g4a260v69jh8l2907rqib59l8jz4pv-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/76ba55ra44rp9f0p0v06jpiy8cpfjd78-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/h0c0jdgd1pax56z6as4in6a4qniv3h83-nixos-test-driver-prosody.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv': 1 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: tests.prosody

Partial log (click to expand)

cannot build derivation '/nix/store/nv3dwh11bbql7afchzcammcchbfk96xj-stage-1-init.sh.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/fgvp327kx0ahh3k7hxlmvkmnd2fwar4m-initrd.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/0arjcl48hdh3rr07c9mxwzzjg89n2rp0-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/79hyj98whlr68vjjradzfzv41p8daiir-nixos-system-machine-18.09.git.6fffa53.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/vmj1xn1l7b741islzcg27sn1c3g0yh6w-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/z5g4a260v69jh8l2907rqib59l8jz4pv-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/76ba55ra44rp9f0p0v06jpiy8cpfjd78-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/h0c0jdgd1pax56z6as4in6a4qniv3h83-nixos-test-driver-prosody.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv': 1 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: tests.prosody

Partial log (click to expand)

cannot build derivation '/nix/store/nv3dwh11bbql7afchzcammcchbfk96xj-stage-1-init.sh.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/fgvp327kx0ahh3k7hxlmvkmnd2fwar4m-initrd.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/0arjcl48hdh3rr07c9mxwzzjg89n2rp0-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/79hyj98whlr68vjjradzfzv41p8daiir-nixos-system-machine-18.09.git.6fffa53.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/vmj1xn1l7b741islzcg27sn1c3g0yh6w-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/z5g4a260v69jh8l2907rqib59l8jz4pv-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/76ba55ra44rp9f0p0v06jpiy8cpfjd78-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/h0c0jdgd1pax56z6as4in6a4qniv3h83-nixos-test-driver-prosody.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv': 1 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/dc3wj6s4bxpz8xzaxd6zjy2pl7l1rvv7-vm-test-run-prosody.drv' failed

@brainrake
Copy link
Contributor Author

@GrahamcOfBorg build prosody

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: prosody

Partial log (click to expand)

/nix/store/idvkqv2vjwzycp3kmd9lhdz0ai7vgka3-prosody-0.10.0

@brainrake
Copy link
Contributor Author

From the prosody nixos test logs above, looks like the test vm kernel is broken.

@brainrake brainrake force-pushed the nixos-prosody-add-user-group branch from 6fffa53 to 350fded Compare April 12, 2018 07:35
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Works for me, nixos/prosody: fix pidfile path change fixed working when dataDir is put under home directory, say /home/user/prosody. Before there was an error Couldn't write pidfile at /home/gnidorah/prosody/prosody.pid; /home/gnidorah/prosody/prosody.pid: Permission denied

uid = config.ids.uids.prosody;
description = "Prosody user";
createHome = true;
group = "prosody";
group = "${cfg.group}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherit (cfg) group

@@ -494,9 +506,11 @@ in
wantedBy = [ "multi-user.target" ];
restartTriggers = [ config.environment.etc."prosody/prosody.cfg.lua".source ];
serviceConfig = {
User = "prosody";
User = "${cfg.user}";
Group = "${cfg.user}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User = cfg.user;
Group = cfg.group;

@@ -475,15 +487,15 @@ in
'') cfg.virtualHosts) }
'';

users.extraUsers.prosody = {
users.extraUsers."${cfg.user}" = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user should only be created if cfg.user == prosody. Same for the group.

@brainrake brainrake force-pushed the nixos-prosody-add-user-group branch from 350fded to 3e81f81 Compare April 13, 2018 09:34
@brainrake
Copy link
Contributor Author

Fixed, thanks for the review!

@@ -475,15 +487,15 @@ in
'') cfg.virtualHosts) }
'';

users.extraUsers.prosody = {
users.extraUsers.prosody = mkIf (cfg.user == prosody) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prosody should be in quotes

@brainrake brainrake force-pushed the nixos-prosody-add-user-group branch from 3e81f81 to ec1419b Compare April 13, 2018 09:39
@brainrake
Copy link
Contributor Author

Fixed, tested. Thanks!

@brainrake
Copy link
Contributor Author

@GrahamcOfBorg test prosody

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: tests.prosody

Partial log (click to expand)

building path(s) ‘/nix/store/005gypcy0fqpzsrkfvpqfkzxz8fv9dwi-etc’
building path(s) ‘/nix/store/p5gshmjb1m7kf47y94yar6cijkrdjnhs-nixos-system-machine-18.09.git.f7fdeaf’
building path(s) ‘/nix/store/40w1d9khqv1v622jg574nw3z7k5c6w92-closure-info’
/nix/store/aj9rz4k3xvg8q9fzqfnb0q123707zp0n-builder: line 1: .attrs.sh: No such file or directory
builder for ‘/nix/store/2g4pspqm1dpw2262rqwkzh34x3i40q69-closure-info.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/c5s0dp21mk9pl2nz1kaf7jdnybs7f13l-run-nixos-vm.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/bdbv1466rpl66h9d8shf1s96pmx7lyy1-nixos-vm.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/v7qsizw9vxfjn61pjmz7p90sj1sqkm38-nixos-test-driver-prosody.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/n74kisayrc2q0fcmlrrl64f32py360r8-vm-test-run-prosody.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/n74kisayrc2q0fcmlrrl64f32py360r8-vm-test-run-prosody.drv’ failed

@dotlambda
Copy link
Member

Ran the test manually and can confirm it works.

@dotlambda dotlambda merged commit 3ea1f1d into NixOS:master Apr 13, 2018
@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: tests.prosody

Partial log (click to expand)

cannot build derivation '/nix/store/1qfxxq5zknf36r503979xk3xb4s7wn0q-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/p70rjwwi7y6k2gxh0wprsaard4pa0wh1-stage-1-init.sh.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/7md0p3072i2bylq4r66cq7gkablm52kh-initrd.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/il8pcycpb0azyg27jscfg71ggajyj6sv-nixos-system-machine-18.09.git.c301075.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/5nf5g9hs465snp61n206fr3hfybxn62y-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/9i2gjvh8nspdhd27q67jvx55dfw0ih9n-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/05g18a4ldkw9avaijqhr6vkdskc396xk-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/ii5wr7rr08ckz9rj91mvqvj4k9srxhhc-nixos-test-driver-prosody.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/k3r7j4903flvvhh61j251f88gbyc7cb2-vm-test-run-prosody.drv': 1 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/k3r7j4903flvvhh61j251f88gbyc7cb2-vm-test-run-prosody.drv' failed

@brainrake brainrake deleted the nixos-prosody-add-user-group branch April 13, 2018 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants