From aab4b6765d3933e297bebd693d53ec29c931fa03 Mon Sep 17 00:00:00 2001 From: Bailey <2858049+bailey-busc@users.noreply.github.com> Date: Fri, 16 Jan 2026 00:01:51 -0500 Subject: [PATCH] nix: Support specifying systemd target (#1385) --- distro/nix/home.nix | 12 +++++++++--- distro/nix/nixos.nix | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/distro/nix/home.nix b/distro/nix/home.nix index 444f14f0..a3afa2af 100644 --- a/distro/nix/home.nix +++ b/distro/nix/home.nix @@ -73,6 +73,12 @@ in default = hasPluginSettings; description = ''Whether to manage plugin settings. Automatically enabled if any plugins have settings configured.''; }; + + systemd.target = lib.mkOption { + type = lib.types.str; + default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; + description = "Systemd target to bind to."; }; config = lib.mkIf cfg.enable { @@ -84,8 +90,8 @@ in systemd.user.services.dms = lib.mkIf cfg.systemd.enable { Unit = { Description = "DankMaterialShell"; - PartOf = [ config.wayland.systemd.target ]; - After = [ config.wayland.systemd.target ]; + PartOf = [ cfg.systemd.target ]; + After = [ cfg.systemd.target ]; }; Service = { @@ -93,7 +99,7 @@ in Restart = "on-failure"; }; - Install.WantedBy = [ config.wayland.systemd.target ]; + Install.WantedBy = [ cfg.systemd.target ]; }; xdg.stateFile."DankMaterialShell/session.json" = lib.mkIf (cfg.session != { }) { diff --git a/distro/nix/nixos.nix b/distro/nix/nixos.nix index ec2bdeff..c873ca1c 100644 --- a/distro/nix/nixos.nix +++ b/distro/nix/nixos.nix @@ -20,15 +20,19 @@ in imports = [ (import ./options.nix args) ]; - + options.programs.dank-material-shell.systemd.target = lib.mkOption { + type = lib.types.str; + description = "Systemd target to bind to."; + default = "graphical-session.target"; + }; config = lib.mkIf cfg.enable { systemd.user.services.dms = lib.mkIf cfg.systemd.enable { description = "DankMaterialShell"; path = lib.mkForce [ ]; - partOf = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - wantedBy = [ "graphical-session.target" ]; + partOf = [ cfg.systemd.target ]; + after = [ cfg.systemd.target ]; + wantedBy = [ cfg.systemd.target ]; restartIfChanged = cfg.systemd.restartIfChanged; serviceConfig = {