about summary refs log tree commit diff
path: root/modules/user
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2019-03-11 19:35:19 +0100
committeraszlig <aszlig@nix.build>2019-03-11 19:35:19 +0100
commitcffd945c9a8b00164a3240f92be81bfcb821ec4d (patch)
tree64a08515580f8b5939ea75aa9211e60f593ff581 /modules/user
parent185f186b9f25fa31932cd7a1f188b0c864fac4be (diff)
modules/vlock: Allow to change the user name
When writing that module back then in 88a10f1a6e2ea172ff985f64bfcf82e2,
I had to work around a systemd limitation (which I need to check whether
this is still the case today) and hardcoded the user name for the time
being.

While it's still quite ugly, there was interest from @Profpatsch, so I
decided to add an internal option to change that username.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/aszlig/profiles/workstation/default.nix1
-rw-r--r--modules/user/aszlig/services/vlock/default.nix12
2 files changed, 12 insertions, 1 deletions
diff --git a/modules/user/aszlig/profiles/workstation/default.nix b/modules/user/aszlig/profiles/workstation/default.nix
index 790ca92f..e9893f29 100644
--- a/modules/user/aszlig/profiles/workstation/default.nix
+++ b/modules/user/aszlig/profiles/workstation/default.nix
@@ -57,6 +57,7 @@ in {
     vuizvui.user.aszlig.services.i3.enable = true;
     vuizvui.user.aszlig.services.slim.enable = true;
     vuizvui.user.aszlig.services.vlock.enable = true;
+    vuizvui.user.aszlig.services.vlock.user = "aszlig";
 
     vuizvui.user.aszlig.programs.mpv.enable = true;
     vuizvui.user.aszlig.programs.taskwarrior.enable = true;
diff --git a/modules/user/aszlig/services/vlock/default.nix b/modules/user/aszlig/services/vlock/default.nix
index 2eced029..439c1b07 100644
--- a/modules/user/aszlig/services/vlock/default.nix
+++ b/modules/user/aszlig/services/vlock/default.nix
@@ -28,6 +28,16 @@ let
 in {
   options.vuizvui.user.aszlig.services.vlock = {
     enable = lib.mkEnableOption "console lock";
+
+    user = lib.mkOption {
+      type = lib.types.str;
+      example = "horst";
+      internal = true;
+      description = ''
+        The user under which the locked session will run. This is a workaround
+        and thus this option is solely internal.
+      '';
+    };
   };
 
   config = lib.mkIf cfg.enable {
@@ -43,7 +53,7 @@ in {
       serviceConfig.Type = "oneshot";
 
       #environment.USER = "%i"; XXX
-      environment.USER = "aszlig";
+      environment.USER = cfg.user;
 
       script = ''
         retval=0