mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
nixos/resolvconf: add a resolvconf group
This group is useful to allow specific users to run resolvconf and (and this modify /etc/resolv.conf) without root privileges.
This commit is contained in:
parent
9387bb897b
commit
19a494135a
@ -132,6 +132,8 @@ in
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.enable {
|
||||
users.groups.resolvconf = {};
|
||||
|
||||
networking.resolvconf.package = pkgs.openresolv;
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
@ -143,12 +145,13 @@ in
|
||||
wants = [ "network-pre.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
restartTriggers = [ config.environment.etc."resolvconf.conf".source ];
|
||||
serviceConfig.RemainAfterExit = true;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cfg.package}/bin/resolvconf -u";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe cfg.package} -u
|
||||
chgrp -R resolvconf /etc/resolv.conf /run/resolvconf
|
||||
chmod -R g=u /etc/resolv.conf /run/resolvconf
|
||||
'';
|
||||
};
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user