lass 2 browsers: refactor
This commit is contained in:
parent
bf69b0c03f
commit
ecae9b5975
@ -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 {
|
||||
|
||||
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 ] )
|
||||
];
|
||||
|
||||
nixpkgs.config.packageOverrides = pkgs : {
|
||||
flash = pkgs.chromium.override {
|
||||
pulseSupport = true;
|
||||
enablePepperFlash = true;
|
||||
};
|
||||
chromium = pkgs.chromium.override {
|
||||
pulseSupport = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
firefox
|
||||
];
|
||||
|
||||
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;
|
||||
};
|
||||
flash = {
|
||||
name = "flash";
|
||||
description = "user for running flash stuff";
|
||||
home = "/home/flash";
|
||||
useDefaultShell = true;
|
||||
extraGroups = [ "audio" ];
|
||||
createHome = 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
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user