l 2 browsers: use writeScriptBin

This commit is contained in:
lassulus 2015-12-12 18:24:32 +01:00
parent 43613fa6fc
commit d567f93745

View File

@ -1,16 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
simpleScript = name: content:
pkgs.stdenv.mkDerivation {
inherit name;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
ln -s ${pkgs.writeScript name content} $out/bin/${name}
'';
};
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
createChromiumUser = name: extraGroups: packages: createChromiumUser = name: extraGroups: packages:
{ {
@ -26,8 +16,8 @@ let
${mainUser.name} ALL=(${name}) NOPASSWD: ALL ${mainUser.name} ALL=(${name}) NOPASSWD: ALL
''; '';
environment.systemPackages = [ environment.systemPackages = [
(simpleScript name '' (pkgs.writeScriptBin name ''
sudo -u ${name} -i chromium $@ /var/setuid-wrappers/sudo -u ${name} -i chromium $@
'') '')
]; ];
}; };
@ -46,8 +36,8 @@ let
${mainUser.name} ALL=(${name}) NOPASSWD: ALL ${mainUser.name} ALL=(${name}) NOPASSWD: ALL
''; '';
environment.systemPackages = [ environment.systemPackages = [
(simpleScript name '' (pkgs.writeScriptBin name ''
sudo -u ${name} -i firefox $@ /var/setuid-wrappers/sudo -u ${name} -i firefox $@
'') '')
]; ];
}; };
@ -57,7 +47,7 @@ let
in { in {
environment.systemPackages = [ environment.systemPackages = [
(simpleScript "browser-select" '' (pkgs.writeScriptBin "browser-select" ''
BROWSER=$(echo -e "ff\ncr\nfb\ngm\nflash" | dmenu) BROWSER=$(echo -e "ff\ncr\nfb\ngm\nflash" | dmenu)
$BROWSER $@ $BROWSER $@
'') '')