From 0ce988ea8a1d9fbc61128cf8d31b45af4b3d0138 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:59:44 +1300 Subject: [PATCH] Extract IPTSd management into new option-enabled module --- microsoft/surface/common/default.nix | 1 + microsoft/surface/common/ipts/default.nix | 27 +++++++++++++++++++++++ microsoft/surface/default.nix | 8 +------ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 microsoft/surface/common/ipts/default.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 95d83a0..cf83775 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -6,6 +6,7 @@ let in { imports = [ ./kernel + ./ipts ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/common/ipts/default.nix b/microsoft/surface/common/ipts/default.nix new file mode 100644 index 0000000..4faf49e --- /dev/null +++ b/microsoft/surface/common/ipts/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + + cfg = config.microsoft-surface.ipts; + +in { + options.microsoft-surface.ipts = { + enable = mkEnableOption "Enable IPTSd for Microsoft Surface"; + }; + + config = mkMerge [ + { + microsoft-surface.ipts.enable = mkDefault false; + } + + (mkIf cfg.enable { + systemd.services.iptsd = { + description = "IPTSD"; + path = with pkgs; [ iptsd ]; + script = "iptsd"; + wantedBy = [ "multi-user.target" ]; + }; + }) + ]; +} diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index e1befef..6b84749 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -25,11 +25,5 @@ in { pkgs.surface-control ]; - systemd.services.iptsd = { - description = "IPTSD"; - script = "${pkgs.iptsd}/bin/iptsd"; - wantedBy = [ - "multi-user.target" - ]; - }; + microsoft-surface.ipts.enable = true; }