summaryrefslogtreecommitdiffstats
path: root/lass/2configs/browsers.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-08-31 10:47:29 +0200
committermakefu <github@syntax-fehler.de>2015-08-31 10:47:29 +0200
commit2eb8bcf9d1c293a8b28730c9a12d9a857c5a43a7 (patch)
treec8a1d55a148e59f51a400e0d5dc11780d4e4005c /lass/2configs/browsers.nix
parent0acd7f23e1e3adf4bf1427f186a7bf5505ff910d (diff)
parent83f06535de527c7470f8ff9c8b5e3a4632cf7cb9 (diff)
Merge remote-tracking branch 'cd/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
- '';
}