rharish101 / ReGreet

Clean and customizable greeter for greetd
GNU General Public License v3.0
375 stars 17 forks source link

FR: NixOS package #10

Closed addy419 closed 1 year ago

addy419 commented 1 year ago

NixOS has supported greetd for a while but lacks "good" looking greeters. Adding ReGreet as a package will be appreciated. Due to the nature of NixOS, it is sometimes difficult to add a package such as login managers. So, I don't expect this issue to be solved right away, but I'm willing to try. Any external help is appreciated.

fufexan commented 1 year ago

I have a nix package working. I was planning on adding it to Nixpkgs but time wasn't on my side lately. I will do it probably later or tomorrow. In the meantime, check it out here (also includes greetd integration and other settings).

addy419 commented 1 year ago

@fufexan Oh thank you. Yes, I will wait for the package but I kinda understand the method now. Also, is it possible to directly run ReGreet with hyprland nixos (HM) module? My current greetd settings for tuigreet look like this

  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
        user = "greeter";
        vt = "next";
      };
    };
  };
fufexan commented 1 year ago

Yes. I use it with Hyprland. You don't need to pass any commands, as ReGreet will find the hyprland.desktop session file and show it as an option.

fufexan commented 1 year ago

It'd be great if you could drop a review.

addy419 commented 1 year ago

Can you tell me how to add this to the greetd service for hyprland hm module?

fufexan commented 1 year ago

You do something similar to the commit I linked yesterday. You add ReGreet as either an overlay or just a simple callPackage, and use it instead of tuigreet.

fufexan commented 1 year ago

Success! ReGreet was merged https://github.com/NixOS/nixpkgs/pull/219252#event-8676749772. The issue can be closed now.

rharish101 commented 1 year ago

Before I close this issue, I'd like to advertise this as an unofficial package in the README. Is that okay with you? If yes, could you write down short instructions to install ReGreet on NixOS?

fufexan commented 1 year ago

I was told by a few users to also make a NixOS module for it, to facilitate easy configuration. I will do that and let you know when it's ready.

addy419 commented 1 year ago

@fufexan I wasn't able to run it trough Hyprland, but it worked with cage. It drops me into tty though (or I have to enter the Hyprland command manually). Could be because Hyprland is installed through home manager, idk if there's a workaround for this. Lastly, icons and themes aren't applied even though I made the file in /etc/greetd/regreet.toml, again (only font works), could be because my themes are installed in home manager instead of system config. This is my config for now:

  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = "${pkgs.cage}/bin/cage -s -- ${pkgs.greetd.regreet}/bin/regreet";
        #command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
        user = "greeter";
        #vt = "next";
      };
    };
  };

  environment.etc."greetd/regreet.toml".text = ''
  #background = "/usr/share/backgrounds/greeter.jpg"
  #background_fit = "Contain"

  [GTK]
  # Whether to use the dark theme
  application_prefer_dark_theme = true

  # Cursor theme name
  cursor_theme_name = "Dracula-cursors"

  # Font name and size
  font_name = "Noto Sans Display 16"

  # Icon theme name
  icon_theme_name = "Papirus"

  # GTK theme name
  theme_name = "Dracula"
  '';

  systemd.tmpfiles.rules = [
    "d /var/log/regreet 0755 greeter greeter - -"
    "d /var/cache/regreet 0755 greeter greeter - -"
  ];

If you're able to get this working let me know.

fufexan commented 1 year ago

Could be because Hyprland is installed through home manager, idk if there's a workaround for this.

This is expected. HM packages do not affect the system. You can use the NixOS module along with the HM one for a complete experience (also noted in the wiki).

Lastly, icons and themes aren't applied even though I made the file in /etc/greetd/regreet.toml, again (only font works), could be because my themes are installed in home manager instead of system config.

Indeed, that's the issue again.

Your config looks fine, so it's not working only because it cannot find the proper packages.

Now that we have a default path for the custom CSS file, I will open a PR with the ReGreet NixOS module I've been working on for a while.

fufexan commented 1 year ago

I've opened the PR here https://github.com/NixOS/nixpkgs/pull/221075.

fufexan commented 1 year ago

The module PR was merged today. It should land in nixos-unstable in a few days. Status can be tracked here.

CC: @rharish101 Here's something I would write in the readme regarding NixOS. The middle paragraph is optional.

NixOS

For a minimal config, add programs.regreet.enable = true; in your NixOS configuration file.

This line installs ReGreet, sets up systemd tmpfiles for it, enables services.greetd and also configures its default session to start ReGreet using cage. This should work on most systems.

For users who want to configure more, they can see all the options of the module by searching for regreet on https://search.nixos.org/options.