sodiboo / niri-flake

Nix packages and modules for niri
https://github.com/YaLTeR/niri
MIT License
71 stars 10 forks source link

Feature Request: Generate config without home-manager #278

Open minego opened 1 month ago

minego commented 1 month ago

I'd really like to be able to use this module to generate my niri config, but I don't use home manager... I currently am doing this with: ``` nixpkgs.overlays = [ niri.overlays.niri

                (_final: _prev: {
                    # Modify the niri startup command to point it to the
                    # config file
                    niri-unstable = _prev.niri-unstable.overrideAttrs (final: prev: {
                        postFixup = ''
                            ${prev.postFixup}

                            substituteInPlace $out/share/systemd/user/niri.service --replace "--session" "--session -c ${./niri.kdl}"
                            '';
                    });
                })
            ];

            programs.niri.enable            = true;
            programs.niri.package           = pkgs.niri-unstable;


I'd like to be able to use this flake to generate my `niri.kdl` file though. That would make it a lot easier to make tweaks for specific machines, etc.

Is it possible to do that, and then use the output in my overlay to point to that derivation?
sodiboo commented 1 month ago

(the formatting of your codeblock is kinda horribly broken, just FYI)

What exactly are you asking for?

From your english text, i'm gathering you want to generate a config without using home-manager, as in the program.niri.settings parts? If so, you can use the internal settings module which is exposed through lib.internal. you can see how this is done here in my config and the other half of that to genrate the file itself here in my config.

From your snippet, it looks more like you want to just make it point to an arbitrary location, in which case there isn't really an easy way to do it currently. I've been thinking of implementing an environment variable in niri that lets us (in nixos land) set it in a wrapper. The current -c flag isn't reliable because it should still be overrideable with the prefix (it isn't) and also it preents you from using any subcommands. But i'll see what i can do on the other side of this to make this work well for you.

minego commented 1 month ago

I'm not sure how I messed up the formatting, but I think you understood my meaning, and the answer was perfect!

I now have it working, using -c to point to my config. The PR you put up looks like a very nice improvement too! Thank you!

sodiboo commented 1 month ago

I'm going to reopen this because I want to create a better interface to perform this. Yes, you can pass --config manually, but that's annoying if you use it more than once.

minego commented 1 month ago

I'm going to reopen this because I want to create a better interface to perform this. Yes, you can pass --config manually, but that's annoying if you use it more than once.

Makes sense. I do have my setup working now, but I agree that it could be done in a much better way.

I appreciate this kind of dedication a lot. This kind of response makes me feel very good about using this project!