hyprwm / hypridle

Hyprland's idle daemon
BSD 3-Clause "New" or "Revised" License
320 stars 16 forks source link

NixOS: ...hypridle.enable option is already declared #50

Closed ArtemChandragupta closed 1 month ago

ArtemChandragupta commented 2 months ago

After updating a flake I have this error:

error: The option `home-manager.users.artem.services.hypridle.enable' in `/nix/store idad3ca4yfg27b0dfxpnkyzra7w3p61f-source/modules/services/hypridle.nix' is already declared in `/nix/store/rgcg3l397f0nzzxv1cxwnv5khdwz8j50-source/home-modules/hyprland/hypridle'.

image

I'm confused by this error because hypridle service is declared only once in my config, and before this update I didn't change anything related to hypridle or hyprland.

fufexan commented 2 months ago

The hypridle module was merged into Home Manager, so you no longer need to import the module from this flake. I'll remove it soon.

ArtemChandragupta commented 2 months ago

The hypridle module was merged into Home Manager, so you no longer need to import the module from this flake. I'll remove it soon.

So, what should I do? If I remove the flake input, i get an error that option ...hypridle.afterSleepCmd does not exist.

fufexan commented 2 months ago

Every setting you've had before (besides enable and package) now goes inside settings.

ArtemChandragupta commented 2 months ago

Not directly related, but after I made my hypridle module correct, Nix want to download 3000+ packages. Is this a big update because of 6.8.9 kernel or I done something stupid? image

fufexan commented 2 months ago

Looks like the usual nixpkgs update. Hypridle shouldn't have anything to do with it.

ArtemChandragupta commented 1 month ago

Hi. Yes, that was a simple update.

But I keep having troubles with hypridle and now with hyprlock too. First, after I removed flake-based hypridle service, It stopped starting. Also, if I type the hypridle command in the terminal, it will write that it does not know this command. My hypridle config now is

{
services.hypridle = {
  enable = true;
  settings = {
    lockCmd = "pidof hyprlock || hyprlock";
    beforeSleepCmd = "loginctl lock-session";
    afterSleepCmd = "hyprctl dispatch dpms on";

    listeners = [
      {
        timeout = 300;
        onTimeout = "brightnessctl -s set 10";
        onResume = "brightnessctl -r";
      }

      {
        timeout = 600;
        onTimeout = "loginctl lock-session";
      }

      {
        timeout = 1800;
        onTimeout = "systemctl suspend";
      }
    ];
  };
};
}

Today I had similar issue from hyprlock:

The option `home-manager.users.artem.programs.hyprlock.enable' in `/nix/store/0qh681jvni4q65f6jmbkvyld8y8xf4k6-source/modules/programs/hyprlock.nix' is already declared in `/nix/store/8af2zz1mlrk9psrlz238pfjmy5ycymnv-source/home-modules/hyprland/hyprlock'.

I got my rebuid done by changing my hyprlock config to this:

{
programs.hyprlock = {
  enable = true;
  settings = {
    backgrounds = [
      {
        monitor = "";
        path = "/home/artem/nix/home-modules/hyprland/hyprlock/blue.png";
      }
    ];

    input-fields = [
      {
        monitor = "eDP-1";

        size = {
          width = 300;
          height = 50;
        };

        outline_thickness = 0;
        inner_color = "rgb(458588)";
        font_color  = "rgb(282828)";

        fade_on_empty = false;
        placeholder_text = ''Password:'';

        dots_spacing = 0.3;
        dots_center = true;

        position = {
          x = 0;
          y = -440;
        };
      }
    ];

    labels = [
      {
        monitor = "";
        text = "$TIME";
        font_size = 50;
        color = "rgb(83a598)";

        position = {
          x = 0;
          y = 440;
        };

        valign = "center";
        halign = "center";
      }
    ];
  };
};
}

Hyprlock stars, but with placeholder instead of configured screen

ArtemChandragupta commented 1 month ago

Oh, I see. I found logs and realized that settings are now look different

ArtemChandragupta commented 1 month ago

I tried to make settings look like default not nix config. In some places this work, in some (in most) - not. I was able to set a background again in hyprlock, but all other things are broken. Now my hyprlock config is

{
programs.hyprlock = {
  enable = true;
  settings = {
    background = [
      {
        monitor = "";
        path = "/home/artem/nix/home-modules/hyprland/hyprlock/blue.png";
      }
    ];

    input-field = [
      {
        monitor = "";

        size = {
          width = 300;
          height = 50;
        };

        outline_thickness = 0;
        inner_color = "rgb(458588)";
        font_color  = "rgb(282828)";

        fade_on_empty = false;
        placeholder_text = ''Password:'';

        dots_spacing = 0.3;
        dots_center = true;

        position = {
          x = 0;
          y = -440;
        };
      }
    ];

    label = [
      {
        monitor = "";
        text = "$TIME";
        font_size = 50;
        color = "rgb(83a598)";

        position = {
          x = 0;
          y = 440;
        };

        valign = "center";
        halign = "center";
      }
    ];
  };
};
}

My hypridle config is

{
services.hypridle = {
  enable = true;
  settings = {
    general = {
      lock_cmd = "pidof hyprlock || hyprlock";
      before_sleep_cmd = "loginctl lock-session";
      after_sleep_cmd = "hyprctl dispatch dpms on";
    };

    listener = [
      {
        timeout = 300;
        on-timeout = "brightnessctl -s set 10";
        on-resume = "brightnessctl -r";
      }
      {
        timeout = 600;
        on-timeout = "loginctl lock-session";
      }
      {
        timeout = 1800;
        on-timeout = "systemctl suspend";
      }
    ];
  };
};
}

And on "hypridle" command I have the error (I removed hypridle from autostart):

  hypridle
[LOG] Registered timeout rule for 300s:
      on-timeout: brightnessctl -s set 10
      on-resume: brightnessctl -r
[LOG] Registered timeout rule for 600s:
      on-timeout: loginctl lock-session
      on-resume: 
[LOG] Registered timeout rule for 1800s:
      on-timeout: systemctl suspend
      on-resume: 
[LOG]   | got iface: wp_tearing_control_manager_v1 v1
[LOG]   | got iface: wp_fractional_scale_manager_v1 v1
[LOG]   | got iface: zxdg_output_manager_v1 v3
[LOG]   | got iface: wp_cursor_shape_manager_v1 v1
[LOG]   | got iface: zwp_idle_inhibit_manager_v1 v1
[LOG]   | got iface: zwp_relative_pointer_manager_v1 v1
[LOG]   | got iface: zxdg_decoration_manager_v1 v1
[LOG]   | got iface: wp_alpha_modifier_v1 v1
[LOG]   | got iface: zwlr_gamma_control_manager_v1 v1
[LOG]   | got iface: ext_foreign_toplevel_list_v1 v1
[LOG]   | got iface: zwp_pointer_gestures_v1 v3
[LOG]   | got iface: zwlr_foreign_toplevel_manager_v1 v3
[LOG]   | got iface: zwp_keyboard_shortcuts_inhibit_manager_v1 v1
[LOG]   | got iface: zwp_text_input_manager_v3 v1
[LOG]   | got iface: zwp_pointer_constraints_v1 v1
[LOG]   | got iface: zwlr_output_power_manager_v1 v1
[LOG]   | got iface: xdg_activation_v1 v1
[LOG]   | got iface: ext_idle_notifier_v1 v1
[LOG]    > Bound to ext_idle_notifier_v1 v1
[LOG]   | got iface: ext_session_lock_manager_v1 v1
[LOG]   | got iface: zwp_input_method_manager_v2 v1
[LOG]   | got iface: zwp_virtual_keyboard_manager_v1 v1
[LOG]   | got iface: zwlr_virtual_pointer_manager_v1 v2
[LOG]   | got iface: zwlr_output_manager_v1 v4
[LOG]   | got iface: org_kde_kwin_server_decoration_manager v1
[LOG]   | got iface: hyprland_focus_grab_manager_v1 v1
[LOG]   | got iface: zwp_tablet_manager_v2 v1
[LOG]   | got iface: zwlr_layer_shell_v1 v5
[LOG]   | got iface: wp_presentation v1
[LOG]   | got iface: hyprland_toplevel_export_manager_v1 v2
[LOG]   | got iface: zwp_text_input_manager_v1 v1
[LOG]   | got iface: hyprland_global_shortcuts_manager_v1 v1
[LOG]   | got iface: zwlr_screencopy_manager_v1 v3
[LOG]   | got iface: wl_shm v1
[LOG]   | got iface: wl_drm v2
[LOG]   | got iface: zwp_linux_dmabuf_v1 v4
[LOG]   | got iface: wl_compositor v6
[LOG]   | got iface: wl_subcompositor v1
[LOG]   | got iface: wl_data_device_manager v3
[LOG]   | got iface: zwlr_data_control_manager_v1 v2
[LOG]   | got iface: zwp_primary_selection_device_manager_v1 v1
[LOG]   | got iface: wp_viewporter v1
[LOG]   | got iface: xdg_wm_base v6
[LOG]   | got iface: wl_seat v9
[LOG]    > Bound to wl_seat v9
[LOG]   | got iface: wp_drm_lease_device_v1 v1
[LOG]   | got iface: wp_single_pixel_buffer_manager_v1 v1
[LOG]   | got iface: xwayland_shell_v1 v1
[LOG]   | got iface: wl_output v4
[LOG]   | got iface: wl_output v4
[LOG] found 3 rules
[LOG] wayland done, registering dbus
[LOG] Using dbus path /org/freedesktop/login1/session/_32
[ERR] Failed registering for /org/freedesktop/ScreenSaver, perhaps taken?
fufexan commented 1 month ago

Note that in the flake module we've restructured some parts of the config. size and position should actually be position = "x, y"; or size = "width, height"; in the HM module to work properly.

ArtemChandragupta commented 1 month ago

Thank you, my hyprlock is now gorgeous again. But can you say something about hypridle?

fufexan commented 1 month ago

Every supported config option is documented https://wiki.hyprland.org/Hypr-Ecosystem/hypridle, just as it is for hyprlock.

ArtemChandragupta commented 1 month ago

Seems like I solved the last issue. As I understand, now I don't need to launch hypridle using "exec-once = hypridle" if I declared the service