2015-08-28 14:31:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-16 13:51:01 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
mainUser = config.users.extraUsers.mainUser;
|
2015-09-19 21:42:05 +00:00
|
|
|
createChromiumUser = name: extraGroups: packages:
|
2015-08-28 14:31:05 +00:00
|
|
|
{
|
2015-10-03 12:37:56 +00:00
|
|
|
users.extraUsers.${name} = {
|
|
|
|
inherit name;
|
|
|
|
inherit extraGroups;
|
|
|
|
home = "/home/${name}";
|
|
|
|
useDefaultShell = true;
|
|
|
|
createHome = true;
|
2015-08-28 14:31:05 +00:00
|
|
|
};
|
|
|
|
lass.per-user.${name}.packages = packages;
|
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
${mainUser.name} ALL=(${name}) NOPASSWD: ALL
|
|
|
|
'';
|
|
|
|
environment.systemPackages = [
|
2015-12-12 17:24:32 +00:00
|
|
|
(pkgs.writeScriptBin name ''
|
|
|
|
/var/setuid-wrappers/sudo -u ${name} -i chromium $@
|
2015-08-28 14:31:05 +00:00
|
|
|
'')
|
|
|
|
];
|
|
|
|
};
|
2015-07-16 13:51:01 +00:00
|
|
|
|
2015-09-19 21:42:05 +00:00
|
|
|
createFirefoxUser = name: extraGroups: packages:
|
|
|
|
{
|
2015-10-03 12:37:56 +00:00
|
|
|
users.extraUsers.${name} = {
|
|
|
|
inherit name;
|
|
|
|
inherit extraGroups;
|
|
|
|
home = "/home/${name}";
|
|
|
|
useDefaultShell = true;
|
|
|
|
createHome = true;
|
2015-09-19 21:42:05 +00:00
|
|
|
};
|
|
|
|
lass.per-user.${name}.packages = packages;
|
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
${mainUser.name} ALL=(${name}) NOPASSWD: ALL
|
|
|
|
'';
|
|
|
|
environment.systemPackages = [
|
2015-12-12 17:24:32 +00:00
|
|
|
(pkgs.writeScriptBin name ''
|
|
|
|
/var/setuid-wrappers/sudo -u ${name} -i firefox $@
|
2015-09-19 21:42:05 +00:00
|
|
|
'')
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2015-09-05 10:13:14 +00:00
|
|
|
#TODO: abstract this
|
|
|
|
|
2015-07-16 13:51:01 +00:00
|
|
|
in {
|
|
|
|
|
2015-09-05 10:13:14 +00:00
|
|
|
environment.systemPackages = [
|
2015-12-12 17:24:32 +00:00
|
|
|
(pkgs.writeScriptBin "browser-select" ''
|
2015-09-05 10:13:14 +00:00
|
|
|
BROWSER=$(echo -e "ff\ncr\nfb\ngm\nflash" | dmenu)
|
|
|
|
$BROWSER $@
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2015-08-28 14:31:05 +00:00
|
|
|
imports = [
|
|
|
|
../3modules/per-user.nix
|
|
|
|
] ++ [
|
2015-09-26 10:13:53 +00:00
|
|
|
( createFirefoxUser "ff" [ "audio" ] [ ] )
|
2015-09-19 21:42:05 +00:00
|
|
|
( createChromiumUser "cr" [ "audio" ] [ pkgs.chromium ] )
|
|
|
|
( createChromiumUser "fb" [ ] [ pkgs.chromium ] )
|
|
|
|
( createChromiumUser "gm" [ ] [ pkgs.chromium ] )
|
2015-12-12 17:25:08 +00:00
|
|
|
( createChromiumUser "flash" [ ] [ pkgs.flash ] )
|
2015-07-16 13:51:01 +00:00
|
|
|
];
|
|
|
|
|
2015-08-28 14:31:05 +00:00
|
|
|
nixpkgs.config.packageOverrides = pkgs : {
|
|
|
|
flash = pkgs.chromium.override {
|
2015-10-01 20:29:20 +00:00
|
|
|
# pulseSupport = true;
|
2015-08-28 14:31:05 +00:00
|
|
|
enablePepperFlash = true;
|
2015-07-16 13:51:01 +00:00
|
|
|
};
|
2015-10-01 20:17:43 +00:00
|
|
|
#chromium = pkgs.chromium.override {
|
|
|
|
# pulseSupport = true;
|
|
|
|
#};
|
2015-07-16 13:51:01 +00:00
|
|
|
};
|
|
|
|
}
|