Skip to content

Commit

Permalink
modules/tuxedo-control-center: init
Browse files Browse the repository at this point in the history
  • Loading branch information
blitz committed Jan 24, 2022
1 parent 67b6d9b commit a0e0efe
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@
<link xlink:href="options.html#opt-services.timetagger.enable">services.timetagger</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://github.com/tuxedocomputers/tuxedo-control-center">tuxedo-control-center</link>,
a graphical user interface to control fan and power management
on Tuxedo laptops. Available as
<link linkend="opt-hardware.tuxedo-control-center.enable">hardware.tuxedo-control-center</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://www.rstudio.com/products/rstudio/#rstudio-server">rstudio-server</link>,
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2205.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- [timetagger](https://timetagger.app), an open source time-tracker with an intuitive user experience and powerful reporting. [services.timetagger](options.html#opt-services.timetagger.enable).

- [tuxedo-control-center](https://github.com/tuxedocomputers/tuxedo-control-center), a graphical user interface to control fan and power management on Tuxedo laptops. Available as [hardware.tuxedo-control-center](#opt-hardware.tuxedo-control-center.enable).

- [rstudio-server](https://www.rstudio.com/products/rstudio/#rstudio-server), a browser-based version of the RStudio IDE for the R programming language. Available as [services.rstudio-server](options.html#opt-services.rstudio-server.enable).

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
Expand Down
65 changes: 65 additions & 0 deletions nixos/modules/hardware/tuxedo-control-center.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.hardware.tuxedo-control-center;
in
{
options.hardware.tuxedo-control-center = {
enable = mkEnableOption ''
Tuxedo Control Center, the official fan and power management UI
for Tuxedo laptops.
This module does not offer any hardcoded configuration. So you
will get the default configuration until you change it in the
Tuxedo Control Center.
'';
};

config = mkIf cfg.enable {

hardware.tuxedo-keyboard.enable = true;
boot.kernelModules = [ "tuxedo_io" ];

environment.systemPackages = [
pkgs.tuxedo-control-center
];

services.dbus.packages = [ pkgs.tuxedo-control-center ];

systemd.services.tccd = {
path = [ pkgs.tuxedo-control-center ];

description = "Tuxedo Control Center Service";

wantedBy = [ "multi-user.target" ];

serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.tuxedo-control-center}/bin/tccd --start";
ExecStop = "${pkgs.tuxedo-control-center}/bin/tccd --stop";
};
};

systemd.services.tccd-sleep = {
path = [ pkgs.tuxedo-control-center ];

description = "Tuxedo Control Center Service (sleep/resume)";

wantedBy = [ "sleep.target" ];

unitConfig = {
StopWhenUnneeded = "yes";
};

serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";

ExecStart = "systemctl stop tccd";
ExecStop = "systemctl start tccd";
};
};
};
}
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
./hardware/rtl-sdr.nix
./hardware/steam-hardware.nix
./hardware/system-76.nix
./hardware/tuxedo-control-center.nix
./hardware/tuxedo-keyboard.nix
./hardware/ubertooth.nix
./hardware/usb-wwan.nix
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ in
txredisapi = handleTest ./txredisapi.nix {};
tuptime = handleTest ./tuptime.nix {};
turbovnc-headless-server = handleTest ./turbovnc-headless-server.nix {};
tuxedo = handleTest ./tuxedo.nix {};
tuxguitar = handleTest ./tuxguitar.nix {};
ucarp = handleTest ./ucarp.nix {};
udisks2 = handleTest ./udisks2.nix {};
Expand Down
20 changes: 20 additions & 0 deletions nixos/tests/tuxedo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "tuxedo";

meta = with pkgs.lib.maintainers; {
maintainers = [ blitz ];
};

machine =
{ ... }:

{
hardware.tuxedo-control-center.enable = true;
};

testScript = ''
start_all();
machine.wait_for_unit("tccd.service")
'';
})

0 comments on commit a0e0efe

Please sign in to comment.