summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-09-19 23:42:05 +0200
committerlassulus <lass@aidsballs.de>2015-09-19 23:42:05 +0200
commite3222a7e7096d155da507ef41bbb2002ff4aed89 (patch)
tree25525255072d70716d4070f920a5394b0382e939
parentdb75ef768b705fc6c4cbbd5ed29f817470c9952d (diff)
lass 2 browsers: add create{Firefox,Chromium}User
-rw-r--r--lass/2configs/browsers.nix34
1 files changed, 28 insertions, 6 deletions
diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix
index 2aaeda63d..4fe06b729 100644
--- a/lass/2configs/browsers.nix
+++ b/lass/2configs/browsers.nix
@@ -4,7 +4,7 @@ let
inherit (import ../4lib { inherit pkgs lib; }) simpleScript;
mainUser = config.users.extraUsers.mainUser;
- createBrowserUser = name: extraGroups: packages:
+ createChromiumUser = name: extraGroups: packages:
{
users.extraUsers = {
${name} = {
@@ -26,6 +26,28 @@ let
];
};
+ createFirefoxUser = name: extraGroups: packages:
+ {
+ users.extraUsers = {
+ ${name} = {
+ inherit name;
+ inherit extraGroups;
+ home = "/home/${name}";
+ useDefaultShell = true;
+ createHome = true;
+ };
+ };
+ lass.per-user.${name}.packages = packages;
+ security.sudo.extraConfig = ''
+ ${mainUser.name} ALL=(${name}) NOPASSWD: ALL
+ '';
+ environment.systemPackages = [
+ (simpleScript name ''
+ sudo -u ${name} -i firefox $@
+ '')
+ ];
+ };
+
#TODO: abstract this
in {
@@ -40,11 +62,11 @@ in {
imports = [
../3modules/per-user.nix
] ++ [
- ( createBrowserUser "ff" [ "audio" ] [ pkgs.firefox ] )
- ( createBrowserUser "cr" [ "audio" ] [ pkgs.chromium ] )
- ( createBrowserUser "fb" [ ] [ pkgs.chromium ] )
- ( createBrowserUser "gm" [ ] [ pkgs.chromium ] )
- ( createBrowserUser "flash" [ ] [ pkgs.flash ] )
+ ( createFirefoxUser "ff" [ "audio" ] [ pkgs.firefox ] )
+ ( createChromiumUser "cr" [ "audio" ] [ pkgs.chromium ] )
+ ( createChromiumUser "fb" [ ] [ pkgs.chromium ] )
+ ( createChromiumUser "gm" [ ] [ pkgs.chromium ] )
+ ( createChromiumUser "flash" [ ] [ pkgs.flash ] )
];
nixpkgs.config.packageOverrides = pkgs : {