summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/librepods.nix
blob: f2d1a35bccb7f9d611139891af487959a45809c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.programs.librepods;
in
{
  options = {
    programs.librepods = {
      enable = lib.mkOption {
        default = false;
        type = lib.types.bool;
        description = ''
          Whether to configure system to enable librepods.
          To grant access to a user, it must be part of librepods group:
          `users.users.alice.extraGroups = ["librepods"];`
        '';
      };
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [ librepods ];
    users.groups.librepods = { };

    security.wrappers.librepods = {
      source = lib.getExe pkgs.librepods;
      capabilities = "cap_net_admin+ep";
      owner = "root";
      group = "librepods";
      permissions = "u+rx,g+x";
    };
  };

  meta.maintainers = with lib.maintainers; [
    thefossguy
    Cameo007
  ];
}