summaryrefslogtreecommitdiffstats
path: root/lass/2configs/browsers.nix
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-08-28 21:54:35 +0200
committertv <tv@shackspace.de>2015-08-28 21:54:35 +0200
commite5ecd75ac266a77c31790e52c2ea000574be9e22 (patch)
treeeecdc35c4a8f257d86178f6eb864c9404a2f1aa7 /lass/2configs/browsers.nix
parent62865ae6ae46e006cea7ee80b931fc5be27d3449 (diff)
parentecae9b59753c13ea5bff57a6f7c44086c77844d6 (diff)
Merge remote-tracking branch 'uriel/master'
Diffstat (limited to 'lass/2configs/browsers.nix')
-rw-r--r--lass/2configs/browsers.nix93
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
- '';
}