{ lib, config, ... }: # Compatibility shim to provide services.logind.settings for NixOS 25.05 # This allows Jovian-NixOS to work with stable NixOS # REMOVE THIS FILE when upgrading to NixOS 25.11 or later with lib; let nixosVersion = config.system.nixos.release; isCompatibleVersion = versionOlder nixosVersion "25.11"; in { options.services.logind.settings = mkOption { type = types.attrsOf (types.attrsOf types.anything); default = {}; description = "systemd-logind configuration. See logind.conf(5) for available options."; }; config = mkMerge [ { assertions = [ { assertion = isCompatibleVersion; message = '' The Jovian compatibility shim (roles/jovian-compat.nix) is only needed for NixOS 25.05 and earlier. You are running NixOS ${nixosVersion}. Please remove 'roles/jovian-compat.nix' from your flake.nix imports. ''; } ]; } (mkIf (config.services.logind.settings != {}) { # Convert the settings to extraConfig format for older NixOS services.logind.extraConfig = let mkSection = section: settings: "[${section}]\n" + (concatStringsSep "\n" (mapAttrsToList (k: v: "${k}=${toString v}") settings)); in concatStringsSep "\n\n" (mapAttrsToList mkSection config.services.logind.settings); }) ]; }