Gentoo and nix with home manager

I am running Gentoo and want to use nix for all that is not system related, atleast that was my plan and also use home manager for my window manager, etc.

Would that work? expesially with the window manager and how about fonts installed with home manager. Because I tried setting up a nixos in a vm and the fonts I am running on Gentoo, did not work when I installed it in the WM with home manager, atleast polybar did not find them. And polybar was also installed with home manager.

I know this might not be your everyday question. But would be nice if anyone could answer.

It should. The difficult thing will be making sure your display manager launches home-manager’s xinit, and then you’ll need to fiddle with graphics drivers: GitHub - guibou/nixGL: A wrapper tool for nix OpenGL application.

It’ll likely be a bit painful, but you can make it work somewhat well.

That said, can we see your font/polybar config? It probably failed because of some misconfiguration, rather than an inherent incompatibility.

I dont use display managers, only xinit. However there are two problem i have so far, and that is one the fonts i install with home manager is not showing up for polybar, also installed with home manager and I have a python program I use often, that I cannot even run in nixos. Gives me error on pretty much everything. I normally just symlink the program to path and run it globally but it wont work at all.

Here is my polybar config, and it is working on my gentoo and arch…
However this is a problem with the fonts.

I like your dotfiles! I can tell you’re getting a bit burnt out of the initial setup, so let me preface this:

Yeah, it can be somewhat of a chore to migrate to NixOS. The result will be a breeze to maintain, and you’ll never be tempted to reinstall your systems again, but until you get there you need to learn how it all works and why what you’re doing at the moment is problematic in the first place.

I like comparing nix to rust - it puts limitations on you, not in terms of what can be achieved, but in how you can get there. But in so doing, it enables giving you guarantees and automated tooling that would be impossible or very hard to achieve in the traditional model.

You’ll run into a lot of these problems with home-manager on another distro, too, except there will be more complex edge cases caused by different versions of software intermingling. It’s best to start with a simple config on NixOS, and work from there.

I personally use my dotfiles on many distros, usually when I’m forced to use ubuntu because a customer wants me to, it’s possible. It just takes knowing nix well enough to deal with the problems, or minimizing the config to just a few applications (starting with your WM is probably not a good idea, browser or editor/IDE configuration is usually a good starting point, since it’s both complicated and yet achievable enough, and doesn’t leave you with a non-working system if you don’t instantly get it right).

I made the switch from gentoo to NixOS some 2-3 years ago now, I know exactly what the motivations and blockers are. Let’s see how we can get you comfortable enough to try things out!

I’m going to need a bit more info to help, though. It’d be easiest if you could share the NixOS config you used in your VM :slight_smile:

  • How exactly did you install the fonts in your NixOS config?
  • How did you install polybar? Did you use services.polybar.config?
  • I think the home-manager config also expects you to use services.polybar.script to launch your polybars - did you do that?
  • Did you use the home-manager service to start x or manually run xinit?

Note that you can supply a file path to services.polybar.config, and you can read your current script into services.polybar.script using builtins.readFile - so you don’t actually need to rewrite your config to work with home-manager, just put it where home-manager can, well, manage it.

These are somewhat important details - there’s a fair bit of bespoke environment setup with fonts to get them to work on any distro, if you don’t play by the distro’s rules it will often break.

Yep, that’s somewhat expected. I’d love to see what “wont work at all” means exactly, and what the script is. It’s possible you just need to use a different shebang (and you can quite easily write one that works on all distros). Personally I tend to write little downstream derivations (read: packages): dotfiles/system-update.nix at 36a78efeed8291da16c932aefbea71c6b47d580b · TLATER/dotfiles · GitHub

I used homemanager to just install polybar as well as everything else I needed. Then I have bspwm set up to run from my xinitrc, and bspwm start polybar. All that work fine, but It will not parse any of the fonts, I also installed the fonts using home manager. Same way as with the rest of the programs, nothing is configured in home manager, since I already have everything set up and working.
And I run startx myself, not home manager.

The python program i want to run is this

I have it set up to my git and use it to fetch my dots and send to repo for update.
I setup a python venv and pip installed the dep as I always do, but when I run it, I give error on all modules and almost all the lines, but the processes start, but that is it. Maybe there is a nix way to do this and that python venv wont work here, but please let me know.

And one last thing, i set up my user to use fish shell, but that didn’t home manager like at all, so for every time I wanted to edit or switch, i needed to open bash for it.

Thank for helping me, appreciate it