Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented

Compare changes

Choose any two refs to compare.

+58 -60
+1 -1
.github/workflows/test.yml
··· 28 28 - uses: DeterminateSystems/magic-nix-cache-action@v13 29 29 - uses: actions/checkout@v4 30 30 - run: sed -i 's@# den.outPath@den.outPath@' templates/noflake/with-inputs.nix 31 - - run: cd templates/noflake && nix-build -A flake.nixosConfigurations.igloo.config.system.build.toplevel 31 + - run: cd templates/noflake && nix-build -A nixosConfigurations.igloo.config.system.build.toplevel 32 32 template: 33 33 needs: [non-draft] 34 34 strategy:
+7 -4
templates/noflake/README.md
··· 6 6 7 7 Try it with: 8 8 9 + ```shell 10 + nixos-rebuild build --file . -A nixosConfigurations.igloo 9 11 ``` 10 - nix-build -A flake.nixosConfigurations.igloo.config.system.build.toplevel 11 - ``` 12 12 13 - NOTE: Currently Den needs a top-level attribute where to place configurations, 14 - by default it is the `flake` attribute, even if Den uses no flake-parts at all. 13 + or 14 + 15 + ```shell 16 + nix-build -A nixosConfigurations.igloo.config.system.build.toplevel 17 + ```
+4 -8
templates/noflake/default.nix
··· 1 1 let 2 2 3 - modules = 4 - { inputs, ... }: 5 - { 6 - imports = [ (inputs.import-tree ./modules) ]; 7 - }; 8 - 9 3 outputs = 10 4 inputs: 11 5 (inputs.nixpkgs.lib.evalModules { 12 - modules = [ modules ]; 6 + modules = [ (inputs.import-tree ./modules) ]; 13 7 specialArgs = { 14 8 inherit inputs; 15 9 inherit (inputs) self; ··· 17 11 }).config; 18 12 19 13 in 20 - import ./with-inputs.nix outputs 14 + # Den outputs configurations at flake top-level attr 15 + # even when it does not depend on flakes or flake-parts. 16 + (import ./with-inputs.nix outputs).flake
+11
templates/noflake/modules/compat.nix
··· 1 + { inputs, lib, ... }: 2 + { 3 + # we can import this flakeModule even if we dont have flake-parts as input! 4 + imports = [ inputs.den.flakeModule ]; 5 + 6 + # NOTE: Currently Den needs a top-level attribute where to place configurations, 7 + # by default it is the `flake` attribute, even if Den uses no flake-parts at all. 8 + options.flake = lib.mkOption { 9 + type = lib.types.submodule { freeformType = lib.types.anything; }; 10 + }; 11 + }
+35 -9
templates/noflake/modules/den.nix
··· 1 - { inputs, lib, ... }: 1 + { inputs, ... }: 2 2 { 3 - # we can import this flakeModule even if we dont 4 - # have flake-parts as input! 5 - imports = [ inputs.den.flakeModule ]; 6 - 7 - # for flake.nixosConfigurations output. 8 - # create a freeform option for it 9 - options.flake = lib.mkOption { 10 - type = lib.types.submodule { freeformType = lib.types.anything; }; 3 + # tux user on igloo host. 4 + den.hosts.x86_64-linux.igloo.users.tux = { }; 5 + 6 + # host aspect 7 + den.aspects.igloo = { 8 + nixos = 9 + { pkgs, ... }: 10 + { 11 + # remove these for a real bootable host 12 + boot.loader.grub.enable = false; 13 + fileSystems."/".device = "/dev/fake"; 14 + passthru = { }; 15 + 16 + environment.systemPackages = [ 17 + pkgs.vim 18 + ]; 19 + }; 20 + }; 21 + 22 + # user aspect 23 + den.aspects.tux = { 24 + # user configures the host it lives in 25 + nixos = { 26 + # hipster-tux uses nix-maid instead of home-manager. 27 + imports = [ inputs.nix-maid.nixosModules.default ]; 28 + 29 + users.users.tux = { 30 + isNormalUser = true; 31 + maid.file.home.".gitconfig".text = '' 32 + [user] 33 + name=Tux 34 + ''; 35 + }; 36 + }; 11 37 }; 12 38 }
-38
templates/noflake/modules/hosts.nix
··· 1 - { inputs, ... }: 2 - { 3 - # tux user on igloo host. 4 - den.hosts.x86_64-linux.igloo.users.tux = { }; 5 - 6 - # host aspect 7 - den.aspects.igloo = { 8 - nixos = 9 - { pkgs, ... }: 10 - { 11 - # remove these for a real bootable host 12 - boot.loader.grub.enable = false; 13 - fileSystems."/".device = "/dev/fake"; 14 - 15 - passthru = { }; 16 - environment.systemPackages = [ 17 - pkgs.vim 18 - ]; 19 - }; 20 - }; 21 - 22 - # user aspect 23 - den.aspects.tux = { 24 - # user configures the host it lives in 25 - nixos = { 26 - # hipster-tux uses nix-maid instead of home-manager. 27 - imports = [ inputs.nix-maid.nixosModules.default ]; 28 - 29 - users.users.tux = { 30 - isNormalUser = true; 31 - maid.file.home.".gitconfig".text = '' 32 - [user] 33 - name=Tux 34 - ''; 35 - }; 36 - }; 37 - }; 38 - }