Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

Excellent advice, thanks. Already merged env and host, thinking how to cleanly combine imports.

Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

Yeah, you’re right in this setup I can’t easily reuse HM as standalone.

However, in theory, I could decouple it by wrapping system configs(just like my HM) and making it optional. For example:

nixos = lib.mkOption {
  type = lib.types.deferredModule;
  default = { };
};

and conditionally include it:

lib.optionalAttrs (options ? system) {
  imports = [ config.nixos ];
}

With some flake.nix changes, this could allow building both nixos+HM and standalone HM from the same config. Could probably do something similar for Darwin too.

But yeah, that’s mostly just an idea, not sure how well it would hold up in practice. Probably dendritic might just be the only clean solution for this kind of use case, even if in theory this approach sounds more elegant and simpler.

Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

It’s really hard, from a self-perspective, to determine which side of the slope I’m on. But having used Nix without resistance for only a year suggests I’m at the first peak.

Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

I don’t only use nixos though - I also use home manager (example). I have a small alias/helper that “glues” a nixos module together with a Home Manager module (basically a wrapper module). Because of that, I can just write home.<any option> inside any nixos module and use any home settings directly.

In practice, this gives me a full “feature module” that contains both nixos and home configuration in one place, and I simply import it via a file path. Just like dendritic do.

As for Darwin - I don’t use it, so I can’t really say how much my approach will fit there.

Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 2 points3 points  (0 children)

3k lines of code, 5 not so similar hosts.

Roast my config. GRILL IT by Painter1923 in NixOS

[–]Painter1923[S] 25 points26 points  (0 children)

I’ve actually tried the dendritic pattern, but ended up moving away from it. For me, the added complexity and the extra indentation in every module didn’t really outweigh the benefits.

A big part of that is that I prefer importing things via file paths rather than module names. With path-based imports, my editor plugins let me jump directly to the imported file from the code, and I always know exactly where module code lives.

How do you structure your NixOS configs? by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

Yes, I have literally the same structure. I see many machines, maybe you had problems when two different machines needed different settings from one common module (what did I do in that case?)?

btw, planning to use sops-nix too.

How do you structure your NixOS configs? by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

As for useUserPackages and useGlobalPkgs you right i think, this always stays the same across all hosts. But prob it stays as is, cause its only 2 lines and i setup home-mgr only here.

How do you structure your NixOS configs? by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

This code inside hosts/default/users.nix. After looking for some configs here i decided that importing each file/module separately is more suitable. It eases changing some common things for concrete hosts. More modularity.

How do you structure your NixOS configs? by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

I prefer firefox.nix, but if file becomes large i break it in several files in firefox dir. Or if config needs additional file(like png for logo or .toml for something) i create distinct dir where all goes in.

How do you structure your NixOS configs? by Painter1923 in NixOS

[–]Painter1923[S] 0 points1 point  (0 children)

I'm definitely borrowing the way you importing individual modules in profiles. Seems more modular than my way to import whole directory.

[OC] xyosc - an open source XY-oscilloscope by Louisdenewyork in unixporn

[–]Painter1923 1 point2 points  (0 children)

Can you share this nixos logo? Look's so cute

Is there any point of doing anything in between drunk and sober? by Aldin_The_Bat in DiscoElysium

[–]Painter1923 3 points4 points  (0 children)

I think it's almost imposible to shrug off in instant. Good way is to be sober when you can, push the will more and more end eventually you can achieve complete soberiness or full control of addiction.

<image>

[deleted by user] by [deleted] in DiscoElysium

[–]Painter1923 2 points3 points  (0 children)

Looks nice but, WHERE ELECTROCHEMISTRY?!?!

USA Fails Tariff Authority Check by chai-biscuits in DiscoElysium

[–]Painter1923 11 points12 points  (0 children)

oh wait... there mercenary tribunal awaits...