Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

# Dendritic unflake

This repository serves as an example Dendritic Nix setup implemented **without** flakes nor flake-parts.
This repository serves as an example Dendritic Nix implementation **without** flakes nor flake-parts.


Entry point is [default.nix](default.nix) and has an [example](modules/example.nix) Dendritic nixosConfiguration.
Entry point is [default.nix](default.nix), [modules/example.nix](modules/example.nix) defines a nixosConfiguration.


This example uses [unflake](https://discourse.nixos.org/t/unflake-flake-dependencies-for-non-flake-projects-and-a-way-to-stop-writing-follows/72611) to fetch dependencies.
This example uses [unflake](https://discourse.nixos.org/t/unflake-flake-dependencies-for-non-flake-projects-and-a-way-to-stop-writing-follows/72611) to fetch dependencies and provide flake-like inputs.


## Usage
Expand All @@ -29,11 +29,11 @@ nix-shell https://ln-s.sh/unflake -A unflake-shell --run unflake
Build `my-laptop` nixos config:

```console
nixos-rebuild build --file . --attr nixosConfigurations.my-laptop
nixos-rebuild build -f . -A nixosConfigurations.my-laptop
Copy link
Copy Markdown

@drupol drupol Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO, it was better with the expanded attribute, especially in a README file.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, fixed in main :)

```

alternatively:

```console
nix-build . --attr nixosConfigurations.my-laptop.config.system.build.toplevel
nix-build -A nixosConfigurations.my-laptop.config.system.build.toplevel
```
18 changes: 6 additions & 12 deletions modules/example.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
{ lib, self, ... }:
{

modules.nixos.no-boot = {
boot.loader.grub.enable = false;
fileSystems."/".device = "/dev/no-device";
};

modules.nixos.installer =
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
};

modules.nixos.statics = {
system.stateVersion = "25.11";
nixpkgs.hostPlatform = "x86_64-linux";
passthru = { };
};

modules.nixos.my-laptop.imports = with self.modules.nixos; [
statics
no-boot
];

nixosConfigurations.my-laptop = lib.nixosSystem {
modules = with self.modules.nixos; [
statics
no-boot
# installer
];
modules = [ self.modules.nixos.my-laptop ];
};
}
4 changes: 2 additions & 2 deletions modules/options/modules.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ lib, ... }:
{
options.modules = lib.mkOption {
description = "<class>.<aspect> modules. equivalent to flake-parts' flake.modules";
description = "<class>.<aspect> modules. akin to flake-parts' flake.modules";
default = { };
type = lib.types.attrsOf (lib.types.attrsOf lib.types.deferredModule);
type = lib.types.lazyAttrsOf (lib.types.lazyAttrsOf lib.types.deferredModule);
};
}
2 changes: 1 addition & 1 deletion modules/options/nixos-configurations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
options.nixosConfigurations = lib.mkOption {
description = "NixOS configurations";
default = { };
type = lib.types.attrsOf lib.types.anything;
type = lib.types.lazyAttrsOf lib.types.raw;
};
}