Thoughts on user entity and sharing user config across different setups. #649
bbaserdem
started this conversation in
General - Nix related topics
Replies: 2 comments
|
It's not well documented, but you are able to disable any and all of den's default policies to change the topology to your personal needs. In my config I have zero host.users entries, every user comes from a global registry and gets mapped to a host. That mapping could service standalone homes just as well. I'll put together a demo template for this later this week. |
0 replies
|
Oh that's interesting; definitely will check this out. In the meantime; is your flake your nix-config repo? Don't mind getting some pointers from it. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've been migrating my flake-parts dendritic config to den; and while i really like how den formalized the configuration scopes; there is one concept that I keep coming back to that I think is a big difference of my mental model and how built-in entities in den work. Mostly because i was doing the same thing den is doing in pure flake-parts; but in an adhoc fashion.
One abstraction mismatch I am running across is how den models entities and how my "entities" work.
In den, the way I understand is a user entity is a sub-entity class existing under a host entity. Then there is a home entity that is completely separate.
My mental model is that a "host" is a container; corresponding to flake outputs. And a user entity can be contained in the host entities. In my mental model, a darwin host, a nixos host and a standalone home-manager host are all "hosts" and then there is a user entity too. A darwin host produces a darwinConfiguration output with the hostname, a nixos host produces a nixosConfiguration with the hostname, and a home-manager host produces a homeConfiguration output with "@". The main difference is darwin and nixos hosts can have >= 0 user entities
under them where a home-manager host has to have ==1 user entity under it.
Den is made so that a home entity with name "@" can seamlessly blend into a nixos system managed with den, but doesn't use home-manager as a system module to manage a users' home-manager configuration. Which is powerful. But I keep myself trying to use a lot of if-else statements into dispatching aspect modules into scopes in a couple different cases;
{host}scope, andctx ? userandctx ? homeare both false].{host, user}scope andctx ? homeis false.{home}scope andctx ? useris true.{home}scope, andctx ? useris false due toctx.host = {name = <hostname>;}derived from home.name = "@";I guess the best way to describe my mental model would be that if I designed the entity dispatch model, I would have the same walk that currently den does. But would have a home entity have a mandatory single user sub-entity; (rather than stub calculated when appropriate from the home.name) and the resulting homeConfiguration would merge the homeManager module for the home entity's aspect and the user entity's aspect together.
I've been finding myself writing a lot of complicated checks for aspects to work in different settings. (Such as declaring my syncthing topology across all my outputs) and wondering if other people thought about this and have a workflow for differentiating clearly for these cases? (I have 3 home computers, then a work computer where it's a non darwin/nixos system so pretty much have all cases besides having nixos managed by nix, that have users managed by standalone hm.) I haven't seen anything specific that accounts for this so open to ideas on how to organize these.
All reactions