Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Local overlay for system configuration on multiple machines
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 518
Location: Wales, UK

PostPosted: Sun May 26, 2024 8:32 am    Post subject: Local overlay for system configuration on multiple machines Reply with quote

I have spent the last 18 months playing with Guix, and then subsequently with NixOS on my laptop. Both are very interesting from a technical standpoint, and how they use a different approach to system configuration. For me, I found Guix to be fairly limiting, and when I came across issues it was difficult to understand how to resolve them, and asking for help is difficult if you are using "unfree" software (like wifi drivers). Nix proved to be much easier to understand, and because it has a large (and growing) following many people in the community are only too happy to help when you have problems. Anyway, currently there is quite a lot of turbulence in the NixOS community (which I have no plan to address here), and this led me to consider why I am using NixOS on my laptop. I also came across another issue which led me to reflect that I still don't know anywhere near enough to be able to resolve issues myself. Behind NixOS there is a large infrastructure which needs funding and maintenance - by comparison, Gentoo is very light touch. So what are the attractions of Nix/NixOS (and Guix) for me?
  • Being able to replicate the home environment on multiple machines declaratively was a big one. Run one script, and configure the system and home environment in one go. If it fails, then fix the problem and run it again.
  • Solving configuration problems once, and keeping the whole system configuration in a script. Together with a good backup strategy for data, this makes re-installing very straight forward.

Well, as a result of my reflection on my personal understanding of NixOS and my ability (or otherwise) to resolve issues, I decided to remove NixOS from my laptop and install Gentoo. As I have used Gentoo for 20 years, I know enough to meet my personal needs, and I continue to love the flexibility it provides to configure the system how I want it. It took me a couple of days to get my laptop configured, but now everything is pretty much sorted. I hand configured a kernel (as I do on my other machines here), and this took a little bit of time to sort out. Thanks to Pietinger for his countless forum posts and wiki articles, I could resolve some of the hardware configuration issues which proved more challenging than I expected!
Thinking about the benefits of the NixOS approach, I am now thinking about how I can make the system and home configuration easier in the future for multiple systems. I have already set up a dotfiles tree, and use stow, so this standardises the configuration files. Some of the configuration files are also created as tangled output from org files in Emacs. All the configuration files are under version control. I am now thinking I should make my own overlay, and pull in the various programs I use using ebuilds similar to the various *-meta ebuilds found in portage. I could then simply emerge these, and have the various dependencies pulled in to give my the programs I want installed.
Have any of you used such a setup, and if so are there any points I need to consider? I run a mixed stable/unstable system on my machines - I guess I could also configure the ebuilds to pull in the appropriate versions of the programs and set the various USE flags I need.
Now I am back 100% into the Gentoo environment, I also intend to start spending a bit of time supporting bug squashing where I can.
Thanks for reading - I look forward to your comments!
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1000
Location: Richmond Hill, Canada

PostPosted: Sun May 26, 2024 1:02 pm    Post subject: Reply with quote

paulj,

Do you aware Portage have a sets concept? User can define their own and be managed as single entry much like you try to do in the other thread about meta.
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 518
Location: Wales, UK

PostPosted: Sun May 26, 2024 6:36 pm    Post subject: Reply with quote

pingtoo wrote:
paulj,

Do you aware Portage have a sets concept? User can define their own and be managed as single entry much like you try to do in the other thread about meta.


Thanks pingtoo!

I am aware of the sets concept, but to be honest I hadn't considered it. I will have a play with this as well as using the meta approach I first considered. I guess the other approach is simply to put the world file and contents of /etc/portage/package.* in a git repo, and then install this before emerging the @world set (and perhaps contents of /etc/).
Back to top
View user's profile Send private message
khumba
n00b
n00b


Joined: 16 Jun 2011
Posts: 52

PostPosted: Wed May 29, 2024 6:48 am    Post subject: Reply with quote

I spent a lot of time on NixOS in the mid/late-2010s, and even got to run it on production systems at work. Ultimately I gave it up for personal use, for various reasons and long before any of the current drama, but boy do I miss NixOS modules.

Package sets are a good first step to replicating your system configuration. The next feature that Portage provides for going declarative is to define your own profiles. This lets you share your make.conf settings, USE flags, masks, etc. across multiple systems. The Profile (Portage) wiki page describes how to do this well.

As for what I do, in addition to my khoverlay repository, I have another 'khunderlay' one that contains all of my private machine configuration. Just like you would keep a repository with NixOS modules that inherit from each other, I treat Portage profiles the same way. So I have a base profile that sets everything common to all my machines, mixin profiles for specific things like Pipewire vs. Pulseaudio, and then machine-specific profiles that just pull from other profiles and tweak things. From the root of the repository it looks like this:

Code:
profiles/khumba/mixins/base
    make.defaults            # All common make.conf settings, USE, etc.
    package.accept_keywords  # Things I always need from ~amd64, etc.
    package.use
    package.mask
    packages
    <etc.>
profiles/khumba/mixins/kde
profiles/khumba/mixins/no-kde
profiles/khumba/mixins/openrc
profiles/khumba/mixins/pipewire
profiles/khumba/mixins/pulseaudio
    <etc.>
profiles/khumba/machines/ash
    make.defaults            # USE, CPU_FLAGS_X86, INPUT_DEVICES, VIDEO_CARDS
    packages
    parent
profiles/khumba/machines/<etc.>
profiles/profiles.desc


Only the machine profiles are listed in profiles.desc. The mixin profiles don't inherit from other profiles. The machine profiles have a parent file that picks and chooses:

Code:
gentoo:default/linux/amd64/17.1/desktop/plasma
gentoo:features/merged-usr
../../mixins/base
../../mixins/openrc
../../mixins/pipewire
../../mixins/kde


I have a bunch of package sets defined in this repo, but the 'packages' files in the profiles are also important. These files list packages to be included in a special @profile set, which is included as part of @world. @profile is empty by default, so it's perfect for specifying things like drivers to install automatically for certain setups. (This file also configures the @system set but that doesn't matter here.) Eix even gives special highlighting to packages in the @profile set.

Then I have some ebuilds for installing scripts and /etc things. One annoyance is that wildcards in package names and categories are allowed in package.use and package.accept_keywords under /etc/portage, but not within profiles, so I symlink a couple wildcard-using files from the repo to /etc/portage. Also, I have ebuilds (in khoverlay actually) that install patches into /etc/portage/patches, so I need to be careful about emerge order occasionally, but it's much less work than forking the ebuilds they patch.

That's more or less it. In addition to the wiki page above, the portage(5) man page is helpful in setting all this up. One of these days I need to look into a more automated approach for managing everything else under /etc, but I haven't got there yet.

I'm curious to hear how others have made their Gentoo setups declarative.
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 518
Location: Wales, UK

PostPosted: Wed May 29, 2024 9:03 am    Post subject: Reply with quote

Wow @khumba. Thank you very much - much to think about and try. I see your overlay is public, and appreciate the detail you have presented for your khunderlay. This seems to be the best integrated approach and it is in line with Gentoo philosophy, so I will work on this setup.

Like you, I look forward to seeing what others are using.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum