Skip to content

nixos/paretosecurity: Add support for declarative linking #432756

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zupo
Copy link
Contributor

@zupo zupo commented Aug 11, 2025

Before this PR, users that wanted to link their Pareto Desktop to Pareto Cloud had to imperatively run paretosecurity link .... This PR adds a oneshot systemd service that does the linking so the entire Pareto app can be configured declaratively with nix.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 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 Aug 11, 2025
Before this PR, users that wanted to link their Pareto Desktop
to Pareto Cloud had to imperatively run `paretosecurity link ...`.
This PR adds a oneshot systemd service that does the linking
so the entire Pareto app can be configured declaratively with nix.
@zupo zupo force-pushed the add/nixos_linking branch from 9831c44 to 090d064 Compare August 11, 2025 11:57
Comment on lines +39 to 41
users.users = lib.mkOption {
type = with lib.types; attrsOf (submodule userOptions);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's a good idea to add this to users.users as this option would show up regardless of whether this module is enabled. If every module started adding their options to users.users this would be quite a mess.

I also don't think that what you want is a user abstraction in the Linux sense at all. As far as I understand it (from reading the website), you care (mostly) about device settings (esp. when I look at https://paretosecurity.com/linux/checks) and most of the abstractions seem to be on the device level, assuming there is one user per device.

I'd suggest to just have a single inviteId to link the entire device as opposed to assuming this is a multi-person workstation. If you really want to do this for multiple users on the same device, please implement this via a separate option like paretosecurity.users.${name}.inviteId.

Copy link
Contributor Author

@zupo zupo Aug 11, 2025

Choose a reason for hiding this comment

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

Thanks for taking the time to review!

  1. Some of the settings are per-device, but there are definitely per-user settings that need to be checked for compliance. It's probably fine to focus on single-user scenario for now, but long term I imagine we'll need support for multi-user.

  2. My main reason for using users.users.alice.paretosecurity.inviteId is to have validation that the user actually exists. I.e. if someone has users.users.alice and then paretosecurity.users.bob.inviteId, I want nix to complain. Is there a way to use users.users.alice.paretosecurity without polluting the users.users module if paretosecurity is not enabled?

Copy link
Contributor

Choose a reason for hiding this comment

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

I want nix to complain.

You could write an assertion that checks this at build time of the system.

However, you should also consider that some people manage their users outside of Nix. I.e. via mutable users or LDAP, where they won't show up in Nix. Especially for larger organizations LDAP is quite common.

I think that runtime checking (i.e. in the service) would be the most flexibe and future proof, but I don't have strong opinions about this. Just some pointers.

Copy link
Contributor

@flokli flokli left a comment

Choose a reason for hiding this comment

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

I think this would really be way better suited as a home-manager module (which can be included into your main NixOS configuration), creating systemd user services for the given user.

We don't really have a concept of per-user settings in nixpkgs / NixOS itself.

@zupo
Copy link
Contributor Author

zupo commented Aug 13, 2025

I think this would really be way better suited as a home-manager module (which can be included into your main NixOS configuration), creating systemd user services for the given user.

But not everyone uses home-manager?

@flokli
Copy link
Contributor

flokli commented Aug 13, 2025

I think this would really be way better suited as a home-manager module (which can be included into your main NixOS configuration), creating systemd user services for the given user.

But not everyone uses home-manager?

nixpkgs doesn't have the infrastructure to define something only specific to one user and their config, and so far the solution was to land this code into home-manager.

Running something as the user, but via a global systemd system unit won't fully enter a user session, and not work in some cases (xdg config home decrypted on login etc...).

I still think this should land in home-manager, and for people not wanting to use it to manage this aspect of paretosecurity, they can run paretosecurity link imperatively.

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: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants