Skip to content

Commit

Permalink
nixos: remove doas
Browse files Browse the repository at this point in the history
ennoying hack to go around Duncaen/OpenDoas#2
  • Loading branch information
PaulGrandperrin committed Nov 3, 2023
1 parent 9223754 commit d8dca38
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions nixosModules/shared/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,6 @@
enable = true; # TODO: remove when we are sure doas work properly
execWheelOnly = true;
};
doas = {
enable = false;
extraRules = [{
groups = ["wheel"];
persist = true;
setEnv = with lib; let # because of https://github.com/Duncaen/OpenDoas/issues/2 we need to add here all variables that should have been read from PAM_env
# code inspired from https://github.com/NixOS/nixpkgs/blob/nixos-21.11/nixos/modules/config/system-environment.nix#L69
suffixedVariables =
flip mapAttrs config.environment.profileRelativeSessionVariables (envVar: suffixes:
flip concatMap config.environment.profiles (profile:
map (suffix: "${profile}${suffix}") suffixes
)
);
suffixedVariablesWithWrappers = (zipAttrsWith (n: concatLists)
[
# Make sure security wrappers are prioritized without polluting
# shell environments with an extra entry. Sessions which depend on
# pam for its environment will otherwise have eg. broken sudo. In
# particular Gnome Shell sometimes fails to source a proper
# environment from a shell.
{ PATH = [ config.security.wrapperDir ]; }

(mapAttrs (n: toList) config.environment.sessionVariables)
suffixedVariables
]
);
replaceEnvVars = replaceStrings ["$HOME" "$USER"] ["/root" "root"];
doasVariable = k: v: ''${k}=${concatStringsSep ":" (map replaceEnvVars (toList v))}'';

in mapAttrsToList doasVariable suffixedVariablesWithWrappers;
}];
};
};

hardware.enableAllFirmware = true;
Expand Down

0 comments on commit d8dca38

Please sign in to comment.