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
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

test template/minimal (#143)

minimal flake uses no flake-parts.

authored by

Victor Borja and committed by
GitHub
7431d485 42e09c12

+71 -66
+24
.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: | 32 + cat <<-EOF > templates/noflake/modules/ci-runtime.nix 33 + { 34 + _module.args.CI = true; 35 + } 36 + EOF 37 + git add templates/noflake/modules/ci-runtime.nix 31 38 - run: cd templates/noflake && nix-build -A nixosConfigurations.igloo.config.system.build.toplevel 39 + minimal: 40 + needs: [non-draft] 41 + name: minimal 42 + runs-on: ubuntu-latest 43 + steps: 44 + - uses: wimpysworld/nothing-but-nix@main 45 + - uses: cachix/install-nix-action@v31 46 + - uses: DeterminateSystems/magic-nix-cache-action@v13 47 + - uses: actions/checkout@v4 48 + - run: | 49 + cat <<-EOF > templates/minimal/modules/ci-runtime.nix 50 + { 51 + _module.args.CI = true; 52 + } 53 + EOF 54 + git add templates/minimal/modules/ci-runtime.nix 55 + - run: nix flake check ./templates/minimal --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA 32 56 template: 33 57 needs: [non-draft] 34 58 strategy:
+9
modules/aspects/provides/ci-noboot.nix
··· 1 + { config, lib, ... }: 2 + { 3 + den.default.includes = lib.optionals (config ? _module.args.CI) [ 4 + { 5 + nixos.fileSystems."/".device = lib.mkDefault "/dev/noroot"; 6 + nixos.boot.loader.grub.enable = lib.mkDefault false; 7 + } 8 + ]; 9 + }
+11
modules/output.nix
··· 1 + { inputs, lib, ... }: 2 + if inputs ? flake-parts then 3 + { } 4 + else 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 + }
+1 -1
templates/bogus/.github/workflows/test.yml
··· 15 15 - uses: wimpysworld/nothing-but-nix@main 16 16 if: matrix.os == 'ubuntu-latest' 17 17 - uses: cachix/install-nix-action@v31 18 - - uses: DeterminateSystems/magic-nix-cache-action@13 18 + - uses: DeterminateSystems/magic-nix-cache-action@v13 19 19 - uses: actions/checkout@v5 20 20 - run: nix flake metadata 21 21 - run: nix flake check
+3 -3
templates/bogus/modules/test-base.nix
··· 1 - { den, ... }: 1 + { den, lib, ... }: 2 2 { 3 3 den.default.nixos.system.stateVersion = "25.11"; 4 4 den.default.homeManager.home.stateVersion = "25.11"; ··· 11 11 ]; 12 12 13 13 den.aspects.no-boot.nixos = { 14 - boot.loader.grub.enable = false; 15 - fileSystems."/".device = "/dev/fake"; 14 + boot.loader.grub.enable = lib.mkForce false; 15 + fileSystems."/".device = lib.mkForce "/dev/fake"; 16 16 }; 17 17 }
-20
templates/default/modules/ci.nix
··· 1 - { config, ... }: 2 - { 3 - 4 - den.default.includes = [ 5 - 6 - # USER TODO: Remove. 7 - ( 8 - # This is a conditional aspect to disable boot during CI on all hosts. 9 - if config ? _module.args.CI then 10 - { 11 - nixos.fileSystems."/".device = "/dev/fake"; 12 - nixos.boot.loader.grub.enable = false; 13 - } 14 - else 15 - { } 16 - ) 17 - 18 - ]; 19 - 20 - }
-21
templates/minimal/flake.lock
··· 30 30 "type": "github" 31 31 } 32 32 }, 33 - "flake-parts": { 34 - "inputs": { 35 - "nixpkgs-lib": [ 36 - "nixpkgs" 37 - ] 38 - }, 39 - "locked": { 40 - "lastModified": 1762980239, 41 - "narHash": "sha256-8oNVE8TrD19ulHinjaqONf9QWCKK+w4url56cdStMpM=", 42 - "owner": "hercules-ci", 43 - "repo": "flake-parts", 44 - "rev": "52a2caecc898d0b46b2b905f058ccc5081f842da", 45 - "type": "github" 46 - }, 47 - "original": { 48 - "owner": "hercules-ci", 49 - "repo": "flake-parts", 50 - "type": "github" 51 - } 52 - }, 53 33 "import-tree": { 54 34 "locked": { 55 35 "lastModified": 1763263999, ··· 85 65 "inputs": { 86 66 "den": "den", 87 67 "flake-aspects": "flake-aspects", 88 - "flake-parts": "flake-parts", 89 68 "import-tree": "import-tree", 90 69 "nixpkgs": "nixpkgs" 91 70 }
+6 -4
templates/minimal/flake.nix
··· 1 1 { 2 - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 2 + outputs = 3 + inputs: 4 + (inputs.nixpkgs.lib.evalModules { 5 + modules = [ (inputs.import-tree ./modules) ]; 6 + specialArgs = { inherit inputs; }; 7 + }).config.flake; 3 8 4 9 inputs = { 5 10 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 6 - flake-parts.url = "github:hercules-ci/flake-parts"; 7 - flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; 8 - 9 11 import-tree.url = "github:vic/import-tree"; 10 12 flake-aspects.url = "github:vic/flake-aspects"; 11 13 den.url = "github:vic/den";
+14 -2
templates/minimal/modules/den.nix
··· 1 1 { inputs, den, ... }: 2 2 { 3 - systems = builtins.attrNames den.hosts; 3 + # we can import this flakeModule even if we dont have flake-parts as input! 4 4 imports = [ inputs.den.flakeModule ]; 5 5 6 6 den.hosts.x86_64-linux.igloo.users.tux = { }; 7 - den.aspects.igloo = { }; 7 + 8 + den.aspects.igloo = { 9 + nixos = 10 + { pkgs, ... }: 11 + { 12 + environment.systemPackages = [ pkgs.hello ]; 13 + passthru = { }; 14 + }; 15 + }; 16 + 17 + den.aspects.tux = { 18 + includes = [ den.provides.primary-user ]; 19 + }; 8 20 }
-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 - }
+3 -4
templates/noflake/modules/den.nix
··· 1 1 { inputs, ... }: 2 2 { 3 + # we can import this flakeModule even if we dont have flake-parts as input! 4 + imports = [ inputs.den.flakeModule ]; 5 + 3 6 # tux user on igloo host. 4 7 den.hosts.x86_64-linux.igloo.users.tux = { }; 5 8 ··· 8 11 nixos = 9 12 { pkgs, ... }: 10 13 { 11 - # remove these for a real bootable host 12 - boot.loader.grub.enable = false; 13 - fileSystems."/".device = "/dev/fake"; 14 14 passthru = { }; 15 - 16 15 environment.systemPackages = [ 17 16 pkgs.vim 18 17 ];