git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #95337 from pasqui23/switchctl
commit493bbc968b89c942d34d2c46fe12e9ac1c77764e authorJan Tojnar <jtojnar@gmail.com> dateFri 5 Feb 2021, 18:05 (6 years ago) parentc25f19bf5f9a06
3 files changed+78
nixos/modules/hardware/video/switcheroo-control.nix+18 pkgs/os-specific/linux/switcheroo-control/default.nix+58 pkgs/top-level/all-packages.nix+2
nixos/modules/hardware/video/switcheroo-control.nixnew file+18
@@ -0,0 +1,18 @@
1+{ config, pkgs, lib, ... }:
2+
3+with lib;
4+let
5+ pkg = [ pkgs.switcheroo-control ];
6+ cfg = config.services.switcherooControl;
7+in {
8+ options.services.switcherooControl = {
9+ enable = mkEnableOption "switcheroo-control, a D-Bus service to check the availability of dual-GPU";
10+ };
11+
12+ config = mkIf cfg.enable {
13+ services.dbus.packages = pkg;
14+ environment.systemPackages = pkg;
15+ systemd.packages = pkg;
16+ systemd.targets.multi-user.wants = [ "switcheroo-control.service" ];
17+ };
18+}
pkgs/os-specific/linux/switcheroo-control/default.nixnew file+58
@@ -0,0 +1,58 @@
1+{ lib
2+, ninja
3+, meson
4+, fetchFromGitLab
5+, systemd
6+, libgudev
7+, pkg-config
8+, glib
9+, python3
10+, gobject-introspection
11+}:
12+
13+python3.pkgs.buildPythonApplication rec {
14+ pname = "switcheroo-control";
15+ version = "2.3";
16+
17+ format = "other";
18+
19+ src = fetchFromGitLab {
20+ domain = "gitlab.freedesktop.org";
21+ owner = "hadess";
22+ repo = pname;
23+ rev = version;
24+ hash = "sha256-1Pze2TJ9mggfcpiLFwJ7/9WhsdJx4G3GoA7+Z47shuc=";
25+ };
26+
27+ nativeBuildInputs = [
28+ ninja
29+ meson
30+ pkg-config
31+
32+ # needed for glib-compile-resources
33+ glib
34+ ];
35+
36+ buildInputs = [
37+ systemd
38+ libgudev
39+ ];
40+
41+ propagatedBuildInputs = [
42+ python3.pkgs.pygobject3
43+ ];
44+
45+ mesonFlags = [
46+ "-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
47+ "-Dhwdbdir=${placeholder "out"}/etc/udev/hwdb.d"
48+ ];
49+
50+ meta = with lib; {
51+ description = "D-Bus service to check the availability of dual-GPU";
52+ homepage = "https://gitlab.freedesktop.org/hadess/switcheroo-control/";
53+ changelog = "https://gitlab.freedesktop.org/hadess/switcheroo-control/-/blob/${version}/NEWS";
54+ license = licenses.gpl3Plus;
55+ maintainers = [ ];
56+ platforms = platforms.linux;
57+ };
58+}
pkgs/top-level/all-packages.nix+2
@@ -18436,6 +18436,8 @@ in
1843618436
1843718437 storm = callPackage ../servers/computing/storm { };
1843818438
18439+ switcheroo-control = callPackage ../os-specific/linux/switcheroo-control { };
18440+
1843918441 slurm = callPackage ../servers/computing/slurm { gtk2 = null; };
1844018442
1844118443 slurm-spank-x11 = callPackage ../servers/computing/slurm-spank-x11 { };