diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-01-19 09:55:31 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-01-19 09:55:31 +0100 |
commit | 716aac2519a7571e7f5fd984a886d579a4a051c5 (patch) | |
tree | 53cf89cf764d787f4dc8f08474479892b9733177 /nixos/modules/services/hardware | |
parent | f8472457a440de3c44f6f604142d678b6ae2a762 (diff) | |
parent | 53b389327e34de319dc0dbda2b6bcab1a69db69d (diff) | |
download | nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.gz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.bz2 nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.lz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.xz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.zst nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.zip |
Merge branch 'staging' into closure-size
Diffstat (limited to 'nixos/modules/services/hardware')
-rw-r--r-- | nixos/modules/services/hardware/acpid.nix | 117 | ||||
-rw-r--r-- | nixos/modules/services/hardware/freefall.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/hardware/irqbalance.nix | 30 | ||||
-rw-r--r-- | nixos/modules/services/hardware/pommed.nix | 15 | ||||
-rw-r--r-- | nixos/modules/services/hardware/sane.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/hardware/thinkfan.nix | 24 | ||||
-rw-r--r-- | nixos/modules/services/hardware/upower.nix | 1 |
7 files changed, 163 insertions, 29 deletions
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix index a20b1a1ee3ad..48b2b6be09ed 100644 --- a/nixos/modules/services/hardware/acpid.nix +++ b/nixos/modules/services/hardware/acpid.nix @@ -20,7 +20,7 @@ let } ''; - events = [powerEvent lidEvent acEvent]; + events = [powerEvent lidEvent acEvent muteEvent volumeDownEvent volumeUpEvent cdPlayEvent cdNextEvent cdPrevEvent]; # Called when the power button is pressed. powerEvent = @@ -55,6 +55,61 @@ let ''; }; + muteEvent = { + name = "mute"; + event = "button/mute.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.muteCommands} + ''; + }; + + volumeDownEvent = { + name = "volume-down"; + event = "button/volumedown.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.volumeDownEventCommands} + ''; + }; + + volumeUpEvent = { + name = "volume-up"; + event = "button/volumeup.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.volumeUpEventCommands} + ''; + }; + + cdPlayEvent = { + name = "cd-play"; + event = "cd/play.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.cdPlayEventCommands} + ''; + }; + + cdNextEvent = { + name = "cd-next"; + event = "cd/next.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.cdNextEventCommands} + ''; + }; + + cdPrevEvent = { + name = "cd-prev"; + event = "cd/prev.*"; + action = '' + #! ${pkgs.bash}/bin/sh + ${config.services.acpid.cdPrevEventCommands} + ''; + }; + + in { @@ -89,6 +144,42 @@ in description = "Shell commands to execute on an ac_adapter.* event."; }; + muteCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an button/mute.* event."; + }; + + volumeDownEventCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an button/volumedown.* event."; + }; + + volumeUpEventCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an button/volumeup.* event."; + }; + + cdPlayEventCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an cd/play.* event."; + }; + + cdNextEventCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an cd/next.* event."; + }; + + cdPrevEventCommands = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to execute on an cd/prev.* event."; + }; + }; }; @@ -98,22 +189,26 @@ in config = mkIf config.services.acpid.enable { - jobs.acpid = - { description = "ACPI Daemon"; - - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-udev-settle.service" ]; + systemd.services.acpid = { + description = "ACPI Daemon"; - path = [ pkgs.acpid ]; + wantedBy = [ "multi-user.target" ]; + after = [ "systemd-udev-settle.service" ]; - daemonType = "fork"; + path = [ pkgs.acpid ]; - exec = "acpid --confdir ${acpiConfDir}"; + serviceConfig = { + Type = "forking"; + }; - unitConfig.ConditionVirtualization = "!systemd-nspawn"; - unitConfig.ConditionPathExists = [ "/proc/acpi" ]; + unitConfig = { + ConditionVirtualization = "!systemd-nspawn"; + ConditionPathExists = [ "/proc/acpi" ]; }; + script = "acpid --confdir ${acpiConfDir}"; + }; + }; } diff --git a/nixos/modules/services/hardware/freefall.nix b/nixos/modules/services/hardware/freefall.nix index 2be339766069..066ccaa4d7cf 100644 --- a/nixos/modules/services/hardware/freefall.nix +++ b/nixos/modules/services/hardware/freefall.nix @@ -21,6 +21,7 @@ in { package = mkOption { type = types.package; default = pkgs.freefall; + defaultText = "pkgs.freefall"; description = '' freefall derivation to use. ''; diff --git a/nixos/modules/services/hardware/irqbalance.nix b/nixos/modules/services/hardware/irqbalance.nix new file mode 100644 index 000000000000..b139154432cf --- /dev/null +++ b/nixos/modules/services/hardware/irqbalance.nix @@ -0,0 +1,30 @@ +# +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.irqbalance; + +in +{ + options.services.irqbalance.enable = mkEnableOption "irqbalance daemon"; + + config = mkIf cfg.enable { + + systemd.services = { + irqbalance = { + description = "irqbalance daemon"; + path = [ pkgs.irqbalance ]; + serviceConfig = + { ExecStart = "${pkgs.irqbalance}/bin/irqbalance --foreground"; }; + wantedBy = [ "multi-user.target" ]; + }; + }; + + environment.systemPackages = [ pkgs.irqbalance ]; + + }; + +} diff --git a/nixos/modules/services/hardware/pommed.nix b/nixos/modules/services/hardware/pommed.nix index a24557b40ba1..7be4dc1e8464 100644 --- a/nixos/modules/services/hardware/pommed.nix +++ b/nixos/modules/services/hardware/pommed.nix @@ -35,18 +35,13 @@ with lib; services.dbus.packages = [ pkgs.pommed ]; - jobs.pommed = { name = "pommed"; - + systemd.services.pommed = { description = "Pommed hotkey management"; - - startOn = "started dbus"; - + wantedBy = [ "multi-user.target" ]; + after = [ "dbus.service" ]; postStop = "rm -f /var/run/pommed.pid"; - - exec = "${pkgs.pommed}/bin/pommed"; - - daemonType = "fork"; - + script = "${pkgs.pommed}/bin/pommed"; + serviceConfig.Type = "forking"; path = [ pkgs.eject ]; }; }; diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 0428602688dd..56504cd2361d 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -4,7 +4,9 @@ with lib; let - pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends; + pkg = if config.hardware.sane.snapshot + then pkgs.sane-backends-git + else pkgs.sane-backends; backends = [ pkg ] ++ config.hardware.sane.extraBackends; saneConfig = pkgs.mkSaneConfig { paths = backends; }; diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix index 16c31aab2d50..018e82e58a3d 100644 --- a/nixos/modules/services/hardware/thinkfan.nix +++ b/nixos/modules/services/hardware/thinkfan.nix @@ -43,13 +43,7 @@ let sensor ${cfg.sensor} (0, 10, 15, 2, 10, 5, 0, 3, 0, 3) - (0, 0, 55) - (1, 48, 60) - (2, 50, 61) - (3, 52, 63) - (6, 56, 65) - (7, 60, 85) - (127, 80, 32767) + ${cfg.levels} ''; in { @@ -72,6 +66,22 @@ in { ''; }; + levels = mkOption { + default = '' + (0, 0, 55) + (1, 48, 60) + (2, 50, 61) + (3, 52, 63) + (6, 56, 65) + (7, 60, 85) + (127, 80, 32767) + ''; + description ='' + Sensor used by thinkfan + ''; + }; + + }; }; diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix index 46481a86a142..2198842a4511 100644 --- a/nixos/modules/services/hardware/upower.nix +++ b/nixos/modules/services/hardware/upower.nix @@ -27,6 +27,7 @@ in package = mkOption { type = types.package; default = pkgs.upower; + defaultText = "pkgs.upower"; example = lib.literalExample "pkgs.upower"; description = '' Which upower package to use. |