summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-08-02 15:40:41 +0200
committermakefu <github@syntax-fehler.de>2016-08-02 15:40:41 +0200
commit4719eb8d581dc6462e8531959c6e841e51c4f0d7 (patch)
tree9fedded0cc51b3db2aaec4d1132c59e856e1cea5
parent127b8c0989f1dc71313af67fb5e69c709df019f3 (diff)
m 2 main-laptop: remove obsolete display
-rw-r--r--makefu/2configs/base-gui.nix2
-rw-r--r--makefu/2configs/main-laptop.nix27
2 files changed, 20 insertions, 9 deletions
diff --git a/makefu/2configs/base-gui.nix b/makefu/2configs/base-gui.nix
index a028e5073..b039c12ca 100644
--- a/makefu/2configs/base-gui.nix
+++ b/makefu/2configs/base-gui.nix
@@ -55,7 +55,7 @@ in
hardware.pulseaudio = {
enable = true;
- # systemWide = true;
+ systemWide = true;
};
services.xserver.displayManager.sessionCommands = let
xdefaultsfile = pkgs.writeText "Xdefaults" ''
diff --git a/makefu/2configs/main-laptop.nix b/makefu/2configs/main-laptop.nix
index 92cc1fc43..9d5b06f70 100644
--- a/makefu/2configs/main-laptop.nix
+++ b/makefu/2configs/main-laptop.nix
@@ -6,7 +6,10 @@
# TODO split generic desktop stuff and laptop-specifics like lidswitching
with config.krebs.lib;
-{
+let
+ window-manager = "awesome";
+ user = config.krebs.build.user.name;
+in {
imports = [
./base-gui.nix
./fetchWallpaper.nix
@@ -17,23 +20,32 @@ with config.krebs.lib;
users.users.${config.krebs.build.user.name}.extraGroups = [ "dialout" ];
krebs.power-action = let
- speak = "${pkgs.espeak}/bin/espeak";
- whisper = text: ''${pkgs.espeak}/bin/espeak -v +whisper -s 110 "${text}"'';
- note = "${pkgs.libnotify}/bin/notify-send";
+ #speak = "XDG_RUNTIME_DIR=/run/user/$(id -u) ${pkgs.espeak}/bin/espeak"; # when run as user
+ speak = "${pkgs.espeak}/bin/espeak"; # systemwide pulse
+ whisper = text: ''${speak} -v +whisper -s 110 "${text}"'';
+
+ note = pkgs.writeDash "note-as-user" ''
+ eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(${pkgs.procps}/bin/pgrep -u ${user} ${window-manager})/environ)"
+ ${pkgs.libnotify}/bin/notify-send "$@";
+ '';
in {
enable = true;
+ inherit user;
plans.low-battery = {
upperLimit = 25;
lowerLimit = 15;
charging = false;
- action = whisper "power level low, please plug me in";
+ action = pkgs.writeDash "low-speak" ''
+ ${whisper "power level low, please plug me in"}
+ '';
};
plans.nag-harder = {
upperLimit = 15;
lowerLimit = 5;
+ charging = false;
action = pkgs.writeDash "crit-speak" ''
+ ${note} Battery -u critical -t 60000 "Power level critical, do something!"
${whisper "Power level critical, do something"}
- ${note} Battery -u critical -t 600000 "Power level critical, do something!"
'';
};
plans.last-chance = {
@@ -52,8 +64,7 @@ with config.krebs.lib;
'';
};
};
- users.users.power-action.extraGroups = [ "audio" ];
- security.sudo.extraConfig = "${config.krebs.power-action.user.name} ALL= (root) NOPASSWD: ${pkgs.systemd}/bin/systemctl suspend";
+ security.sudo.extraConfig = "${config.krebs.power-action.user} ALL= (root) NOPASSWD: ${pkgs.systemd}/bin/systemctl suspend";
services.redshift = {
enable = true;