From eb53536dcf1abc3a28a119b98fe531ce20a41f9d Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Fri, 7 Jan 2022 23:25:08 +0100
Subject: [PATCH] Remove loginctl-linger module (outdated/broken)

---
 modules/default.nix         |  1 -
 modules/loginctl-linger.nix | 48 -------------------------------------
 2 files changed, 49 deletions(-)
 delete mode 100644 modules/loginctl-linger.nix

diff --git a/modules/default.nix b/modules/default.nix
index d89a940..78b9ce9 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -2,7 +2,6 @@
 
 {
   imports = [
-    #./loginctl-linger.nix
     ./desktop
     ./desktop/launcher.nix
     ./sway
diff --git a/modules/loginctl-linger.nix b/modules/loginctl-linger.nix
deleted file mode 100644
index b01e82c..0000000
--- a/modules/loginctl-linger.nix
+++ /dev/null
@@ -1,48 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-# A temporary hack to `loginctl enable-linger $somebody` (for
-# multiplexer sessions to last), until this one is unresolved:
-# https://github.com/NixOS/nixpkgs/issues/3702
-#
-# Usage: `users.extraUsers.somebody.linger = true` or slt.
-#
-# From: https://github.com/michalrus/dotfiles/blob/master/nixos-config/modules/loginctl-linger.nix
-
-with lib;
-
-let
-
-  dataDir = "/var/lib/systemd/linger";
-
-  lingeringUsers = map (u: u.name) (attrValues (flip filterAttrs config.users.users (n: u: u.linger)));
-
-  lingeringUsersFile = builtins.toFile "lingering-users"
-    (concatStrings (map (s: "${s}\n")
-      (sort (a: b: a < b) lingeringUsers))); # this sorting is important for `comm` to work correctly
-
-  updateLingering = pkgs.writeScript "update-lingering" ''
-    # Stop when the system is not running, e.g. during nixos-install
-    [[ -e /run/booted-system ]] || exit 0
-    #mkdir -p ${dataDir}
-    lingering=$(ls ${dataDir} 2> /dev/null | sort)
-    echo "$lingering" | comm -3 -1 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl disable-linger
-    echo "$lingering" | comm -3 -2 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl enable-linger
-  '';
-
-in
-
-{
-  options = {
-    users.users = mkOption {
-      options = [{
-        linger = mkEnableOption "lingering for the user";
-      }];
-    };
-  };
-
-  config = {
-    #systemd.services.systemd-logind.serviceConfig = { ReadWritePaths = "/var/lib/systemd/linger"; };
-    system.activationScripts.update-lingering =
-      stringAfter [ "users" ] updateLingering;
-  };
-}
-- 
GitLab