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

Re-organize templates. Better default template. (#70)

Our new default template is much better suited to be used as a starting
point for people trying out den.

Our previous default template is now named `examples`. It is still
useful as reference of how to use den and is used for CI.

Fixes #67

authored by oeiuwq.com and committed by

GitHub db007d3a 0d3c9ae3

+402 -187
+6 -10
.github/workflows/test.yml
··· 7 7 group: ${{ github.workflow }}-${{ github.ref }} 8 8 cancel-in-progress: true 9 9 jobs: 10 - flag: 10 + non-draft: 11 11 runs-on: ubuntu-latest 12 - outputs: 13 - flag: ${{steps.flag.outputs.flag}} 14 12 steps: 15 - - id: flag 16 - run: echo "flag=${{github.ref == 'refs/heads/main' || github.event.pull_request.draft == false}}" >> $GITHUB_OUTPUT 13 + - run: test "true" = "${{github.ref == 'refs/heads/main' || github.event.pull_request.draft == false}}" 17 14 flake-check: 18 - needs: [flag] 19 - if: needs.flag.outputs.flag == 'true' 15 + needs: [non-draft] 20 16 name: nix flake check 21 17 runs-on: ubuntu-latest 22 18 steps: 23 19 - uses: cachix/install-nix-action@v30 24 20 - run: nix flake check -L github:vic/checkmate --override-input target github:$GITHUB_REPOSITORY/$GITHUB_SHA 25 21 template: 26 - needs: [flag] 27 - if: needs.flag.outputs.flag == 'true' 22 + needs: [non-draft] 28 23 strategy: 29 24 matrix: 30 25 os: [ubuntu-latest, macos-latest] 31 - template: [default, bogus, minimal] 26 + template: [default, bogus, examples] 32 27 name: Check template ${{matrix.template}} ${{matrix.os}} 33 28 runs-on: ${{matrix.os}} 34 29 steps: ··· 42 37 { lib, ... }: 43 38 { 44 39 flake-file.inputs.den.url = lib.mkForce "github:$GITHUB_REPOSITORY/$GITHUB_SHA"; 40 + _module.args.CI = true; 45 41 } 46 42 EOF 47 43 - run: nix run .#write-flake --override-input den "github:$GITHUB_REPOSITORY/$GITHUB_SHA"
+1 -1
README.md
··· 309 309 310 310 ```console 311 311 nix flake check ./checkmate --override-input target . 312 - nix flake check ./templates/default --override-input den . 312 + nix flake check ./templates/examples --override-input den . 313 313 ``` 314 314 315 315 Ensure code is formatted:
+3 -3
flake.nix
··· 3 3 flakeModule = ./nix/flakeModule.nix; 4 4 templates = { 5 5 default.path = ./templates/default; 6 - default.description = "Example configuration"; 7 - minimal.path = ./templates/minimal; 8 - minimal.description = "Minimal configuration"; 6 + default.description = "Minimal configuration"; 7 + examples.path = ./templates/examples; 8 + examples.description = "API examples and CI"; 9 9 bogus.path = ./templates/bogus; 10 10 bogus.description = "For bug reproduction"; 11 11 };
+27
templates/default/.github/workflows/test.yml
··· 1 + on: 2 + pull_request: 3 + push: 4 + concurrency: 5 + group: ${{ github.workflow }}-${{ github.ref }} 6 + cancel-in-progress: true 7 + jobs: 8 + flake-check: 9 + strategy: 10 + matrix: 11 + os: [ubuntu-latest, macos-latest] 12 + name: Nix flake check ${{matrix.os}} 13 + runs-on: ${{matrix.os}} 14 + steps: 15 + - uses: wimpysworld/nothing-but-nix@main 16 + if: matrix.os == 'ubuntu-latest' 17 + - uses: DeterminateSystems/nix-installer-action@main 18 + - uses: DeterminateSystems/magic-nix-cache-action@main 19 + - uses: actions/checkout@v5 20 + - run: nix flake metadata 21 + - run: | 22 + cat <<-EOF > modules/ci-runtime.nix 23 + { 24 + _module.args.CI = true; 25 + } 26 + EOF 27 + - run: nix flake check
+27 -88
templates/default/flake.lock
··· 7 7 ] 8 8 }, 9 9 "locked": { 10 - "lastModified": 1762039661, 11 - "narHash": "sha256-oM5BwAGE78IBLZn+AqxwH/saqwq3e926rNq5HmOulkc=", 10 + "lastModified": 1762627886, 11 + "narHash": "sha256-/QLk1bzmbcqJt9sU43+y/3tHtXhAy0l8Ck0MoO2+evQ=", 12 12 "owner": "nix-darwin", 13 13 "repo": "nix-darwin", 14 - "rev": "c3c8c9f2a5ed43175ac4dc030308756620e6e4e4", 14 + "rev": "5125a3cd414dc98bbe2c528227aa6b62ee61f733", 15 15 "type": "github" 16 16 }, 17 17 "original": { ··· 22 22 }, 23 23 "den": { 24 24 "locked": { 25 - "lastModified": 1762509696, 26 - "narHash": "sha256-G6Y2rlS7mpTSuCN22O7hsyRdgboJzFZz4UdLHKjfTts=", 25 + "lastModified": 1762846055, 26 + "narHash": "sha256-V7QK5vFpO6ZS3O7W1nFqficBMQezFBsnwciL6BX1ZXU=", 27 27 "owner": "vic", 28 28 "repo": "den", 29 - "rev": "f2abd24fb8bf6183f80fe5f6ac94baf440d77874", 29 + "rev": "0d3c9ae37a289aaad6bc3c6eb4a44fa2cd9a5dc0", 30 30 "type": "github" 31 31 }, 32 32 "original": { ··· 37 37 }, 38 38 "flake-aspects": { 39 39 "locked": { 40 - "lastModified": 1762148645, 41 - "narHash": "sha256-NfxjuuA1p7Sn+OX0HD+p6LepxRFYmahaybvN7+D3GZQ=", 40 + "lastModified": 1762465224, 41 + "narHash": "sha256-jfXLTwngKXwFOCVfCupHGcCw/OIpgy5lMYIF8KPfMN8=", 42 42 "owner": "vic", 43 43 "repo": "flake-aspects", 44 - "rev": "895538b1372ecbe4966db85553b11eb64a72086c", 44 + "rev": "4cbae79bc642311f45c211f9c20d20226544b6f9", 45 45 "type": "github" 46 46 }, 47 47 "original": { ··· 52 52 }, 53 53 "flake-file": { 54 54 "locked": { 55 - "lastModified": 1761535278, 56 - "narHash": "sha256-OPZ7XpG778i9CIJfchAwgrZGZ9z1dWJzfN18VFxCyS4=", 55 + "lastModified": 1762732765, 56 + "narHash": "sha256-sVxN4q4V8jhIAF44aPSMULIJMJ5eG5HtzcQgbr2UEBg=", 57 57 "owner": "vic", 58 58 "repo": "flake-file", 59 - "rev": "57b2a65831ae49e4f9218dbba1c2dc9700f6cd68", 59 + "rev": "7b037ae446102d3ccc5e23d3c52d5ada8e0fc4f3", 60 60 "type": "github" 61 61 }, 62 62 "original": { ··· 72 72 ] 73 73 }, 74 74 "locked": { 75 - "lastModified": 1762040540, 76 - "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=", 75 + "lastModified": 1762810396, 76 + "narHash": "sha256-dxFVgQPG+R72dkhXTtqUm7KpxElw3u6E+YlQ2WaDgt8=", 77 77 "owner": "hercules-ci", 78 78 "repo": "flake-parts", 79 - "rev": "0010412d62a25d959151790968765a70c436598b", 79 + "rev": "0bdadb1b265fb4143a75bd1ec7d8c915898a9923", 80 80 "type": "github" 81 81 }, 82 82 "original": { ··· 92 92 ] 93 93 }, 94 94 "locked": { 95 - "lastModified": 1762087455, 96 - "narHash": "sha256-hpbPma1eUKwLAmiVRoMgIHbHiIKFkcACobJLbDt6ABw=", 95 + "lastModified": 1762787259, 96 + "narHash": "sha256-t2U/GLLXHa2+kJkwnFNRVc2fEJ/lUfyZXBE5iKzJdcs=", 97 97 "owner": "nix-community", 98 98 "repo": "home-manager", 99 - "rev": "43e205606aeb253bfcee15fd8a4a01d8ce8384ca", 99 + "rev": "37a3d97f2873e0f68711117c34d04b7c7ead8f4e", 100 100 "type": "github" 101 101 }, 102 102 "original": { ··· 105 105 "type": "github" 106 106 } 107 107 }, 108 - "home-manager-stable": { 109 - "inputs": { 110 - "nixpkgs": [ 111 - "nixpkgs-stable" 112 - ] 113 - }, 114 - "locked": { 115 - "lastModified": 1758463745, 116 - "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", 117 - "owner": "nix-community", 118 - "repo": "home-manager", 119 - "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", 120 - "type": "github" 121 - }, 122 - "original": { 123 - "owner": "nix-community", 124 - "ref": "release-25.05", 125 - "repo": "home-manager", 126 - "type": "github" 127 - } 128 - }, 129 108 "import-tree": { 130 109 "locked": { 131 - "lastModified": 1761120675, 132 - "narHash": "sha256-TEbh9zISiQcU82VwVoEbmXHnSGlUxTwvjJA9g9ErSDA=", 110 + "lastModified": 1762327901, 111 + "narHash": "sha256-AJ96FNj50DU0bTyIzAPkPOjCZTHqjURVjok8qoXvmqM=", 133 112 "owner": "vic", 134 113 "repo": "import-tree", 135 - "rev": "a037ed2a58fc0ebed9e93b9ef79b0646e648f719", 114 + "rev": "90fa129798be99cde036b78658e89475710966a1", 136 115 "type": "github" 137 116 }, 138 117 "original": { ··· 161 140 "type": "github" 162 141 } 163 142 }, 164 - "nixos-wsl": { 165 - "inputs": { 166 - "flake-compat": [], 167 - "nixpkgs": [ 168 - "nixpkgs-stable" 169 - ] 170 - }, 171 - "locked": { 172 - "lastModified": 1761969132, 173 - "narHash": "sha256-0me4+e+1VxNuvySSw0voqMCWU/eUmTuth7f4+Q2jbUY=", 174 - "owner": "nix-community", 175 - "repo": "nixos-wsl", 176 - "rev": "761582d6ab431549fe1396d2cd681e3fe9376020", 177 - "type": "github" 178 - }, 179 - "original": { 180 - "owner": "nix-community", 181 - "repo": "nixos-wsl", 182 - "type": "github" 183 - } 184 - }, 185 143 "nixpkgs": { 186 144 "locked": { 187 - "lastModified": 1761880412, 188 - "narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=", 145 + "lastModified": 1762482733, 146 + "narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=", 189 147 "owner": "nixos", 190 148 "repo": "nixpkgs", 191 - "rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386", 149 + "rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc", 192 150 "type": "github" 193 151 }, 194 152 "original": { ··· 198 156 "type": "github" 199 157 } 200 158 }, 201 - "nixpkgs-stable": { 202 - "locked": { 203 - "lastModified": 1762081535, 204 - "narHash": "sha256-+j+CUiaUoa87EhnSOqG5pwXdJWahP8vo6BE0ekssdzs=", 205 - "owner": "nixos", 206 - "repo": "nixpkgs", 207 - "rev": "2afc9d6e79b59ea9bcaf620d335623b0f7c2ce96", 208 - "type": "github" 209 - }, 210 - "original": { 211 - "owner": "nixos", 212 - "ref": "release-25.05", 213 - "repo": "nixpkgs", 214 - "type": "github" 215 - } 216 - }, 217 159 "root": { 218 160 "inputs": { 219 161 "darwin": "darwin", ··· 222 164 "flake-file": "flake-file", 223 165 "flake-parts": "flake-parts", 224 166 "home-manager": "home-manager", 225 - "home-manager-stable": "home-manager-stable", 226 167 "import-tree": "import-tree", 227 168 "nix-auto-follow": "nix-auto-follow", 228 - "nixos-wsl": "nixos-wsl", 229 169 "nixpkgs": "nixpkgs", 230 170 "nixpkgs-lib": [ 231 171 "nixpkgs" 232 172 ], 233 - "nixpkgs-stable": "nixpkgs-stable", 234 173 "systems": "systems", 235 174 "treefmt-nix": "treefmt-nix" 236 175 } ··· 257 196 ] 258 197 }, 259 198 "locked": { 260 - "lastModified": 1761311587, 261 - "narHash": "sha256-Msq86cR5SjozQGCnC6H8C+0cD4rnx91BPltZ9KK613Y=", 199 + "lastModified": 1762410071, 200 + "narHash": "sha256-aF5fvoZeoXNPxT0bejFUBXeUjXfHLSL7g+mjR/p5TEg=", 262 201 "owner": "numtide", 263 202 "repo": "treefmt-nix", 264 - "rev": "2eddae033e4e74bf581c2d1dfa101f9033dbd2dc", 203 + "rev": "97a30861b13c3731a84e09405414398fbf3e109f", 265 204 "type": "github" 266 205 }, 267 206 "original": {
-38
templates/default/flake.nix
··· 38 38 }; 39 39 url = "github:nix-community/home-manager"; 40 40 }; 41 - home-manager-stable = { 42 - inputs = { 43 - nixpkgs = { 44 - follows = "nixpkgs-stable"; 45 - }; 46 - }; 47 - url = "github:nix-community/home-manager/release-25.05"; 48 - }; 49 41 import-tree = { 50 42 url = "github:vic/import-tree"; 51 43 }; 52 - nix-auto-follow = { 53 - inputs = { 54 - nixpkgs = { 55 - follows = "nixpkgs"; 56 - }; 57 - }; 58 - url = "github:fzakaria/nix-auto-follow"; 59 - }; 60 - nixos-wsl = { 61 - inputs = { 62 - flake-compat = { 63 - follows = ""; 64 - }; 65 - nixpkgs = { 66 - follows = "nixpkgs-stable"; 67 - }; 68 - }; 69 - url = "github:nix-community/nixos-wsl"; 70 - }; 71 44 nixpkgs = { 72 45 url = "github:nixos/nixpkgs/nixpkgs-unstable"; 73 46 }; 74 47 nixpkgs-lib = { 75 48 follows = "nixpkgs"; 76 49 }; 77 - nixpkgs-stable = { 78 - url = "github:nixos/nixpkgs/release-25.05"; 79 - }; 80 50 systems = { 81 51 url = "github:nix-systems/default"; 82 - }; 83 - treefmt-nix = { 84 - inputs = { 85 - nixpkgs = { 86 - follows = "nixpkgs"; 87 - }; 88 - }; 89 - url = "github:numtide/treefmt-nix"; 90 52 }; 91 53 }; 92 54
templates/default/modules/_example/README.md templates/examples/modules/_example/README.md
templates/default/modules/_example/_non_dendritic/hosts/honeycrisp/_darwin/something.nix templates/examples/modules/_example/_non_dendritic/hosts/honeycrisp/_darwin/something.nix
templates/default/modules/_example/_non_dendritic/hosts/rockhopper/_nixos/hardware-auto-generated.nix templates/examples/modules/_example/_non_dendritic/hosts/rockhopper/_nixos/hardware-auto-generated.nix
templates/default/modules/_example/aspects.nix templates/examples/modules/_example/aspects.nix
templates/default/modules/_example/ci.nix templates/examples/modules/_example/ci.nix
templates/default/modules/_example/defaults.nix templates/examples/modules/_example/defaults.nix
templates/default/modules/_example/home-managed.nix templates/examples/modules/_example/home-managed.nix
templates/default/modules/_example/homes.nix templates/examples/modules/_example/homes.nix
templates/default/modules/_example/hosts.nix templates/examples/modules/_example/hosts.nix
templates/default/modules/_example/import-non-dendritic.nix templates/examples/modules/_example/import-non-dendritic.nix
templates/default/modules/_example/vm.nix templates/examples/modules/_example/vm.nix
templates/default/modules/_profile/README.md templates/examples/modules/_profile/README.md
templates/default/modules/_profile/den-brackets.nix templates/examples/modules/_profile/den-brackets.nix
templates/default/modules/_profile/hosts.nix templates/examples/modules/_profile/hosts.nix
templates/default/modules/_profile/hosts/bones/common-user-env.nix templates/examples/modules/_profile/hosts/bones/common-user-env.nix
templates/default/modules/_profile/namespace.nix templates/examples/modules/_profile/namespace.nix
templates/default/modules/_profile/profiles.nix templates/examples/modules/_profile/profiles.nix
templates/default/modules/_profile/profiles/linux-utils-for-macos.nix templates/examples/modules/_profile/profiles/linux-utils-for-macos.nix
templates/default/modules/_profile/profiles/single-user-is-admin.nix templates/examples/modules/_profile/profiles/single-user-is-admin.nix
templates/default/modules/_profile/users/fido/common-host-env.nix templates/examples/modules/_profile/users/fido/common-host-env.nix
+153 -9
templates/default/modules/den.nix
··· 1 - # USER TODO: remove this file. 2 - # copy any desired module to your ./modules and let it be auto-imported. 3 - { inputs, ... }: 1 + # The best practice is to split this file into several modules, 2 + # creating a directory structure inside `modules/` that makes sense to you. 3 + # See: https://vic.github.io/dendrix/Dendritic.html#no-file-organization-restrictions 4 + { den, config, ... }: 4 5 { 5 - imports = [ 6 - # The _example directory contains CI tests for all den features. 7 - # use it as reference of usage, but of of best practices. 8 - (inputs.import-tree ./_example) 6 + 7 + # First, lets define a NixOS, a nix-darwin and standalone home-manager. 8 + # Feel free to remove, rename or add any other definition. 9 + # NOTE: for nix-darwin/home-manager to work we added dependencies at dendritic.nix. 10 + 11 + # both hosts `igloo` and `apple` have a single user in this setup. 12 + # since user aspect `alice` is the same, they share home configurations. 13 + den.hosts.x86_64-linux.igloo.users.alice = { }; 14 + den.hosts.aarch64-darwin.apple.users.alice = { }; 15 + 16 + # an standalone home-manager configuration sharing `alice` aspect. 17 + # den.homes.aarch64-darwin.alice = { }; 18 + 19 + # Now, lets create some aspects and later include them in our host and user aspects. 20 + # 21 + # Aspects can be defined on let-bindings, or be part of `den.aspects` tree. 22 + # Use let bindings for SMALL one-shot aspects, and an aspect tree for more 23 + # complex and re-usable ones. 24 + 25 + # We define this one inside the `common.provides` aspect tree. 26 + # Please organize your aspects with names that make sense to you 27 + # and on their own directories and modules. 28 + den.aspects.common.provides = { 29 + 30 + # xfce-desktop is a non-parametric aspect. it does not uses context 31 + # for how to behave, it must be included explicitly on a host. 32 + xfce-desktop.nixos = 33 + { lib, ... }: 34 + { 35 + # https://gist.github.com/nat-418/1101881371c9a7b419ba5f944a7118b0 36 + services.xserver = { 37 + enable = true; 38 + desktopManager = { 39 + xterm.enable = false; 40 + xfce.enable = true; 41 + }; 42 + }; 9 43 10 - # The _profile directory contains a minimal profile-based layout. 11 - (inputs.import-tree ./_profile) 44 + services.displayManager = { 45 + defaultSession = lib.mkDefault "xfce"; 46 + enable = true; 47 + }; 48 + }; 49 + 50 + # autologin is context-aware, parametric aspect. 51 + # it applies only if the context has at least { user } 52 + # meaning that has access to user data 53 + autologin = 54 + { user, ... }: 55 + { 56 + nixos = 57 + { config, lib, ... }: 58 + lib.mkIf config.services.displayManager.enable { 59 + services.displayManager.autoLogin.enable = true; 60 + services.displayManager.autoLogin.user = user.userName; 61 + }; 62 + }; 63 + 64 + # This one can be included on igloo host to make USB/VM installers. 65 + vm-bootable = 66 + { host, ... }: 67 + { 68 + nixos = 69 + { modulesPath, ... }: 70 + { 71 + networking.hostName = host.hostName; 72 + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-graphical-base.nix") ]; 73 + }; 74 + }; 75 + }; 76 + 77 + den.aspects.igloo.includes = 78 + let 79 + # an small parametric aspect that needs access to contextual host data. 80 + hostname = 81 + { host, ... }: 82 + { 83 + nixos.networking.hostName = host.name; 84 + }; 85 + in 86 + [ 87 + hostname 88 + den.aspects.common._.vm-bootable 89 + den.aspects.common._.xfce-desktop 90 + ]; 91 + 92 + # NixOS configuration for igloo. 93 + den.aspects.igloo.nixos = 94 + { pkgs, ... }: 95 + { 96 + environment.systemPackages = [ pkgs.hello ]; 97 + }; 98 + 99 + # igloo host provides some home-manager defaults to its users. 100 + den.aspects.igloo.homeManager.programs.direnv.enable = true; 101 + 102 + den.aspects.alice = { 103 + # You can include other aspects, in this case some 104 + # den included batteries that provide common configs. 105 + includes = [ 106 + den.aspects.common._.autologin 107 + den.provides.primary-user # alice is admin always. 108 + (den.provides.user-shell "fish") # default user shell 109 + ]; 110 + 111 + # Alice configures NixOS hosts it lives on. 112 + nixos = 113 + { pkgs, ... }: 114 + { 115 + users.users.alice = { 116 + description = "Alice Cooper"; 117 + packages = [ pkgs.vim ]; 118 + }; 119 + }; 120 + 121 + # Alice home-manager. 122 + homeManager = 123 + { pkgs, ... }: 124 + { 125 + home.packages = [ pkgs.htop ]; 126 + }; 127 + }; 128 + 129 + # Lets also configure some defaults using aspects. 130 + # These are global static settings. 131 + den.default = { 132 + darwin.system.stateVersion = 6; 133 + nixos.system.stateVersion = "25.05"; 134 + homeManager.home.stateVersion = "25.05"; 135 + }; 136 + 137 + # These are functions that produce configs 138 + den.default.includes = [ 139 + # Enable home-manager on all hosts. 140 + den.provides.home-manager 141 + 142 + # Automatically create the user on host. 143 + den.provides.define-user 144 + 145 + # Disable booting when running on CI on all NixOS hosts. 146 + (if config ? _module.args.CI then den.aspects.ci-no-boot else { }) 12 147 ]; 148 + 149 + den.aspects.ci-no-boot = { 150 + description = "Disables booting during CI"; 151 + nixos = { 152 + boot.loader.grub.enable = false; 153 + fileSystems."/".device = "/dev/null"; 154 + }; 155 + }; 156 + 13 157 }
+41 -4
templates/default/modules/dendritic.nix
··· 1 + # This repo was generated with github:vic/flake-file#dendritic template. 2 + # Run `nix run .#write-flake` after changing any input. 3 + # 4 + # Inputs can be placed in any module, the best practice is to have them 5 + # as close as possible to their actual usage. 6 + # See: https://vic.github.io/dendrix/Dendritic.html#minimal-and-focused-flakenix 7 + # 8 + # For our template, we enable home-manager and nix-darwin by default, but 9 + # you are free to remove them if not being used by you. 1 10 { inputs, lib, ... }: 2 11 { 3 - flake-file.inputs.flake-file.url = lib.mkDefault "github:vic/flake-file"; 4 - imports = [ 5 - inputs.flake-file.flakeModules.dendritic 6 - ]; 12 + 13 + # DO-NOT-REMOVE this line unless you know what you are doing. 14 + imports = [ (inputs.flake-file.flakeModules.dendritic or { }) ]; 15 + 16 + flake-file.inputs = { 17 + 18 + # DO-NOT-REMOVE this line unless you know what you are doing. 19 + flake-file.url = lib.mkDefault "github:vic/flake-file"; 20 + 21 + home-manager = { 22 + url = "github:nix-community/home-manager"; 23 + inputs.nixpkgs.follows = "nixpkgs"; 24 + }; 25 + 26 + darwin = { 27 + url = "github:nix-darwin/nix-darwin"; 28 + inputs.nixpkgs.follows = "nixpkgs"; 29 + }; 30 + 31 + ## these stable inputs are for wsl 32 + #nixpkgs-stable.url = "github:nixos/nixpkgs/release-25.05"; 33 + #home-manager-stable.url = "github:nix-community/home-manager/release-25.05"; 34 + #home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable"; 35 + 36 + #nixos-wsl = { 37 + # url = "github:nix-community/nixos-wsl"; 38 + # inputs.nixpkgs.follows = "nixpkgs-stable"; 39 + # inputs.flake-compat.follows = ""; 40 + #}; 41 + 42 + }; 43 + 7 44 }
+16
templates/default/modules/vm.nix
··· 1 + # enables `nix run .#vm`. it is very useful to have a VM 2 + # you can edit your config an launch the VM to test stuff 3 + # instead of having to reboot each time. 4 + { inputs, ... }: 5 + { 6 + perSystem = 7 + { pkgs, ... }: 8 + { 9 + packages.vm = pkgs.writeShellApplication { 10 + name = "vm"; 11 + text = '' 12 + ${inputs.self.nixosConfigurations.igloo.config.system.build.vm}/bin/run-igloo-vm "$@" 13 + ''; 14 + }; 15 + }; 16 + }
+13
templates/examples/modules/den.nix
··· 1 + # USER TODO: remove this file. 2 + # copy any desired module to your ./modules and let it be auto-imported. 3 + { inputs, ... }: 4 + { 5 + imports = [ 6 + # The _example directory contains CI tests for all den features. 7 + # use it as reference of usage, but not of best practices. 8 + (inputs.import-tree ./_example) 9 + 10 + # The _profile directory contains a minimal profile-based layout. 11 + (inputs.import-tree ./_profile) 12 + ]; 13 + }
+85 -3
templates/minimal/flake.lock templates/examples/flake.lock
··· 1 1 { 2 2 "nodes": { 3 + "darwin": { 4 + "inputs": { 5 + "nixpkgs": [ 6 + "nixpkgs" 7 + ] 8 + }, 9 + "locked": { 10 + "lastModified": 1762039661, 11 + "narHash": "sha256-oM5BwAGE78IBLZn+AqxwH/saqwq3e926rNq5HmOulkc=", 12 + "owner": "nix-darwin", 13 + "repo": "nix-darwin", 14 + "rev": "c3c8c9f2a5ed43175ac4dc030308756620e6e4e4", 15 + "type": "github" 16 + }, 17 + "original": { 18 + "owner": "nix-darwin", 19 + "repo": "nix-darwin", 20 + "type": "github" 21 + } 22 + }, 3 23 "den": { 4 24 "locked": { 5 - "lastModified": 1762509200, 6 - "narHash": "sha256-alFgeoB3/Vs2U/G6mO4xSuPHhFivOaPtVKmXsAG7RdY=", 25 + "lastModified": 1762509696, 26 + "narHash": "sha256-G6Y2rlS7mpTSuCN22O7hsyRdgboJzFZz4UdLHKjfTts=", 7 27 "owner": "vic", 8 28 "repo": "den", 9 - "rev": "83e238f3fb88fabb6a77bb43d09e256e4ddb57c5", 29 + "rev": "f2abd24fb8bf6183f80fe5f6ac94baf440d77874", 10 30 "type": "github" 11 31 }, 12 32 "original": { ··· 85 105 "type": "github" 86 106 } 87 107 }, 108 + "home-manager-stable": { 109 + "inputs": { 110 + "nixpkgs": [ 111 + "nixpkgs-stable" 112 + ] 113 + }, 114 + "locked": { 115 + "lastModified": 1758463745, 116 + "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", 117 + "owner": "nix-community", 118 + "repo": "home-manager", 119 + "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", 120 + "type": "github" 121 + }, 122 + "original": { 123 + "owner": "nix-community", 124 + "ref": "release-25.05", 125 + "repo": "home-manager", 126 + "type": "github" 127 + } 128 + }, 88 129 "import-tree": { 89 130 "locked": { 90 131 "lastModified": 1761120675, ··· 120 161 "type": "github" 121 162 } 122 163 }, 164 + "nixos-wsl": { 165 + "inputs": { 166 + "flake-compat": [], 167 + "nixpkgs": [ 168 + "nixpkgs-stable" 169 + ] 170 + }, 171 + "locked": { 172 + "lastModified": 1761969132, 173 + "narHash": "sha256-0me4+e+1VxNuvySSw0voqMCWU/eUmTuth7f4+Q2jbUY=", 174 + "owner": "nix-community", 175 + "repo": "nixos-wsl", 176 + "rev": "761582d6ab431549fe1396d2cd681e3fe9376020", 177 + "type": "github" 178 + }, 179 + "original": { 180 + "owner": "nix-community", 181 + "repo": "nixos-wsl", 182 + "type": "github" 183 + } 184 + }, 123 185 "nixpkgs": { 124 186 "locked": { 125 187 "lastModified": 1761880412, ··· 136 198 "type": "github" 137 199 } 138 200 }, 201 + "nixpkgs-stable": { 202 + "locked": { 203 + "lastModified": 1762081535, 204 + "narHash": "sha256-+j+CUiaUoa87EhnSOqG5pwXdJWahP8vo6BE0ekssdzs=", 205 + "owner": "nixos", 206 + "repo": "nixpkgs", 207 + "rev": "2afc9d6e79b59ea9bcaf620d335623b0f7c2ce96", 208 + "type": "github" 209 + }, 210 + "original": { 211 + "owner": "nixos", 212 + "ref": "release-25.05", 213 + "repo": "nixpkgs", 214 + "type": "github" 215 + } 216 + }, 139 217 "root": { 140 218 "inputs": { 219 + "darwin": "darwin", 141 220 "den": "den", 142 221 "flake-aspects": "flake-aspects", 143 222 "flake-file": "flake-file", 144 223 "flake-parts": "flake-parts", 145 224 "home-manager": "home-manager", 225 + "home-manager-stable": "home-manager-stable", 146 226 "import-tree": "import-tree", 147 227 "nix-auto-follow": "nix-auto-follow", 228 + "nixos-wsl": "nixos-wsl", 148 229 "nixpkgs": "nixpkgs", 149 230 "nixpkgs-lib": [ 150 231 "nixpkgs" 151 232 ], 233 + "nixpkgs-stable": "nixpkgs-stable", 152 234 "systems": "systems", 153 235 "treefmt-nix": "treefmt-nix" 154 236 }
+30
templates/minimal/flake.nix templates/examples/flake.nix
··· 5 5 outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 6 6 7 7 inputs = { 8 + darwin = { 9 + inputs = { 10 + nixpkgs = { 11 + follows = "nixpkgs"; 12 + }; 13 + }; 14 + url = "github:nix-darwin/nix-darwin"; 15 + }; 8 16 den = { 9 17 url = "github:vic/den"; 10 18 }; ··· 30 38 }; 31 39 url = "github:nix-community/home-manager"; 32 40 }; 41 + home-manager-stable = { 42 + inputs = { 43 + nixpkgs = { 44 + follows = "nixpkgs-stable"; 45 + }; 46 + }; 47 + url = "github:nix-community/home-manager/release-25.05"; 48 + }; 33 49 import-tree = { 34 50 url = "github:vic/import-tree"; 35 51 }; ··· 41 57 }; 42 58 url = "github:fzakaria/nix-auto-follow"; 43 59 }; 60 + nixos-wsl = { 61 + inputs = { 62 + flake-compat = { 63 + follows = ""; 64 + }; 65 + nixpkgs = { 66 + follows = "nixpkgs-stable"; 67 + }; 68 + }; 69 + url = "github:nix-community/nixos-wsl"; 70 + }; 44 71 nixpkgs = { 45 72 url = "github:nixos/nixpkgs/nixpkgs-unstable"; 46 73 }; 47 74 nixpkgs-lib = { 48 75 follows = "nixpkgs"; 76 + }; 77 + nixpkgs-stable = { 78 + url = "github:nixos/nixpkgs/release-25.05"; 49 79 }; 50 80 systems = { 51 81 url = "github:nix-systems/default";
-6
templates/minimal/modules/aspects.nix
··· 1 - # A best practice is not to use a single file 2 - # but split into modules in directories. 3 - { 4 - # den.aspects.my-laptop = { }; 5 - # den.aspects.my-user = { }; 6 - }
-9
templates/minimal/modules/defaults.nix
··· 1 - # User TODO: Remove this file. 2 - { 3 - # default aspect can be used for global static settings. 4 - den.default = { 5 - darwin.system.stateVersion = 6; 6 - nixos.system.stateVersion = "25.05"; 7 - homeManager.home.stateVersion = "25.05"; 8 - }; 9 - }
templates/minimal/modules/dendritic.nix templates/examples/modules/dendritic.nix
-13
templates/minimal/modules/homes.nix
··· 1 - { den, ... }: 2 - { 3 - # Define standalone homes. 4 - # den.homes.x86_64-linux.alice = {}; 5 - 6 - # Enable home-manager for NixOS/Darwin 7 - den.default.includes = [ den._.home-manager ]; 8 - 9 - flake-file.inputs.home-manager = { 10 - url = "github:nix-community/home-manager"; 11 - inputs.nixpkgs.follows = "nixpkgs"; 12 - }; 13 - }
-3
templates/minimal/modules/hosts.nix
··· 1 - { 2 - # den.hosts.x86_64-linux.my-laptop.users.my-user = {}; 3 - }