diff options
author | lassulus <lass@aidsballs.de> | 2015-08-28 16:31:05 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-08-28 16:31:05 +0200 |
commit | ecae9b59753c13ea5bff57a6f7c44086c77844d6 (patch) | |
tree | 0b88010eae0a48f2c89c1535d2362a88ac58d1b7 /lass/2configs/browsers.nix | |
parent | bf69b0c03f1e380b127815c2263f1dac5c9d9165 (diff) |
lass 2 browsers: refactor
Diffstat (limited to 'lass/2configs/browsers.nix')
-rw-r--r-- | lass/2configs/browsers.nix | 93 |
1 files changed, 38 insertions, 55 deletions
diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix index 8aecea925..9849c829a 100644 --- a/lass/2configs/browsers.nix +++ b/lass/2configs/browsers.nix @@ -1,67 +1,50 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: let + inherit (import ../4lib { inherit pkgs lib; }) simpleScript; + mainUser = config.users.extraUsers.mainUser; + createBrowserUser = 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 chromium $@ + '') + ]; + }; in { - nixpkgs.config.packageOverrides = pkgs : { - chromium = pkgs.chromium.override { - pulseSupport = true; - }; - }; - - environment.systemPackages = with pkgs; [ - firefox + 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 ] ) ]; - users.extraUsers = { - firefox = { - name = "firefox"; - description = "user for running firefox"; - home = "/home/firefox"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - chromium = { - name = "chromium"; - description = "user for running chromium"; - home = "/home/chromium"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - facebook = { - name = "facebook"; - description = "user for running facebook in chromium"; - home = "/home/facebook"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - google = { - name = "google"; - description = "user for running google+/gmail in chromium"; - home = "/home/google"; - useDefaultShell = true; - createHome = true; + nixpkgs.config.packageOverrides = pkgs : { + flash = pkgs.chromium.override { + pulseSupport = true; + enablePepperFlash = true; }; - flash = { - name = "flash"; - description = "user for running flash stuff"; - home = "/home/flash"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; + chromium = pkgs.chromium.override { + pulseSupport = true; }; }; - - security.sudo.extraConfig = '' - ${mainUser.name} ALL=(firefox) NOPASSWD: ALL - ${mainUser.name} ALL=(chromium) NOPASSWD: ALL - ${mainUser.name} ALL=(facebook) NOPASSWD: ALL - ${mainUser.name} ALL=(google) NOPASSWD: ALL - ${mainUser.name} ALL=(flash) NOPASSWD: ALL - ''; } |