feat(hyprland): ensure correct service order
parent
da18eac2da
commit
300d5058c5
|
@ -100,7 +100,12 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
startInBackground = true;
|
startInBackground = true;
|
||||||
};
|
};
|
||||||
|
systemd.user.services.nextcloud-client.Service = {
|
||||||
|
RestartSec = "500ms";
|
||||||
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
illum.enable = true;
|
illum.enable = true;
|
||||||
resolved.enable = true;
|
resolved.enable = true;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ config
|
{ config
|
||||||
, lib
|
, lib
|
||||||
, pkgs
|
, pkgs
|
||||||
, inputs
|
|
||||||
, ...
|
, ...
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
|
@ -9,8 +8,7 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.my.programs.hyprland;
|
cfg = config.my.programs.hyprland;
|
||||||
|
|
||||||
hyprland-nvidia = pkgs.hyprland.override { enableNvidiaPatches = true; };
|
hyprland = config.programs.hyprland.finalPackage;
|
||||||
hyprland = if cfg.nvidiaSupport then hyprland-nvidia else pkgs.hyprland;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.programs.hyprland = {
|
options.my.programs.hyprland = {
|
||||||
|
@ -50,16 +48,33 @@ in
|
||||||
rofi.enable = true;
|
rofi.enable = true;
|
||||||
};
|
};
|
||||||
wallpapers.enable = true;
|
wallpapers.enable = true;
|
||||||
services.dunst.enable = true;
|
services = {
|
||||||
services.wallpaper.enable = true;
|
dunst.enable = true;
|
||||||
|
wallpaper = {
|
||||||
|
enable = true;
|
||||||
|
target = "hyprland-session.target";
|
||||||
|
};
|
||||||
|
spotify-player.target = "hyprland-session.target";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
enableNvidiaPatches = cfg.nvidiaSupport;
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.moritz = {
|
home-manager.users.moritz = {
|
||||||
# enable home-manager module
|
# enable home-manager module
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = hyprland;
|
enableNvidiaPatches = cfg.nvidiaSupport;
|
||||||
extraConfig = import ./_config.nix args;
|
extraConfig = import ./_config.nix args;
|
||||||
|
systemd.extraCommands = [
|
||||||
|
"systemctl --user stop hyprland-session.target"
|
||||||
|
"sleep 1.5"
|
||||||
|
"systemctl --user start hyprland-session.target"
|
||||||
|
"systemctl --user start xdg-desktop-portal-hyprland.service"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# add waybar as a status bar
|
# add waybar as a status bar
|
||||||
|
@ -69,7 +84,7 @@ in
|
||||||
# start using systemd service
|
# start using systemd service
|
||||||
systemd = {
|
systemd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
target = "graphical-session.target";
|
target = "hyprland-session.target";
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -128,23 +143,13 @@ in
|
||||||
timeout = 30 * 60;
|
timeout = 30 * 60;
|
||||||
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
||||||
};
|
};
|
||||||
systemdTarget = "graphical-session.target";
|
systemdTarget = "hyprland-session.target";
|
||||||
};
|
|
||||||
|
|
||||||
systemd.user.services.nextcloud-client.Service = {
|
|
||||||
RestartSec = "500ms";
|
|
||||||
Restart = "on-failure";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# adds pam module for swaylock
|
# adds pam module for swaylock
|
||||||
security.pam.services.swaylock = { };
|
security.pam.services.swaylock = { };
|
||||||
|
|
||||||
systemd.user.services.xdg-desktop-portal-hyprland = {
|
|
||||||
after = [ "hyprland-session.target" ];
|
|
||||||
requiredBy = [ "xdg-desktop-portal.service" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# add user packages for wayland and hyprland in particular
|
# add user packages for wayland and hyprland in particular
|
||||||
users.users.moritz.packages = with pkgs; [
|
users.users.moritz.packages = with pkgs; [
|
||||||
brightnessctl # control brightness
|
brightnessctl # control brightness
|
||||||
|
@ -177,7 +182,6 @@ in
|
||||||
__GL_VRR_ALLOWED = "0";
|
__GL_VRR_ALLOWED = "0";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
dbus.enable = true;
|
dbus.enable = true;
|
||||||
# use pipewire (needed for screensharing)
|
# use pipewire (needed for screensharing)
|
||||||
|
@ -196,18 +200,31 @@ in
|
||||||
user = "moritz";
|
user = "moritz";
|
||||||
};
|
};
|
||||||
defaultSession = "hyprland";
|
defaultSession = "hyprland";
|
||||||
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
|
home-manager.users.moritz.systemd.user.services =
|
||||||
# desktop portal (for screensharing)
|
let
|
||||||
xdg.portal = {
|
units = [ "waybar" ];
|
||||||
enable = true;
|
mkAfter = _: {
|
||||||
wlr.enable = mkForce false;
|
Unit = {
|
||||||
extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
|
After = [ "hyprland-session.target" ];
|
||||||
|
Wants = [ "hyprland-session.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
genAttrs units mkAfter;
|
||||||
|
|
||||||
|
systemd.user.services =
|
||||||
|
let
|
||||||
|
units = [ "pipewire" "xdg-desktop-portal" "xdg-desktop-portal-hyprland" "wireplumber" ];
|
||||||
|
mkAfter = _: {
|
||||||
|
after = [ "hyprland-session.target" ];
|
||||||
|
wants = [ "hyprland-session.target" ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
genAttrs units mkAfter;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@ in
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.spotify-player;
|
default = pkgs.spotify-player;
|
||||||
};
|
};
|
||||||
|
target = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "graphical-session.target";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -44,9 +48,8 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
systemd.user.services.spotify-player = {
|
systemd.user.services.spotify-player = {
|
||||||
after = [ "graphical-session.target" "network.target" ];
|
after = [ cfg.target "network.target" ];
|
||||||
partOf = [ "graphical-session.target" ];
|
wantedBy = [ cfg.target ];
|
||||||
wantedBy = [ "graphical-session.target" ];
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
|
|
@ -10,12 +10,17 @@ in
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "30m";
|
default = "30m";
|
||||||
};
|
};
|
||||||
|
target = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "graphical-session.target";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.user.services.wallpaper = {
|
systemd.user.services.wallpaper = {
|
||||||
script = "${getExe config.my.programs.wallpaper.package} -r -v";
|
script = "${getExe config.my.programs.wallpaper.package} -r -v";
|
||||||
wantedBy = [ "graphical-session.target" ];
|
wantedBy = [ cfg.target ];
|
||||||
|
after = [ cfg.target ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RuntimeMaxSec = cfg.frequency;
|
RuntimeMaxSec = cfg.frequency;
|
||||||
|
|
Loading…
Reference in New Issue