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.

simplify bogus template, add link to debugging tips. (#146)

authored by

Victor Borja and committed by
GitHub
0f6cc311 b07ef22d

+127 -181
+18 -1
.github/workflows/test.yml
··· 53 53 EOF 54 54 git add templates/minimal/modules/ci-runtime.nix 55 55 - run: nix flake check ./templates/minimal --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA 56 + bogus: 57 + needs: [non-draft] 58 + name: bogus 59 + runs-on: ubuntu-latest 60 + steps: 61 + - uses: wimpysworld/nothing-but-nix@main 62 + - uses: cachix/install-nix-action@v31 63 + - uses: DeterminateSystems/magic-nix-cache-action@v13 64 + - uses: actions/checkout@v4 65 + - run: | 66 + cat <<-EOF > templates/bogus/modules/ci-runtime.nix 67 + { 68 + _module.args.CI = true; 69 + } 70 + EOF 71 + git add templates/bogus/modules/ci-runtime.nix 72 + - run: nix flake check ./templates/bogus --override-input den github:$GITHUB_REPOSITORY/$GITHUB_SHA 56 73 template: 57 74 needs: [non-draft] 58 75 strategy: 59 76 matrix: 60 77 os: [ubuntu-latest, macos-latest] 61 - template: [default, bogus, ci, example] 78 + template: [default, ci, example] 62 79 name: Check template ${{matrix.template}} ${{matrix.os}} 63 80 runs-on: ${{matrix.os}} 64 81 steps:
+1 -1
templates/bogus/.github/workflows/test.yml
··· 8 8 flake-check: 9 9 strategy: 10 10 matrix: 11 - os: [ubuntu-latest, macos-latest] 11 + os: [ubuntu-latest] 12 12 name: Nix flake check 13 13 runs-on: ${{matrix.os}} 14 14 steps:
+13 -4
templates/bogus/README.md
··· 4 4 5 5 Create a **minimal** bug reproduction at [`modules/bug.nix`](modules/bug.nix) 6 6 7 + See also [Den debugging tips](https://den.oeiuwq.com/debugging.html) 8 + 7 9 Then run tests: 8 10 9 - ```console 11 + ```shell 10 12 nix flake check 11 13 ``` 12 14 13 - Format code with: 15 + Please share a link to your reproduction repo, showing the CI step and the 16 + error at CI build. 17 + 18 + ## Fixing Den 19 + 20 + If you are contributing a bug-fix PR, you can use the following command to 21 + use your local den checkout. 14 22 15 - ```console 16 - nix fmt 23 + ```shell 24 + cd <den-working-copy> 25 + nix flake check --override-input den . ./templates/bogus 17 26 ```
+45 -79
templates/bogus/flake.lock
··· 1 1 { 2 2 "nodes": { 3 - "darwin": { 4 - "inputs": { 5 - "nixpkgs": [ 6 - "nixpkgs" 7 - ] 8 - }, 9 - "locked": { 10 - "lastModified": 1763505477, 11 - "narHash": "sha256-nJRd4LY2kT3OELfHqdgWjvToNZ4w+zKCMzS2R6z4sXE=", 12 - "owner": "nix-darwin", 13 - "repo": "nix-darwin", 14 - "rev": "3bda9f6b14161becbd07b3c56411f1670e19b9b5", 15 - "type": "github" 16 - }, 17 - "original": { 18 - "owner": "nix-darwin", 19 - "repo": "nix-darwin", 20 - "type": "github" 21 - } 22 - }, 23 3 "den": { 24 4 "locked": { 25 - "lastModified": 1763707606, 26 - "narHash": "sha256-l9v3NNdKj3GJvV5LhzsWDs4Sl2bg0tuKNFFkMeFvUWo=", 5 + "lastModified": 1770400943, 6 + "narHash": "sha256-73eh5R6UQOP6B04dxot7Jdxmc/nd3n9fe1XX8vp8l3Q=", 27 7 "owner": "vic", 28 8 "repo": "den", 29 - "rev": "8164e0d89c59839d67757bc9a1fb61770dc6e8b7", 9 + "rev": "b07ef22d338ef765e4e296fb3223ba3cf4e9ae82", 30 10 "type": "github" 31 11 }, 32 12 "original": { 33 13 "owner": "vic", 34 - "ref": "main", 35 14 "repo": "den", 36 15 "type": "github" 37 16 } 38 17 }, 39 18 "flake-aspects": { 40 19 "locked": { 41 - "lastModified": 1769717274, 20 + "lastModified": 1769723924, 42 21 "narHash": "sha256-U15OaMr9AcJiB1wW2uCFzFO+DnQ3jJSvln+ZR/+Q0vE=", 43 22 "owner": "vic", 44 23 "repo": "flake-aspects", 45 - "rev": "a35ed5efc9a629694d659d606230ba18a76cefaa", 24 + "rev": "61524836788ef6991a82e7d34ebb0ccc05d374ed", 46 25 "type": "github" 47 26 }, 48 27 "original": { ··· 51 30 "type": "github" 52 31 } 53 32 }, 54 - "flake-file": { 55 - "locked": { 56 - "lastModified": 1763706734, 57 - "narHash": "sha256-kR1Rrh9evfiJaTb6ufWCSk6GMtrnPKFydqQUV0Bb4Eg=", 58 - "owner": "vic", 59 - "repo": "flake-file", 60 - "rev": "9af20d5e62c94b658b4d0671829393c1b8bb0b3e", 61 - "type": "github" 62 - }, 63 - "original": { 64 - "owner": "vic", 65 - "repo": "flake-file", 66 - "type": "github" 67 - } 68 - }, 69 33 "flake-parts": { 70 34 "inputs": { 71 35 "nixpkgs-lib": [ 72 - "nixpkgs-lib" 36 + "nixpkgs" 73 37 ] 74 38 }, 75 39 "locked": { 76 - "lastModified": 1762440070, 77 - "narHash": "sha256-xxdepIcb39UJ94+YydGP221rjnpkDZUlykKuF54PsqI=", 40 + "lastModified": 1769996383, 41 + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", 78 42 "owner": "hercules-ci", 79 43 "repo": "flake-parts", 80 - "rev": "26d05891e14c88eb4a5d5bee659c0db5afb609d8", 44 + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", 81 45 "type": "github" 82 46 }, 83 47 "original": { ··· 93 57 ] 94 58 }, 95 59 "locked": { 96 - "lastModified": 1762463325, 97 - "narHash": "sha256-33YUsWpPyeBZEWrKQ2a1gkRZ7i0XCC/2MYpU6BVeQSU=", 60 + "lastModified": 1770491427, 61 + "narHash": "sha256-8b+0vixdqGnIIcgsPhjdX7EGPdzcVQqYxF+ujjex654=", 98 62 "owner": "nix-community", 99 63 "repo": "home-manager", 100 - "rev": "0562fef070a1027325dd4ea10813d64d2c967b39", 64 + "rev": "cbd8a72e5fe6af19d40e2741dc440d9227836860", 101 65 "type": "github" 102 66 }, 103 67 "original": { ··· 108 72 }, 109 73 "import-tree": { 110 74 "locked": { 111 - "lastModified": 1762327901, 112 - "narHash": "sha256-AJ96FNj50DU0bTyIzAPkPOjCZTHqjURVjok8qoXvmqM=", 75 + "lastModified": 1763762820, 76 + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", 113 77 "owner": "vic", 114 78 "repo": "import-tree", 115 - "rev": "90fa129798be99cde036b78658e89475710966a1", 79 + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", 116 80 "type": "github" 117 81 }, 118 82 "original": { ··· 121 85 "type": "github" 122 86 } 123 87 }, 88 + "nix-github-actions": { 89 + "inputs": { 90 + "nixpkgs": [ 91 + "nix-unit", 92 + "nixpkgs" 93 + ] 94 + }, 95 + "locked": { 96 + "lastModified": 1737420293, 97 + "narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=", 98 + "owner": "nix-community", 99 + "repo": "nix-github-actions", 100 + "rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9", 101 + "type": "github" 102 + }, 103 + "original": { 104 + "owner": "nix-community", 105 + "repo": "nix-github-actions", 106 + "type": "github" 107 + } 108 + }, 124 109 "nix-unit": { 125 110 "inputs": { 126 111 "flake-parts": [ 127 112 "flake-parts" 128 113 ], 114 + "nix-github-actions": "nix-github-actions", 129 115 "nixpkgs": [ 130 116 "nixpkgs" 131 117 ], 132 118 "treefmt-nix": "treefmt-nix" 133 119 }, 134 120 "locked": { 135 - "lastModified": 1762507096, 136 - "narHash": "sha256-dE3CbZR8KRDdb3b4fhMnpvhEl6XB+UnrLezuFekQ2ME=", 121 + "lastModified": 1762774186, 122 + "narHash": "sha256-hRADkHjNt41+JUHw2EiSkMaL4owL83g5ZppjYUdF/Dc=", 137 123 "owner": "nix-community", 138 124 "repo": "nix-unit", 139 - "rev": "0d7230bc54783b812a5817398885aec660a93051", 125 + "rev": "1c9ab50554eed0b768f9e5b6f646d63c9673f0f7", 140 126 "type": "github" 141 127 }, 142 128 "original": { ··· 147 133 }, 148 134 "nixpkgs": { 149 135 "locked": { 150 - "lastModified": 1762361079, 151 - "narHash": "sha256-lz718rr1BDpZBYk7+G8cE6wee3PiBUpn8aomG/vLLiY=", 136 + "lastModified": 1770380644, 137 + "narHash": "sha256-P7dWMHRUWG5m4G+06jDyThXO7kwSk46C1kgjEWcybkE=", 152 138 "owner": "nixos", 153 139 "repo": "nixpkgs", 154 - "rev": "ffcdcf99d65c61956d882df249a9be53e5902ea5", 140 + "rev": "ae67888ff7ef9dff69b3cf0cc0fbfbcd3a722abe", 155 141 "type": "github" 156 142 }, 157 143 "original": { ··· 163 149 }, 164 150 "root": { 165 151 "inputs": { 166 - "darwin": "darwin", 167 152 "den": "den", 168 153 "flake-aspects": "flake-aspects", 169 - "flake-file": "flake-file", 170 154 "flake-parts": "flake-parts", 171 155 "home-manager": "home-manager", 172 156 "import-tree": "import-tree", 173 157 "nix-unit": "nix-unit", 174 - "nixpkgs": "nixpkgs", 175 - "nixpkgs-lib": [ 176 - "nixpkgs" 177 - ], 178 - "systems": "systems" 179 - } 180 - }, 181 - "systems": { 182 - "locked": { 183 - "lastModified": 1681028828, 184 - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 185 - "owner": "nix-systems", 186 - "repo": "default", 187 - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 188 - "type": "github" 189 - }, 190 - "original": { 191 - "owner": "nix-systems", 192 - "repo": "default", 193 - "type": "github" 158 + "nixpkgs": "nixpkgs" 194 159 } 195 160 }, 196 161 "treefmt-nix": { 197 162 "inputs": { 198 163 "nixpkgs": [ 164 + "nix-unit", 199 165 "nixpkgs" 200 166 ] 201 167 },
+13 -23
templates/bogus/flake.nix
··· 1 - # DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file. 2 - # Use `nix run .#write-flake` to regenerate it. 3 1 { 4 - 5 2 outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 6 3 7 4 inputs = { 8 - darwin = { 9 - inputs.nixpkgs.follows = "nixpkgs"; 10 - url = "github:nix-darwin/nix-darwin"; 11 - }; 12 - den.url = "github:vic/den/main"; 5 + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 6 + import-tree.url = "github:vic/import-tree"; 13 7 flake-aspects.url = "github:vic/flake-aspects"; 14 - flake-file.url = "github:vic/flake-file"; 8 + den.url = "github:vic/den"; 9 + 15 10 flake-parts = { 16 - inputs.nixpkgs-lib.follows = "nixpkgs-lib"; 17 11 url = "github:hercules-ci/flake-parts"; 18 - }; 19 - home-manager = { 20 - inputs.nixpkgs.follows = "nixpkgs"; 21 - url = "github:nix-community/home-manager"; 12 + inputs.nixpkgs-lib.follows = "nixpkgs"; 22 13 }; 23 - import-tree.url = "github:vic/import-tree"; 14 + 24 15 nix-unit = { 25 - inputs = { 26 - flake-parts.follows = "flake-parts"; 27 - nixpkgs.follows = "nixpkgs"; 28 - }; 29 16 url = "github:nix-community/nix-unit"; 17 + inputs.nixpkgs.follows = "nixpkgs"; 18 + inputs.flake-parts.follows = "flake-parts"; 30 19 }; 31 - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 32 - nixpkgs-lib.follows = "nixpkgs"; 33 - systems.url = "github:nix-systems/default"; 20 + 21 + home-manager = { 22 + url = "github:nix-community/home-manager"; 23 + inputs.nixpkgs.follows = "nixpkgs"; 24 + }; 34 25 }; 35 - 36 26 }
+14 -13
templates/bogus/modules/bug.nix
··· 1 - { inputs, lib, ... }: 1 + { inputs, den, ... }: 2 2 { 3 3 den.hosts.x86_64-linux.igloo.users.tux = { }; 4 - den.hosts.aarch64-darwin.apple.users.tim = { }; 4 + 5 + # See [Debugging Tips](https://den.oeiuwq.com/debugging.html) 6 + flake.den = den; 5 7 6 8 # Use aspects to create a **minimal** bug reproduction 7 - den.aspects.igloo.nixos = 8 - { pkgs, ... }: 9 - { 10 - users.users.tux.packages = [ pkgs.hello ]; 9 + den.aspects.testing = 10 + { user, ... }@ctx: 11 + builtins.trace ctx.host.hostName { 12 + homeManager.programs.vim.enable = user.userName == "tux"; 11 13 }; 12 14 13 - # rename "it works", evidently it has bugs 15 + den.aspects.igloo.includes = [ den.aspects.testing ]; 16 + 14 17 flake.tests."test it works" = 15 18 let 16 - tux = inputs.self.nixosConfigurations.igloo.config.users.users.tux; 19 + igloo = inputs.self.nixosConfigurations.igloo.config; 20 + tux = igloo.home-manager.users.tux; 17 21 18 - expr.len = lib.length tux.packages; 19 - expr.names = map lib.getName tux.packages; 20 - 21 - expected.len = 1; 22 - expected.names = [ "hello" ]; 22 + expr = tux.programs.vim.enable; 23 + expected = true; 23 24 in 24 25 { 25 26 inherit expr expected;
-9
templates/bogus/modules/dendritic.nix
··· 1 - { inputs, lib, ... }: 2 - { 3 - flake-file.inputs.flake-file.url = lib.mkDefault "github:vic/flake-file"; 4 - flake-file.inputs.den.url = lib.mkDefault "github:vic/den"; 5 - imports = [ 6 - (inputs.flake-file.flakeModules.dendritic or { }) 7 - (inputs.den.flakeModules.dendritic or { }) 8 - ]; 9 - }
-26
templates/bogus/modules/flakes.nix
··· 1 - # DO-NOT-CHANGE. Keep your reproduction minimalistic! 2 - # 3 - # try not adding new inputs 4 - # but if you have no options (pun intended) 5 - # here's the place. 6 - # 7 - # IF you make any change to this file, use: 8 - # `nix run .#write-flake` 9 - # 10 - # We provide nix-darwin and home-manager for common usage. 11 - { 12 - # change "main" with a commit where bug is present 13 - flake-file.inputs.den.url = "github:vic/den/main"; 14 - 15 - # included so we can test HM integrations. 16 - flake-file.inputs.home-manager = { 17 - url = "github:nix-community/home-manager"; 18 - inputs.nixpkgs.follows = "nixpkgs"; 19 - }; 20 - 21 - # included for testing darwin hosts. 22 - flake-file.inputs.darwin = { 23 - url = "github:nix-darwin/nix-darwin"; 24 - inputs.nixpkgs.follows = "nixpkgs"; 25 - }; 26 - }
-19
templates/bogus/modules/nix-unit.nix
··· 1 - # DO-NOT-EDIT: nix-unit configuration. 2 - { lib, inputs, ... }: 3 - { 4 - 5 - flake-file.inputs.nix-unit = { 6 - url = "github:nix-community/nix-unit"; 7 - inputs.nixpkgs.follows = "nixpkgs"; 8 - inputs.flake-parts.follows = "flake-parts"; 9 - }; 10 - 11 - imports = [ 12 - inputs.nix-unit.modules.flake.default 13 - ]; 14 - 15 - perSystem.nix-unit = { 16 - allowNetwork = lib.mkDefault true; 17 - inputs = lib.mkDefault inputs; 18 - }; 19 - }
+23 -6
templates/bogus/modules/test-base.nix
··· 1 - { den, lib, ... }: 1 + # DO-NOT-EDIT unless necessary. Keep your reproduction repo minimal. 2 + { 3 + den, 4 + lib, 5 + inputs, 6 + ... 7 + }: 2 8 { 3 - den.default.nixos.system.stateVersion = "25.11"; 4 - den.default.homeManager.home.stateVersion = "25.11"; 5 - den.default.darwin.system.stateVersion = 6; 9 + imports = [ 10 + inputs.den.flakeModule 11 + inputs.nix-unit.modules.flake.default 12 + ]; 13 + 14 + systems = lib.attrNames den.hosts; 15 + 16 + den.default.nixos.system.stateVersion = "26.05"; 17 + den.default.homeManager.home.stateVersion = "26.05"; 6 18 7 19 den.default.includes = [ 8 - den._.home-manager 9 - den._.define-user 20 + den.provides.home-manager 21 + den.provides.define-user 10 22 den.aspects.no-boot 11 23 ]; 12 24 13 25 den.aspects.no-boot.nixos = { 14 26 boot.loader.grub.enable = lib.mkForce false; 15 27 fileSystems."/".device = lib.mkForce "/dev/fake"; 28 + }; 29 + 30 + perSystem.nix-unit = { 31 + allowNetwork = lib.mkDefault true; 32 + inputs = lib.mkDefault inputs; 16 33 }; 17 34 }