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

kbfs, nixos/keybase, nixos/kbfs: fix KBFS, add enableRedirector option #75922

Merged
merged 2 commits into from
Jan 29, 2020

Conversation

tadfisher
Copy link
Contributor

Motivation for this change

KBFS wasn't working on my system using the NixOS module, so I updated the systemd services to mirror the upstream service files. Comments from upstream are included, and the main changes are:

  • Use the notify service type which is now supported upstream.
  • Set KEYBASE_SERVICE_TYPE=systemd in the environment for keybase.service; this is apparently what fixed the issues between the keybase and kbfs on my system.
  • Read the service environment from $XDG_CONFIG_DIR/keybase/keybase{.autogen}.env, which is populated by the keybase ctl init command as specified in the documentation. This is entirely optional and my setup works without doing this.

I also wanted to run keybase-redirector on a multi-user machine, so I added config.services.enableRedirector. This requires the following shenanigans:

  • Build the redirector binary as part of the kbfs package.
  • /keybase needs to exist; use systemd.tmpfiles.rules to add it and clean it up if enableRedirector is disabled. If there is a standard way to do this for user services, I'd be happy to change this.
  • Make a setuid wrapper for ${pkgs.kbfs}/bin/redirector, named keybase-redirector for consistency with the documentation and other distributions.
  • I'm happy to not do any of this, by the way, or change to a setpcap wrapper instead; however, the redirector calls setreuid and thus would require CAP_SYS_ADMIN anyway.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @rvolosatovs @bennofs @np

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Dec 19, 2019
@ofborg ofborg bot requested review from ehmry, np and bennofs December 19, 2019 06:36
Copy link
Member

@rvolosatovs rvolosatovs left a comment

Choose a reason for hiding this comment

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

LGTM

environment.KEYBASE_SERVICE_TYPE = "systemd";

script = ''
${pkgs.keybase}/bin/keybase --use-default-log-file --debug service
Copy link
Member

Choose a reason for hiding this comment

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

--debug seems unnecessary, but I guess since upstream does that it should be fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️

}

Copy link
Member

Choose a reason for hiding this comment

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

Remove newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️

@tadfisher
Copy link
Contributor Author

Addressed feedback. I was also able to remove the NotifyAccess attrs by using serviceConfig.ExecStart instead of script.

@nixos-discourse
Copy link

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/104

@marsam marsam merged commit deedf24 into NixOS:master Jan 29, 2020
@marsam
Copy link
Contributor

marsam commented Jan 29, 2020

LGTM, Thank you

anna328p pushed a commit to anna328p/nixpkgs that referenced this pull request Feb 2, 2020
kbfs, nixos/keybase, nixos/kbfs: fix KBFS, add enableRedirector option
@tadfisher tadfisher deleted the kbfs-fixes branch January 9, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants