stockholm/lass/2configs/browsers.nix

82 lines
2.0 KiB
Nix
Raw Normal View History

2015-08-28 14:31:05 +00:00
{ config, lib, pkgs, ... }:
2015-07-16 13:51:01 +00:00
let
2015-08-28 14:31:05 +00:00
inherit (import ../4lib { inherit pkgs lib; }) simpleScript;
2015-07-16 13:51:01 +00:00
mainUser = config.users.extraUsers.mainUser;
createChromiumUser = name: extraGroups: packages:
2015-08-28 14:31:05 +00:00
{
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 $@
'')
];
};
2015-07-16 13:51:01 +00:00
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 $@
'')
];
};
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 = [
(simpleScript "browser-select" ''
BROWSER=$(echo -e "ff\ncr\nfb\ngm\nflash" | dmenu)
$BROWSER $@
'')
];
2015-08-28 14:31:05 +00:00
imports = [
../3modules/per-user.nix
] ++ [
( createFirefoxUser "ff" [ "audio" ] [ pkgs.firefox ] )
( createChromiumUser "cr" [ "audio" ] [ pkgs.chromium ] )
( createChromiumUser "fb" [ ] [ pkgs.chromium ] )
( createChromiumUser "gm" [ ] [ pkgs.chromium ] )
( 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 {
pulseSupport = true;
enablePepperFlash = true;
2015-07-16 13:51:01 +00:00
};
2015-08-28 14:31:05 +00:00
chromium = pkgs.chromium.override {
pulseSupport = true;
2015-07-16 13:51:01 +00:00
};
};
}