Home-manager throws errors when configuring hyprland

Hi! basically exactly what the title says

this is the entire hyprland home manager file

hyprland-hm.nix
{ config, pkgs, lib, ... }:

{
  # waybar-mediaplayer-script = import ./custom-packages/Waybar-media-player/waybar-media-player.nix;

  qt.enable = true;

  home.pointerCursor = {
    gtk.enable = true;
    # x11.enable = true;
    package = pkgs.bibata-cursors;
    name = "Bibata-Modern-Classic";
    size = 16;
  };

  gtk = {
    enable = true;

    theme = {
      package = pkgs.flat-remix-gtk;
      name = "Flat-Remix-GTK-Grey-Darkest";
    };

    iconTheme = {
      package = pkgs.adwaita-icon-theme;
      name = "Adwaita";
    };

    font = {
      name = "Sans";
      size = 11;
    };
  };

  wayland.windowManager.hyprland = {
    enable = true;
    #package = inputs.hyprland.packages."${unstable.system}".hyprland;
    #portalPackage = null;

    # plugins = [

    # ];

    settings = {
      ################
      ### MONITORS ###
      ################

      # See https://wiki.hyprland.org/Configuring/Monitors/
      monitor = "IP,2560x1600@165,auto,1.6";


      ###################
      ### MY PROGRAMS ###
      ###################

      # See https://wiki.hyprland.org/Configuring/Keywords/

      # Set programs that you use
      "$terminal" = "konsole";
      "$editer" = "code";
      "$fileManager" = "dolphin";
      "$menu" = "wofi --show drun";
      "$configManager" = "github-desktop";

      #################
      ### AUTOSTART ###
      #################

      # Autostart necessary processes (like notifications daemons, status bars, etc.)
      # Or execute your favorite apps at launch like this:

      # exec-once = $terminal
      exec-once = [
        "hypridle & hyprpaper"
        "/nix/store/jnj624874l5rdp19vnszzsf7cvfgimkk-kwallet-pam-6.3.2/libexec/pam_kwallet_init & nm-applet"
        "systemctl --user start plasma-polkit-agent"
        "sleep 2; ~/.config/hypr/change_wallpapers.sh"
        "nix-shell /etc/nixos/shell.nix --run waybar"
        "sleep 4; vesktop --start-minimized"
        "mako"
      ];


      #############################
      ### ENVIRONMENT VARIABLES ###
      #############################

      # See https://wiki.hyprland.org/Configuring/Environment-variables/

      env = [
        "XCURSOR_SIZE,18"
        "HYPRCURSOR_SIZE,18"
        #for kde apps you need to install: sudo pacman -S qt5ct qt6ct kvantum kvantum breeze-icons   
        #you will need to set dark theme for qt apps from kde more difficult thans with gnome :D:
        "QT_QPA_PLATFORMTHEME,qt6ct"   # for Qt apps# Theme
      ];

      #for libadwaita gtk4 apps you can use this command:
      exec = [
      ];

      #####################
      ### LOOK AND FEEL ###
      #####################

      # Refer to https://wiki.hyprland.org/Configuring/Variables/

      # https://wiki.hyprland.org/Configuring/Variables/#general
      general = {
          gaps_in = "5";
          gaps_out = "5";

          border_size = "2";

          # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
          "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
          "col.inactive_border" = "rgba(595959aa)";

          # Set to true enable resizing windows by clicking and dragging on borders and gaps
          resize_on_border = "false";

          # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
          allow_tearing = "false";

          layout = "dwindle";
      };

      # https://wiki.hyprland.org/Configuring/Variables/#decoration
      decoration = {
          rounding = "5";

          # Change transparency of focused and unfocused windows
          active_opacity = "0.95";
          inactive_opacity = "0.5";

          shadow = {
              enabled = "true";
              range = "4";
              render_power = "3";
              color = "rgba(1a1a1aee)";
          };

          # https://wiki.hyprland.org/Configuring/Variables/#blur
          blur = {
              enabled = "false";
              size = "3";
              passes = "1";

              vibrancy = "0.1696";
          };
      };

      # https://wiki.hyprland.org/Configuring/Variables/#animations
      animations = {
          enabled = "yes, please :)";

          # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more

          bezier = [
            "easeOutQuint,0.23,1,0.32,1"
            "easeInOutCubic,0.65,0.05,0.36,1"
            "linear,0,0,1,1"
            "almostLinear,0.5,0.5,0.75,1.0"
            "quick,0.15,0,0.1,1"
          ];

          animation = [
            "global, 1, 10, default"
            "border, 1, 5.39, easeOutQuint"
            "windows, 1, 4.79, easeOutQuint"
            "windowsIn, 1, 4.1, easeOutQuint, popin 87%"
            "windowsOut, 1, 1.49, linear, popin 87%"
            "fadeIn, 1, 1.73, almostLinear"
            "fadeOut, 1, 1.46, almostLinear"
            "fade, 1, 3.03, quick"
            "layers, 1, 3.81, easeOutQuint"
            "layersIn, 1, 4, easeOutQuint, fade"
            "layersOut, 1, 1.5, linear, fade"
            "fadeLayersIn, 1, 1.79, almostLinear"
            "fadeLayersOut, 1, 1.39, almostLinear"
            "workspaces, 1, 1.94, almostLinear, fade"
            "workspacesIn, 1, 1.21, almostLinear, fade"
            "workspacesOut, 1, 1.94, almostLinear, fade"
          ];
      };

      # Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
      # "Smart gaps" / "No gaps when only"
      # uncomment all if you wish to use that.
      # workspace = w[tv1], gapsout:0, gapsin:0
      # workspace = f[1], gapsout:0, gapsin:0
      # windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1]
      # windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1]
      # windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
      # windowrulev2 = rounding 0, floating:0, onworkspace:f[1]

      # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
      dwindle = {
          pseudotile = "true"; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
          preserve_split = "true"; # You probably want this
      };

      # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
      master = {
          new_status = "master";
      };

      # https://wiki.hyprland.org/Configuring/Variables/#misc
      misc = {
          force_default_wallpaper = "-1"; # Set to 0 or 1 to disable the anime mascot wallpapers
          disable_hyprland_logo = "true"; # If true disables the random hyprland logo / anime girl background. :(
          disable_splash_rendering = "true";
      };


      #############
      ### INPUT ###
      #############

      # https://wiki.hyprland.org/Configuring/Variables/#input
      input = {
          kb_layout = "us";
          kb_variant = "";
          kb_model = "pc104";
          kb_options = "";
          kb_rules = "";

          follow_mouse = "1";

          sensitivity = "0"; # -1.0 - 1.0, 0 means no modification.

          touchpad = {
              natural_scroll = "false";
              clickfinger_behavior = "true";
          };
      };

      # https://wiki.hyprland.org/Configuring/Variables/#gestures
      gestures = {
          workspace_swipe = "false";
      };

      # Example per-device config
      # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
      device = {
          name = "epic-mouse-v1";
          sensitivity = "-0.5";
      };

      ###################
      ### KEYBINDINGS ###
      ###################

      # See https://wiki.hyprland.org/Configuring/Keywords/
      "$mainMod" = "SUPER"; # Sets "Windows" key as main modifier

      # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
      bind = [
        "$mainMod, Q, exec, $terminal"
        "$mainMod, C, killactive,"
        "$mainMod, M, exec, wlogout --protocol layer-shell"
        "$mainMod, D, exec, $fileManager"
        "$mainMod, V, togglefloating,"
        "$mainMod, R, exec, $menu"
        "$mainMod, P, pseudo," # dwindle
        "$mainMod, J, togglesplit," # dwindle
        "$mainMod, E, exec, $editer"
        "$mainMod, G, exec, $configManager"

        # Screenshot a window
        "$mainMod, PRINT, exec, hyprshot -m window"
        # Screenshot a monitor
        ", PRINT, exec, hyprshot -m output"
        # Screenshot a region
        "$mainMod SHIFT, PRINT, exec, hyprshot -m region"

        # Move focus with mainMod + arrow keys
        "$mainMod, left, movefocus, l"
        "$mainMod, right, movefocus, r"
        "$mainMod, up, movefocus, u"
        "$mainMod, down, movefocus, d"

        # Switch workspaces with mainMod + [0-9]
        "$mainMod, 1, workspace, 1"
        "$mainMod, 2, workspace, 2"
        "$mainMod, 3, workspace, 3"
        "$mainMod, 4, workspace, 4"
        "$mainMod, 5, workspace, 5"
        "$mainMod, 6, workspace, 6"
        "$mainMod, 7, workspace, 7"
        "$mainMod, 8, workspace, 8"
        "$mainMod, 9, workspace, 9"
        "$mainMod, 0, workspace, 10"

        # Move active window to a workspace with mainMod + SHIFT + [0-9]
        "$mainMod SHIFT, 1, movetoworkspace, 1"
        "$mainMod SHIFT, 2, movetoworkspace, 2"
        "$mainMod SHIFT, 3, movetoworkspace, 3"
        "$mainMod SHIFT, 4, movetoworkspace, 4"
        "$mainMod SHIFT, 5, movetoworkspace, 5"
        "$mainMod SHIFT, 6, movetoworkspace, 6"
        "$mainMod SHIFT, 7, movetoworkspace, 7"
        "$mainMod SHIFT, 8, movetoworkspace, 8"
        "$mainMod SHIFT, 9, movetoworkspace, 9"
        "$mainMod SHIFT, 0, movetoworkspace, 10"

        # Example special workspace (scratchpad)
        "$mainMod, S, togglespecialworkspace, magic"
        "$mainMod SHIFT, S, movetoworkspace, special:magic"

        # Scroll through existing workspaces with mainMod + scroll
        "$mainMod, mouse_down, workspace, e+1"
        "$mainMod, mouse_up, workspace, e-1"
      ];

      bindm = [
      # Move/resize windows with mainMod + LMB/RMB and dragging
      "$mainMod, mouse:272, movewindow"
      "$mainMod, mouse:273, resizewindow"
      ];

      bindl = [
        # Laptop multimedia keys for volume and LCD brightness
        ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"
        ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
        ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
        ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
        ",XF86MonBrightnessUp, exec, brightnessctl s 10%+"
        ",XF86MonBrightnessDown, exec, brightnessctl s 10%-"

        # Requires playerctl
        ", XF86AudioNext, exec, playerctl next"
        ", XF86AudioPause, exec, playerctl play-pause"
        ", XF86AudioPlay, exec, playerctl play-pause"
        ", XF86AudioPrev, exec, playerctl previous"

        ", switch:on:Lid Switch, exec, systemctl suspend"
      ];

      ##############################
      ### WINDOWS AND WORKSPACES ###
      ##############################

      # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
      # See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules

      ## Example windowrule v1
      # windowrule = [
      #   "float, ^(kitty)$"
      # ];

      ## Example windowrule v2
      # windowrulev2 = [
      # "float,class:^(kitty)$,title:^(kitty)$"
      # ];
      
      windowrulev2 = [

        # Ignore maximize requests from apps. You'll probably like this.
        "suppressevent maximize, class:.*"

        # Fix some dragging issues with XWayland
        "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"

      ];
    };
  };

}

commenting out everything above wayland.windowManager.hyprland
doesn’t change anything

here is the error I get:

sudo nixos-rebuild switch
warning: the following units failed: home-manager-<user>.service
Ă— home-manager-<user>.service - Home Manager environment for <user>
     Loaded: loaded (/etc/systemd/system/home-manager-<user>.service; enabled; preset: ignored)
     Active: failed (Result: exit-code) since Fri 2025-04-11 14:48:58 MDT; 260ms ago
 Invocation: 0ae729191daf42f2a8cf257afbfce51b
    Process: 26394 ExecStart=/nix/store/vsiyw9cslr18jddbhx7yxi5y3gb033px-hm-setup-env /nix/store/n00w30n5qshaxkb20070lmb3h9d1wxz3-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 26394 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
         IO: 0B read, 0B written
   Mem peak: 6.3M
        CPU: 106ms

Apr 11 14:48:58 nixos hm-activate-<user>[26420]: Please do one of the following:
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: - Move or remove the above files and try again.
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: - In standalone mode, use 'home-manager switch -b backup' to back up
Apr 11 14:48:58 nixos hm-activate-<user>[26420]:   files automatically.
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: - When used as a NixOS or nix-darwin module, set
Apr 11 14:48:58 nixos hm-activate-<user>[26420]:     'home-manager.backupFileExtension'
Apr 11 14:48:58 nixos hm-activate-<user>[26420]:   to, for example, 'backup' and rebuild.
Apr 11 14:48:58 nixos systemd[1]: home-manager-<user>.service: Main process exited, code=exited, status=1/FAILURE
Apr 11 14:48:58 nixos systemd[1]: home-manager-<user>.service: Failed with result 'exit-code'.
Apr 11 14:48:58 nixos systemd[1]: Failed to start Home Manager environment for <user>.
warning: error(s) occurred while switching to the new configuration


I’ve tried the home-manager.backupFileExtension = "backup" that it suggests, issue is, it only works till I reboot. then I either have to delete the file it created (named “backup”), or give the file a different name (computer got borked when I last did that, so I’m not doing it again.)

the error does not appear if I remove this module from my home.nix file.

looking online said deleting the previosly existing hyprland.conf file should fix it. it did not.

anyone know what’s happening?

Take a look at journalctl -xeu home-manager-${username}.service and it will show which file is causing the conflict. Make sure to put your username in ${username} spot

Apr 11 14:48:58 nixos hm-activate-<user>[26420]: Existing file '/home/<user>/.gtkrc-2.0' is in the way of '/nix/store/fx3kcfppjq4bzx628dg63n4j99z4xkf2-home-manager-files/.gtkrc-2.0'
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: Existing file '/home/<user>/.config/gtk-3.0/settings.ini' is in the way of '/nix/store/fx3kcfppjq4bzx628dg63n4j99z4xkf2-home-manager-files/.config/gtk-3.0/>
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: Existing file '/home/<user>/.config/gtk-4.0/gtk.css' is in the way of '/nix/store/fx3kcfppjq4bzx628dg63n4j99z4xkf2-home-manager-files/.config/gtk-4.0/gtk.c>
Apr 11 14:48:58 nixos hm-activate-<user>[26420]: Existing file '/home/<user>/.config/gtk-4.0/settings.ini' is in the way of '/nix/store/fx3kcfppjq4bzx628dg63n4j99z4xkf2-home-manager-files/.config/gtk-4.0/>

do I delete them? will that cause me issues in the future?

Did you use your username instead of ${username} or ?

yes, I then sensored the output when copying over here.

anyway, turns out I hadn’t tried commenting out everything I said. my mistake.

commenting out home.pointerCursor and gtk worked

1 Like