mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	Extract IPTSd management into new option-enabled module
This commit is contained in:
		@@ -6,6 +6,7 @@ let
 | 
			
		||||
in {
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./kernel
 | 
			
		||||
    ./ipts
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  microsoft-surface.kernelVersion = mkDefault "6.0.11";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								microsoft/surface/common/ipts/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								microsoft/surface/common/ipts/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -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" ];
 | 
			
		||||
      };
 | 
			
		||||
    })
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user