2015-08-28 14:31:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-16 13:51:01 +00:00
|
|
|
|
|
|
|
let
|
2015-11-12 23:59:34 +00:00
|
|
|
simpleScript = name: content:
|
|
|
|
pkgs.stdenv.mkDerivation {
|
|
|
|
inherit name;
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s ${pkgs.writeScript name content} $out/bin/${name}
|
|
|
|
'';
|
|
|
|
};
|
2015-08-28 14:31:05 +00:00
|
|
|
|
2015-07-16 13:51:01 +00:00
|
|
|
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 = [
|
|
|
|
(simpleScript name ''
|
|
|
|
sudo -u ${name} -i chromium $@
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
};
|
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 = [
|
|
|
|
(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
|
|
|
|
] ++ [
|
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-10-01 20:15:48 +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
|
|
|
};
|
|
|
|
}
|