lass 2 browsers: add create{Firefox,Chromium}User

This commit is contained in:
lassulus 2015-09-19 23:42:05 +02:00
parent db75ef768b
commit e3222a7e70

View File

@ -4,7 +4,7 @@ let
inherit (import ../4lib { inherit pkgs lib; }) simpleScript; inherit (import ../4lib { inherit pkgs lib; }) simpleScript;
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
createBrowserUser = name: extraGroups: packages: createChromiumUser = name: extraGroups: packages:
{ {
users.extraUsers = { users.extraUsers = {
${name} = { ${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 #TODO: abstract this
in { in {
@ -40,11 +62,11 @@ in {
imports = [ imports = [
../3modules/per-user.nix ../3modules/per-user.nix
] ++ [ ] ++ [
( createBrowserUser "ff" [ "audio" ] [ pkgs.firefox ] ) ( createFirefoxUser "ff" [ "audio" ] [ pkgs.firefox ] )
( createBrowserUser "cr" [ "audio" ] [ pkgs.chromium ] ) ( createChromiumUser "cr" [ "audio" ] [ pkgs.chromium ] )
( createBrowserUser "fb" [ ] [ pkgs.chromium ] ) ( createChromiumUser "fb" [ ] [ pkgs.chromium ] )
( createBrowserUser "gm" [ ] [ pkgs.chromium ] ) ( createChromiumUser "gm" [ ] [ pkgs.chromium ] )
( createBrowserUser "flash" [ ] [ pkgs.flash ] ) ( createChromiumUser "flash" [ ] [ pkgs.flash ] )
]; ];
nixpkgs.config.packageOverrides = pkgs : { nixpkgs.config.packageOverrides = pkgs : {