Skip to content

Commit 9ad0abe

Browse files
Merge pull request #6 from linyinfeng/read-only-pkgs
nix: make nixos module compatible with readOnlyPkgs
2 parents 84b51f4 + 92f3220 commit 9ad0abe

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

flake.nix

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,24 @@
123123
config,
124124
...
125125
}:
126+
let
127+
cfg = config.security.run0-sudo-shim;
128+
in
126129
{
127130
options.security = {
128131
polkit.persistentAuthentication = lib.mkEnableOption "patch polkit to allow persistent authentication and add rules";
129-
run0-sudo-shim.enable = lib.mkEnableOption "enable run0-sudo-shim instead of sudo";
132+
run0-sudo-shim = {
133+
enable = lib.mkEnableOption "enable run0-sudo-shim instead of sudo";
134+
package = lib.mkPackageOption pkgs "run0-sudo-shim" { } // {
135+
# should be removed when upstreaming to nixpkgs
136+
default = pkgs.run0-sudo-shim or build-pkg pkgs;
137+
};
138+
};
130139
};
131140

132141
config = lib.mkMerge [
133-
{
134-
nixpkgs.overlays = [ self.overlays.default ];
135-
}
136-
(lib.mkIf config.security.run0-sudo-shim.enable {
137-
environment.systemPackages = [ pkgs.run0-sudo-shim ];
142+
(lib.mkIf cfg.enable {
143+
environment.systemPackages = [ cfg.package ];
138144
security.sudo.enable = false;
139145
security.polkit.enable = true;
140146

0 commit comments

Comments
 (0)