Skip to content

v0.10.0

Choose a tag to compare

@vic vic released this 24 Feb 22:17
· 398 commits to main since this release

Den v0.10.0

Highlights

Updated documentation

I have put a lot of my time on trying to detail as much as I can about Den in the docs. As always everyone is invited to improve the docs and fix my english grammar-errors/typos.

As always the source of truth is the source code itself, and all CI tests are self-isolated intended to be used also as complete den examples each of them.

bogus and CI run on MacOS (again)

To enable people contribute more tests to Den. I've also updated the bogus repo with cleaner test setup, in hope that people can contribute more tests. You are welcome to send PRs with new tests even if they are failing and have no fix, the bogus and CI templates both use the same test helpers. Also updated docs about this.

den.ctx now deduplicates includes at context-application time docs code.

Den keeps track of which aspect-owned configs have already been seen, but functional includes are always called (there's no way for den to know { host, user } was included elsewhere). However this static config deduplication already fixes some failing tests contributed from bogus-reports.

The documented recommendation is not to naively use den.default.includes = [ ({ host, ... }: ...) ], and prefer including at specific host or den.ctx.host and friends. Or read about the documented limitations of den.default and the need of take.exactly.

Den now has a user class that works on NixOS and nix-Darwin.

This is powered by our den.provides.forward higher-order aspect,
the exact same that powers our homeManager class.

User aspects can use the user class to specify any setting that will be forwarded to the host: nixos.users.users.<username>:

# works with static configs
den.aspects.tux.user.extraGroups = [ "wheel" ];

# can also access the host pkgs and osConfig
den.aspects.tux.user = { pkgs, osConfig, ... }: {
  packages = [ pkgs.hello ];
}

This is a convenience for people like me not using homeManager.

Users can now declare many home-environment classes.

Previously user.class defaulted to "homeManager", now it was replaced by user.classes defaults to [ "homeManager" ],
this is because a user might want to manage some files using nix-maid or hjem instead or addition to homeManager.

  • Just like native user class, we now also support nix-maid maid and hjem user-aspect classes.

These two work exactly like homeManager does, that means we also have den.ctx.maid-host and den.ctx.hjem-host context types that are activated when a host has users with the corresponding user.classes.

Guarded forward classes.

This is another feature built on top of den.provides.forward.

People requested the following feature: I want my aspect to assign configs directly to a class and that config be included in the host only if some third-party module was imported (main use case was Impermanence options):

Aspect defines config under a custom user-defined persist class:

# any file can contribute to persist class
{ den.aspects.tux.persist.directories = [ "Firefox/.mozilla" ]; }

host defines how and when the persist class is forwarded into the host configuration. all other files need not to be filled with mkIf or any other conditional checking for impermanence support, only one file does this:

persist = { host }: { class, aspect-chain }: den._.forward {
  each = lib.attrValues host.users;
  fromClass = _: "persist";
  intoClass = _: class; # nixos or darwin, dynamically.
  # path taken from https://nixos.wiki/wiki/Impermanence
  intoPath = user: [ "home-manager" "users" user.userName  "home" "persistance" "/nix/dotfiles" ];
  fromAspect = user: den.aspects.${user.aspect};
  guard = { options, ... }: options ? environment.persistance; # takes nixos module args and checks if impermanence was imported
};

den.hosts.my-laptop.includes = [ persist ];

What's Changed

  • user class, convenience for OS users.users.userName by @vic in #170
  • fix: add missing noflake template by @drupol in #178
  • Remove OS from example defaults.nix by @OscarMarshall in #179
  • Dedup includes on ctxApply by @vic in #185
  • Improve Docs by @vic in #186
  • update flake-file (removes systems input) by @vic in #187
  • run tests and bogus on linux and macos by @vic in #188
  • add hm-host isolation test by @vic in #189
  • user class modules can take os-level pkgs and osConfig. by @vic in #190
  • A single user can support many classes: homeManager / hjem / maid by @vic in #191
  • hjem support by @vic in #173
  • nix-maid integration by @vic in #172
  • Guarded classes for configs that depend on options presence. (eg Impermanence) by @vic in #192

New Contributors

Full Changelog: v0.9.0...v0.10.0