all repos — nixfiles @ 05571aa5ed5eb898be468bff237657914f7e9dcf

System and user configuration, managed by nix and home-manager

Delay startup of non-essential services
Alan Pearce alan@alanpearce.eu
Sun, 29 Apr 2018 15:00:53 +0200
commit

05571aa5ed5eb898be468bff237657914f7e9dcf

parent

68f44953449af2ad3565426e1716757fe7afc04b

M modules/hardware/laptop.nixmodules/hardware/laptop.nix
@@ -6,7 +6,18 @@ x86_energy_perf_policy   ];
 
   hardware = {
-    bluetooth.enable = true;
+    bluetooth = {
+      enable = true;
+      powerOnBoot = false;
+    };
+  };
+  systemd.services.bluetooth.wantedBy = lib.mkForce [];
+  systemd.timers.bluetooth = {
+    description = "Delayed startup of Bluetooth";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
   };
 
   environment.systemPackages = with pkgs; [
M modules/hardware/nitrokey.nixmodules/hardware/nitrokey.nix
@@ -1,4 +1,4 @@-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 { programs.ssh.startAgent = false;
 
@@ -24,6 +24,14 @@ socksListenAddress = "9050 IPv6Traffic";     };
     torsocks = {
       enable = true;
+    };
+  };
+  systemd.services.tor.wantedBy = lib.mkForce [];
+  systemd.timers.tor = {
+    description = "Delayed startup of Tor";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
     };
   };
 
M modules/hardware/printing.nixmodules/hardware/printing.nix
@@ -3,6 +3,15 @@ { services.printing.enable = true;
   systemd.services.cups.wantedBy = lib.mkForce [];
   systemd.sockets.cups.wantedBy = [ "sockets.target" ];
+  systemd.services.cups-browsed.wantedBy = lib.mkForce [];
+
+  systemd.timers.cups-browsed = {
+    description = "Delayed startup of CUPS Remote Printer Discovery";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "2 min";
+    };
+  };
 
   imports = [
     ../services/zeroconf.nix
M modules/services/zeroconf.nixmodules/services/zeroconf.nix
@@ -1,7 +1,16 @@-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 { services.avahi = {
     enable = true;
     nssmdns = true;
+    ipv6 = true;
+  };
+  systemd.services.avahi-daemon.wantedBy = lib.mkForce [];
+  systemd.timers.avahi-daemon = {
+    description = "Delayed startup of Avahi";
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "1 min";
+    };
   };
 }