summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.nix3
-rw-r--r--flake.lock18
-rw-r--r--modules/logind.nix121
-rw-r--r--modules/seatd.nix51
4 files changed, 9 insertions, 184 deletions
diff --git a/common.nix b/common.nix
index 831b4aa..fa6172e 100644
--- a/common.nix
+++ b/common.nix
@@ -11,14 +11,11 @@ in
disabledModules = [
"services/networking/pppd.nix"
"services/networking/iwd.nix"
- "system/boot/systemd/logind.nix"
];
imports = [
./modules/userdata.nix
./modules/dev.nix
./modules/pppd.nix
- ./modules/seatd.nix
- ./modules/logind.nix
./modules/iwd.nix
];
diff --git a/flake.lock b/flake.lock
index 3ae3be6..d60739a 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
- "lastModified": 1698318101,
- "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=",
+ "lastModified": 1700794826,
+ "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
"owner": "NixOs",
"repo": "nixpkgs",
- "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c",
+ "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
"type": "github"
},
"original": {
@@ -18,11 +18,11 @@
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1698544399,
- "narHash": "sha256-vhRmPyEyoPkrXF2iykBsWHA05MIaOSmMRLMF7Hul6+s=",
+ "lastModified": 1700905716,
+ "narHash": "sha256-w1vHn2MbGfdC+CrP3xLZ3scsI06N0iQLU7eTHIVEFGw=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "d87c5d8c41c9b3b39592563242f3a448b5cc4bc9",
+ "rev": "dfb95385d21475da10b63da74ae96d89ab352431",
"type": "github"
},
"original": {
@@ -46,11 +46,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
- "lastModified": 1698548647,
- "narHash": "sha256-7c03OjBGqnwDW0FBaBc+NjfEBxMkza+dxZGJPyIzfFE=",
+ "lastModified": 1700967639,
+ "narHash": "sha256-uuUwD/O1QcVk+TWPZFwl4ioUkC8iACj0jEXSyE/wGPI=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "632c3161a6cc24142c8e3f5529f5d81042571165",
+ "rev": "4be58d802693d7def8622ff34d36714f8db40371",
"type": "github"
},
"original": {
diff --git a/modules/logind.nix b/modules/logind.nix
deleted file mode 100644
index 5e6dcdf..0000000
--- a/modules/logind.nix
+++ /dev/null
@@ -1,121 +0,0 @@
-{ config, lib, ... }:
-
-let
- cfg = config.services.logind;
- inherit (lib) mkOption types;
-
- logindHandlerType = types.enum [
- "ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
- "hibernate" "hybrid-sleep" "suspend-then-hibernate" "lock"
- ];
-in
-{
- options.services.logind = {
- enable = mkOption {
- default = true;
- description = "Whether to enable logind.";
- type = types.bool;
- };
-
- extraConfig = mkOption {
- default = "";
- type = types.lines;
- example = "IdleAction=lock";
- description = lib.mdDoc ''
- Extra config options for systemd-logind. See
- [
- logind.conf(5)](https://www.freedesktop.org/software/systemd/man/logind.conf.html) for available options.
- '';
- };
-
- killUserProcesses = mkOption {
- default = false;
- type = types.bool;
- description = lib.mdDoc ''
- Specifies whether the processes of a user should be killed
- when the user logs out. If true, the scope unit corresponding
- to the session and all processes inside that scope will be
- terminated. If false, the scope is "abandoned" (see
- [systemd.scope(5)](https://www.freedesktop.org/software/systemd/man/systemd.scope.html#)), and processes are not killed.
-
- See [logind.conf(5)](https://www.freedesktop.org/software/systemd/man/logind.conf.html#KillUserProcesses=)
- for more details.
- '';
- };
-
- lidSwitch = mkOption {
- default = "suspend";
- example = "ignore";
- type = logindHandlerType;
-
- description = lib.mdDoc ''
- Specifies what to be done when the laptop lid is closed.
- '';
- };
-
- lidSwitchDocked = mkOption {
- default = "ignore";
- example = "suspend";
- type = logindHandlerType;
-
- description = lib.mdDoc ''
- Specifies what to be done when the laptop lid is closed
- and another screen is added.
- '';
- };
-
- lidSwitchExternalPower = mkOption {
- default = cfg.lidSwitch;
- defaultText = lib.literalExpression "services.logind.lidSwitch";
- example = "ignore";
- type = logindHandlerType;
-
- description = lib.mdDoc ''
- Specifies what to do when the laptop lid is closed and the system is
- on external power. By default use the same action as specified in
- services.logind.lidSwitch.
- '';
- };
- };
-
- config = lib.mkIf cfg.enable {
- systemd.additionalUpstreamSystemUnits = [
- "systemd-logind.service"
- "autovt@.service"
- "systemd-user-sessions.service"
- ] ++ lib.optionals config.systemd.package.withImportd [
- "dbus-org.freedesktop.import1.service"
- ] ++ lib.optionals config.systemd.package.withMachined [
- "dbus-org.freedesktop.machine1.service"
- ] ++ lib.optionals config.systemd.package.withPortabled [
- "dbus-org.freedesktop.portable1.service"
- ] ++ [
- "dbus-org.freedesktop.login1.service"
- "user@.service"
- "user-runtime-dir@.service"
- ];
-
- environment.etc = {
- "systemd/logind.conf".text = ''
- [Login]
- KillUserProcesses=${if cfg.killUserProcesses then "yes" else "no"}
- HandleLidSwitch=${cfg.lidSwitch}
- HandleLidSwitchDocked=${cfg.lidSwitchDocked}
- HandleLidSwitchExternalPower=${cfg.lidSwitchExternalPower}
- ${cfg.extraConfig}
- '';
- };
-
- # Restarting systemd-logind breaks X11
- # - upstream commit: https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101
- # - systemd announcement: https://github.com/systemd/systemd/blob/22043e4317ecd2bc7834b48a6d364de76bb26d91/NEWS#L103-L112
- # - this might be addressed in the future by xorg
- #systemd.services.systemd-logind.restartTriggers = [ config.environment.etc."systemd/logind.conf".source ];
- systemd.services.systemd-logind.restartIfChanged = false;
- systemd.services.systemd-logind.stopIfChanged = false;
-
- # The user-runtime-dir@ service is managed by systemd-logind we should not touch it or else we break the users' sessions.
- systemd.services."user-runtime-dir@".stopIfChanged = false;
- systemd.services."user-runtime-dir@".restartIfChanged = false;
- };
-}
diff --git a/modules/seatd.nix b/modules/seatd.nix
deleted file mode 100644
index 51977df..0000000
--- a/modules/seatd.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-let
- cfg = config.services.seatd;
- inherit (lib) mkEnableOption mkOption mdDoc types;
-in
-{
- meta.maintainers = with lib.maintainers; [ sinanmohd ];
-
- options.services.seatd = {
- enable = mkEnableOption (mdDoc "seatd");
-
- user = mkOption {
- type = types.str;
- default = "root";
- description = mdDoc "User to own the seatd socket";
- };
- group = mkOption {
- type = types.str;
- default = "seat";
- description = mdDoc "Group to own the seatd socket";
- };
- logLevel = mkOption {
- type = types.enum [ "debug" "info" "error" "silent" ];
- default = "info";
- description = mdDoc "Logging verbosity";
- };
- };
-
- config = lib.mkIf cfg.enable {
- environment.systemPackages = with pkgs; [ seatd sdnotify-wrapper ];
- users.groups.seat = lib.mkIf (cfg.group == "seat") {};
-
- systemd.services.seatd = {
- description = "Seat management daemon";
- documentation = [ "man:seatd(1)" ];
-
- wantedBy = [ "multi-user.target" ];
- restartIfChanged = false;
-
- serviceConfig = {
- Type = "notify";
- NotifyAccess = "all";
- SyslogIdentifier = "seatd";
- ExecStart = "${pkgs.sdnotify-wrapper}/bin/sdnotify-wrapper ${pkgs.seatd.bin}/bin/seatd -n 1 -u ${cfg.user} -g ${cfg.group} -l ${cfg.logLevel}";
- RestartSec = 1;
- Restart = "always";
- };
- };
- };
-}