about summary refs log tree commit diff
path: root/modules/user
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-08 12:29:46 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-08 12:29:46 +0100
commit5e1ad35657c05f409a29ddc7a29501fc611111b0 (patch)
treea908b6d2ffdbbfe109962054618a7124335fc3a2 /modules/user
parentfc3eb9bbd45351fd27ed7e9ff6ca35e6eec48398 (diff)
services/vlock: Only include socket when enabled.
Just stumbled over this... even systems that do not define
vuizvui.user.aszlig.services.vlock.enable accidentally got the socket
file, which now is no longer the case.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/aszlig/services/vlock/default.nix44
1 files changed, 23 insertions, 21 deletions
diff --git a/modules/user/aszlig/services/vlock/default.nix b/modules/user/aszlig/services/vlock/default.nix
index 5eb5e83d..b7bb051b 100644
--- a/modules/user/aszlig/services/vlock/default.nix
+++ b/modules/user/aszlig/services/vlock/default.nix
@@ -30,26 +30,28 @@ in {
     enable = lib.mkEnableOption "console lock";
   };
 
-  config.systemd.sockets.vlock = {
-    description = "Console Lock Socket";
-    wantedBy = [ "sockets.target" ];
-    socketConfig.ListenStream = "/run/console-lock.sock";
-    socketConfig.Accept = true;
-  };
-
-  config.systemd.services."vlock@" = lib.mkIf cfg.enable {
-    description = "Lock All Consoles";
-    serviceConfig.Type = "oneshot";
-
-    #environment.USER = "%i"; XXX
-    environment.USER = "aszlig";
-
-    script = ''
-      retval=0
-      oldvt="$("${pkgs.kbd}/bin/fgconsole")"
-      "${vlock}/bin/vlock" -asn || retval=$?
-      if [ $retval -ne 0 ]; then "${pkgs.kbd}/bin/chvt" "$oldvt"; fi
-      exit $retval
-    '';
+  config = lib.mkIf cfg.enable {
+    systemd.sockets.vlock = {
+      description = "Console Lock Socket";
+      wantedBy = [ "sockets.target" ];
+      socketConfig.ListenStream = "/run/console-lock.sock";
+      socketConfig.Accept = true;
+    };
+
+    config.systemd.services."vlock@" = {
+      description = "Lock All Consoles";
+      serviceConfig.Type = "oneshot";
+
+      #environment.USER = "%i"; XXX
+      environment.USER = "aszlig";
+
+      script = ''
+        retval=0
+        oldvt="$("${pkgs.kbd}/bin/fgconsole")"
+        "${vlock}/bin/vlock" -asn || retval=$?
+        if [ $retval -ne 0 ]; then "${pkgs.kbd}/bin/chvt" "$oldvt"; fi
+        exit $retval
+      '';
+    };
   };
 }