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

init

oeiuwq.com 548bd64e

+763
+14
.github/FUNDING.yml
··· 1 + # These are supported funding model platforms 2 + github: [vic] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 3 + patreon: # Replace with a single Patreon username 4 + open_collective: # Replace with a single Open Collective username 5 + ko_fi: oeiuwq # Replace with a single Ko-fi username 6 + tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 7 + community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 8 + liberapay: # Replace with a single Liberapay username 9 + issuehunt: # Replace with a single IssueHunt username 10 + lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 11 + polar: # Replace with a single Polar username 12 + buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 13 + thanks_dev: # Replace with a single thanks.dev username 14 + custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+19
.github/workflows/template.yaml
··· 1 + name: template 2 + on: 3 + push: 4 + branches: ["main"] 5 + pull_request: 6 + jobs: 7 + template: 8 + name: Check template 9 + runs-on: ubuntu-latest 10 + steps: 11 + - uses: wimpysworld/nothing-but-nix@main 12 + - uses: DeterminateSystems/nix-installer-action@main 13 + - uses: DeterminateSystems/magic-nix-cache-action@main 14 + - run: | 15 + set -uveo pipefail 16 + mkdir templated; cd templated 17 + nix flake init -t github:$GITHUB_REPOSITORY/$GITHUB_SHA#default 18 + nix flake update 19 + nix build .#vm
+11
.github/workflows/test.yml
··· 1 + on: 2 + pull_request: 3 + push: 4 + branches: [main] 5 + jobs: 6 + flake-check: 7 + name: nix flake check 8 + runs-on: ubuntu-latest 9 + steps: 10 + - uses: cachix/install-nix-action@v30 11 + - run: nix flake check -L github:vic/checkmate --override-input target github:$GITHUB_REPOSITORY/$GITHUB_SHA
+201
LICENSE
··· 1 + Apache License 2 + Version 2.0, January 2004 3 + http://www.apache.org/licenses/ 4 + 5 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 + 7 + 1. Definitions. 8 + 9 + "License" shall mean the terms and conditions for use, reproduction, 10 + and distribution as defined by Sections 1 through 9 of this document. 11 + 12 + "Licensor" shall mean the copyright owner or entity authorized by 13 + the copyright owner that is granting the License. 14 + 15 + "Legal Entity" shall mean the union of the acting entity and all 16 + other entities that control, are controlled by, or are under common 17 + control with that entity. For the purposes of this definition, 18 + "control" means (i) the power, direct or indirect, to cause the 19 + direction or management of such entity, whether by contract or 20 + otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 + outstanding shares, or (iii) beneficial ownership of such entity. 22 + 23 + "You" (or "Your") shall mean an individual or Legal Entity 24 + exercising permissions granted by this License. 25 + 26 + "Source" form shall mean the preferred form for making modifications, 27 + including but not limited to software source code, documentation 28 + source, and configuration files. 29 + 30 + "Object" form shall mean any form resulting from mechanical 31 + transformation or translation of a Source form, including but 32 + not limited to compiled object code, generated documentation, 33 + and conversions to other media types. 34 + 35 + "Work" shall mean the work of authorship, whether in Source or 36 + Object form, made available under the License, as indicated by a 37 + copyright notice that is included in or attached to the work 38 + (an example is provided in the Appendix below). 39 + 40 + "Derivative Works" shall mean any work, whether in Source or Object 41 + form, that is based on (or derived from) the Work and for which the 42 + editorial revisions, annotations, elaborations, or other modifications 43 + represent, as a whole, an original work of authorship. For the purposes 44 + of this License, Derivative Works shall not include works that remain 45 + separable from, or merely link (or bind by name) to the interfaces of, 46 + the Work and Derivative Works thereof. 47 + 48 + "Contribution" shall mean any work of authorship, including 49 + the original version of the Work and any modifications or additions 50 + to that Work or Derivative Works thereof, that is intentionally 51 + submitted to Licensor for inclusion in the Work by the copyright owner 52 + or by an individual or Legal Entity authorized to submit on behalf of 53 + the copyright owner. For the purposes of this definition, "submitted" 54 + means any form of electronic, verbal, or written communication sent 55 + to the Licensor or its representatives, including but not limited to 56 + communication on electronic mailing lists, source code control systems, 57 + and issue tracking systems that are managed by, or on behalf of, the 58 + Licensor for the purpose of discussing and improving the Work, but 59 + excluding communication that is conspicuously marked or otherwise 60 + designated in writing by the copyright owner as "Not a Contribution." 61 + 62 + "Contributor" shall mean Licensor and any individual or Legal Entity 63 + on behalf of whom a Contribution has been received by Licensor and 64 + subsequently incorporated within the Work. 65 + 66 + 2. Grant of Copyright License. Subject to the terms and conditions of 67 + this License, each Contributor hereby grants to You a perpetual, 68 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 + copyright license to reproduce, prepare Derivative Works of, 70 + publicly display, publicly perform, sublicense, and distribute the 71 + Work and such Derivative Works in Source or Object form. 72 + 73 + 3. Grant of Patent License. Subject to the terms and conditions of 74 + this License, each Contributor hereby grants to You a perpetual, 75 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 + (except as stated in this section) patent license to make, have made, 77 + use, offer to sell, sell, import, and otherwise transfer the Work, 78 + where such license applies only to those patent claims licensable 79 + by such Contributor that are necessarily infringed by their 80 + Contribution(s) alone or by combination of their Contribution(s) 81 + with the Work to which such Contribution(s) was submitted. If You 82 + institute patent litigation against any entity (including a 83 + cross-claim or counterclaim in a lawsuit) alleging that the Work 84 + or a Contribution incorporated within the Work constitutes direct 85 + or contributory patent infringement, then any patent licenses 86 + granted to You under this License for that Work shall terminate 87 + as of the date such litigation is filed. 88 + 89 + 4. Redistribution. You may reproduce and distribute copies of the 90 + Work or Derivative Works thereof in any medium, with or without 91 + modifications, and in Source or Object form, provided that You 92 + meet the following conditions: 93 + 94 + (a) You must give any other recipients of the Work or 95 + Derivative Works a copy of this License; and 96 + 97 + (b) You must cause any modified files to carry prominent notices 98 + stating that You changed the files; and 99 + 100 + (c) You must retain, in the Source form of any Derivative Works 101 + that You distribute, all copyright, patent, trademark, and 102 + attribution notices from the Source form of the Work, 103 + excluding those notices that do not pertain to any part of 104 + the Derivative Works; and 105 + 106 + (d) If the Work includes a "NOTICE" text file as part of its 107 + distribution, then any Derivative Works that You distribute must 108 + include a readable copy of the attribution notices contained 109 + within such NOTICE file, excluding those notices that do not 110 + pertain to any part of the Derivative Works, in at least one 111 + of the following places: within a NOTICE text file distributed 112 + as part of the Derivative Works; within the Source form or 113 + documentation, if provided along with the Derivative Works; or, 114 + within a display generated by the Derivative Works, if and 115 + wherever such third-party notices normally appear. The contents 116 + of the NOTICE file are for informational purposes only and 117 + do not modify the License. You may add Your own attribution 118 + notices within Derivative Works that You distribute, alongside 119 + or as an addendum to the NOTICE text from the Work, provided 120 + that such additional attribution notices cannot be construed 121 + as modifying the License. 122 + 123 + You may add Your own copyright statement to Your modifications and 124 + may provide additional or different license terms and conditions 125 + for use, reproduction, or distribution of Your modifications, or 126 + for any such Derivative Works as a whole, provided Your use, 127 + reproduction, and distribution of the Work otherwise complies with 128 + the conditions stated in this License. 129 + 130 + 5. Submission of Contributions. Unless You explicitly state otherwise, 131 + any Contribution intentionally submitted for inclusion in the Work 132 + by You to the Licensor shall be under the terms and conditions of 133 + this License, without any additional terms or conditions. 134 + Notwithstanding the above, nothing herein shall supersede or modify 135 + the terms of any separate license agreement you may have executed 136 + with Licensor regarding such Contributions. 137 + 138 + 6. Trademarks. This License does not grant permission to use the trade 139 + names, trademarks, service marks, or product names of the Licensor, 140 + except as required for reasonable and customary use in describing the 141 + origin of the Work and reproducing the content of the NOTICE file. 142 + 143 + 7. Disclaimer of Warranty. Unless required by applicable law or 144 + agreed to in writing, Licensor provides the Work (and each 145 + Contributor provides its Contributions) on an "AS IS" BASIS, 146 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 + implied, including, without limitation, any warranties or conditions 148 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 + PARTICULAR PURPOSE. You are solely responsible for determining the 150 + appropriateness of using or redistributing the Work and assume any 151 + risks associated with Your exercise of permissions under this License. 152 + 153 + 8. Limitation of Liability. In no event and under no legal theory, 154 + whether in tort (including negligence), contract, or otherwise, 155 + unless required by applicable law (such as deliberate and grossly 156 + negligent acts) or agreed to in writing, shall any Contributor be 157 + liable to You for damages, including any direct, indirect, special, 158 + incidental, or consequential damages of any character arising as a 159 + result of this License or out of the use or inability to use the 160 + Work (including but not limited to damages for loss of goodwill, 161 + work stoppage, computer failure or malfunction, or any and all 162 + other commercial damages or losses), even if such Contributor 163 + has been advised of the possibility of such damages. 164 + 165 + 9. Accepting Warranty or Additional Liability. While redistributing 166 + the Work or Derivative Works thereof, You may choose to offer, 167 + and charge a fee for, acceptance of support, warranty, indemnity, 168 + or other liability obligations and/or rights consistent with this 169 + License. However, in accepting such obligations, You may act only 170 + on Your own behalf and on Your sole responsibility, not on behalf 171 + of any other Contributor, and only if You agree to indemnify, 172 + defend, and hold each Contributor harmless for any liability 173 + incurred by, or claims asserted against, such Contributor by reason 174 + of your accepting any such warranty or additional liability. 175 + 176 + END OF TERMS AND CONDITIONS 177 + 178 + APPENDIX: How to apply the Apache License to your work. 179 + 180 + To apply the Apache License to your work, attach the following 181 + boilerplate notice, with the fields enclosed by brackets "[]" 182 + replaced with your own identifying information. (Don't include 183 + the brackets!) The text should be enclosed in the appropriate 184 + comment syntax for the file format. We also recommend that a 185 + file or class name and description of purpose be included on the 186 + same "printed page" as the copyright notice for easier 187 + identification within third-party archives. 188 + 189 + Copyright [yyyy] [name of copyright owner] 190 + 191 + Licensed under the Apache License, Version 2.0 (the "License"); 192 + you may not use this file except in compliance with the License. 193 + You may obtain a copy of the License at 194 + 195 + http://www.apache.org/licenses/LICENSE-2.0 196 + 197 + Unless required by applicable law or agreed to in writing, software 198 + distributed under the License is distributed on an "AS IS" BASIS, 199 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 + See the License for the specific language governing permissions and 201 + limitations under the License.
+1
README.md
··· 1 + # den - Dendritic nix host configuration.
+2
checkmate.nix
··· 1 + { 2 + }
+1
checkmate/.gitignore
··· 1 + flake.lock
+7
checkmate/flake.nix
··· 1 + { 2 + inputs.target.url = "path:.."; 3 + inputs.checkmate.url = "github:vic/checkmate"; 4 + inputs.checkmate.inputs.target.follows = "target"; 5 + inputs.flake-parts.url = "github:hercules-ci/flake-parts"; 6 + outputs = inputs: inputs.checkmate.lib.newFlake; 7 + }
+5
flake.nix
··· 1 + { 2 + outputs = _: { 3 + flakeModule = ./nix/flakeModule.nix; 4 + }; 5 + }
+56
nix/aspects-config.nix
··· 1 + # create aspect dependencies from hosts/users 2 + { lib, config, ... }: 3 + let 4 + hosts = lib.attrValues config.den.hosts; 5 + 6 + hostAspect = 7 + host: 8 + { aspects, ... }: 9 + { 10 + ${host.aspect} = { 11 + description = lib.mkDefault "Host ${host.hostName}"; 12 + includes = [ aspects.${host.class} ]; 13 + ${host.class} = { }; 14 + }; 15 + ${host.class}.${host.class} = { }; 16 + }; 17 + 18 + hostUsers = host: lib.attrValues host.users; 19 + 20 + hostIncludesUser = 21 + host: user: 22 + { aspects, ... }: 23 + { 24 + ${host.aspect} = { 25 + includes = [ aspects.${user.aspect} ]; 26 + }; 27 + ${user.aspect} = { 28 + description = lib.mkDefault "User ${user.userName}"; 29 + ${user.class} = { }; 30 + ${host.class} = { }; 31 + }; 32 + }; 33 + 34 + hmUsers = host: lib.filter (u: u.class == "homeManager") (hostUsers host); 35 + anyHm = host: lib.length (hmUsers host) > 0; 36 + hostHomeManager = 37 + host: 38 + { aspects, ... }: 39 + { 40 + ${host.aspect}.includes = [ aspects.homeManager ]; 41 + }; 42 + homeManager.homeManager.description = "home manager aspect"; 43 + 44 + deps = lib.map (host: [ 45 + (hostAspect host) 46 + (lib.map (hostIncludesUser host) (hostUsers host)) 47 + (lib.optionals (anyHm host) [ 48 + (hostHomeManager host) 49 + homeManager 50 + ]) 51 + ]) hosts; 52 + 53 + in 54 + { 55 + flake.aspects = lib.mkMerge (lib.flatten deps); 56 + }
+11
nix/flakeModule.nix
··· 1 + { lib, ... }: 2 + let 3 + types = import ./types.nix lib; 4 + in 5 + { 6 + imports = [ 7 + ./os-config.nix 8 + ./aspects-config.nix 9 + ]; 10 + options.den.hosts = types.hostsOption; 11 + }
+30
nix/os-config.nix
··· 1 + # Instantiate osConfigurations from hosts 2 + { 3 + inputs, 4 + lib, 5 + config, 6 + ... 7 + }: 8 + let 9 + hosts = lib.attrValues config.den.hosts; 10 + 11 + mkSystem = 12 + class: if class == "darwin" then inputs.darwin.lib.darwinSystem else inputs.nixpkgs.lib.nixosSystem; 13 + 14 + osConfiguration = host: { 15 + name = host.name; 16 + value = (mkSystem host.class) { 17 + system = host.system; 18 + modules = [ inputs.self.modules.${host.class}.${host.aspect} ]; 19 + }; 20 + }; 21 + 22 + osConfigurations = 23 + class: lib.listToAttrs (lib.map osConfiguration (lib.filter (x: x.class == class) hosts)); 24 + 25 + flake.nixosConfigurations = osConfigurations "nixos"; 26 + flake.darwinConfigurations = osConfigurations "darwin"; 27 + in 28 + { 29 + inherit flake; 30 + }
+72
nix/types.nix
··· 1 + lib: 2 + let 3 + hostsOption = lib.mkOption { 4 + description = documentation; 5 + default = { }; 6 + type = lib.types.lazyAttrsOf hostType; 7 + }; 8 + 9 + documentation = '' 10 + Definitions of hosts with their users. 11 + 12 + The following are all `den` conventions and are not mandated by the Dendritic pattern. 13 + 14 + Each host has a single dendritic entry module: `flake.modules.<class>.<aspect>`. 15 + 16 + <class> is something like `nixos` or `darwin`, `systemManager`, or any other OS nix class. 17 + 18 + By default, <class> is auto-detected from <system>, if it has suffix "darwin" then "darwin" else "nixos". 19 + By default, aspect is <hostName>. Can be set to any value explicitly. 20 + 21 + Each user also has single dendritic entry module: `flake.modules.<class>.<aspect>`. 22 + By default, <class> is `homeManager` but can also be `hjem` or any other home management nix class. 23 + By default, the aspect is "<userName>". Can be set to any value explicitly. 24 + 25 + These `aspect` names have no special meaning for the Dendritic pattern and can have any custom 26 + arbitrary value. 27 + ''; 28 + 29 + hostType = lib.types.submodule ( 30 + { name, config, ... }: 31 + { 32 + options = { 33 + name = strOpt "host configuration name" name; 34 + hostName = strOpt "Network hostname" name; 35 + system = strOpt "platform system" null; 36 + class = strOpt "os-configuration nix class for host" ( 37 + if lib.hasSuffix "darwin" config.system then "darwin" else "nixos" 38 + ); 39 + aspect = strOpt "main aspect name of <class>" config.hostName; 40 + description = strOpt "host description" "${config.class}.${config.hostName}@${config.system}"; 41 + users = lib.mkOption { 42 + description = "user accounts"; 43 + default = { }; 44 + type = lib.types.lazyAttrsOf userType; 45 + }; 46 + }; 47 + } 48 + ); 49 + 50 + userType = lib.types.submodule ( 51 + { name, ... }: 52 + { 53 + options = { 54 + name = strOpt "user configuration name" name; 55 + userName = strOpt "user account name" name; 56 + class = strOpt "home management nix class" "homeManager"; 57 + aspect = strOpt "main aspect name" name; 58 + }; 59 + } 60 + ); 61 + 62 + strOpt = 63 + description: default: 64 + lib.mkOption { 65 + type = lib.types.str; 66 + inherit description default; 67 + }; 68 + 69 + in 70 + { 71 + inherit hostsOption; 72 + }
+1
templates/.gitignore
··· 1 + ./*/flake.lock
+1
templates/default/.gitignore
··· 1 + *.qcow2
+210
templates/default/flake.lock
··· 1 + { 2 + "nodes": { 3 + "den": { 4 + "locked": { 5 + "path": "../..", 6 + "type": "path" 7 + }, 8 + "original": { 9 + "path": "../..", 10 + "type": "path" 11 + }, 12 + "parent": [] 13 + }, 14 + "flake-aspects": { 15 + "locked": { 16 + "lastModified": 1761183202, 17 + "narHash": "sha256-Cwd3lZ5Y4fOji4w4akhjmPa4U99pobh+AVxWRKrsbvw=", 18 + "owner": "vic", 19 + "repo": "flake-aspects", 20 + "rev": "8106815b82f92139ef65e51f478e0622659e6b77", 21 + "type": "github" 22 + }, 23 + "original": { 24 + "owner": "vic", 25 + "repo": "flake-aspects", 26 + "type": "github" 27 + } 28 + }, 29 + "flake-file": { 30 + "locked": { 31 + "lastModified": 1761001623, 32 + "narHash": "sha256-HpDrrMY2CMzHy8xX3Flxo4P1Mj92teEa0FjGEN2xI3s=", 33 + "owner": "vic", 34 + "repo": "flake-file", 35 + "rev": "53a9c4bb40fcc8c834136a393fbbee0083f9c7a7", 36 + "type": "github" 37 + }, 38 + "original": { 39 + "owner": "vic", 40 + "repo": "flake-file", 41 + "type": "github" 42 + } 43 + }, 44 + "flake-parts": { 45 + "inputs": { 46 + "nixpkgs-lib": "nixpkgs-lib" 47 + }, 48 + "locked": { 49 + "lastModified": 1760948891, 50 + "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", 51 + "owner": "hercules-ci", 52 + "repo": "flake-parts", 53 + "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", 54 + "type": "github" 55 + }, 56 + "original": { 57 + "owner": "hercules-ci", 58 + "repo": "flake-parts", 59 + "type": "github" 60 + } 61 + }, 62 + "import-tree": { 63 + "locked": { 64 + "lastModified": 1761120675, 65 + "narHash": "sha256-TEbh9zISiQcU82VwVoEbmXHnSGlUxTwvjJA9g9ErSDA=", 66 + "owner": "vic", 67 + "repo": "import-tree", 68 + "rev": "a037ed2a58fc0ebed9e93b9ef79b0646e648f719", 69 + "type": "github" 70 + }, 71 + "original": { 72 + "owner": "vic", 73 + "repo": "import-tree", 74 + "type": "github" 75 + } 76 + }, 77 + "nix-auto-follow": { 78 + "inputs": { 79 + "nixpkgs": "nixpkgs" 80 + }, 81 + "locked": { 82 + "lastModified": 1754073254, 83 + "narHash": "sha256-CQp/v2HQ7AtGJQqFGRZLHt4MZAK3NF94I6GDaRyhbsc=", 84 + "owner": "fzakaria", 85 + "repo": "nix-auto-follow", 86 + "rev": "5baa00b79d4cc46523da0b8b3532c5163d151be4", 87 + "type": "github" 88 + }, 89 + "original": { 90 + "owner": "fzakaria", 91 + "repo": "nix-auto-follow", 92 + "type": "github" 93 + } 94 + }, 95 + "nixpkgs": { 96 + "locked": { 97 + "lastModified": 1751943650, 98 + "narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=", 99 + "owner": "NixOS", 100 + "repo": "nixpkgs", 101 + "rev": "88983d4b665fb491861005137ce2b11a9f89f203", 102 + "type": "github" 103 + }, 104 + "original": { 105 + "owner": "NixOS", 106 + "ref": "nixos-25.05", 107 + "repo": "nixpkgs", 108 + "type": "github" 109 + } 110 + }, 111 + "nixpkgs-lib": { 112 + "locked": { 113 + "lastModified": 1754788789, 114 + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", 115 + "owner": "nix-community", 116 + "repo": "nixpkgs.lib", 117 + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", 118 + "type": "github" 119 + }, 120 + "original": { 121 + "owner": "nix-community", 122 + "repo": "nixpkgs.lib", 123 + "type": "github" 124 + } 125 + }, 126 + "nixpkgs_2": { 127 + "locked": { 128 + "lastModified": 1760965567, 129 + "narHash": "sha256-0JDOal5P7xzzAibvD0yTE3ptyvoVOAL0rcELmDdtSKg=", 130 + "owner": "nixos", 131 + "repo": "nixpkgs", 132 + "rev": "cb82756ecc37fa623f8cf3e88854f9bf7f64af93", 133 + "type": "github" 134 + }, 135 + "original": { 136 + "owner": "nixos", 137 + "ref": "nixpkgs-unstable", 138 + "repo": "nixpkgs", 139 + "type": "github" 140 + } 141 + }, 142 + "nixpkgs_3": { 143 + "locked": { 144 + "lastModified": 1760596604, 145 + "narHash": "sha256-J/i5K6AAz/y5dBePHQOuzC7MbhyTOKsd/GLezSbEFiM=", 146 + "owner": "nixos", 147 + "repo": "nixpkgs", 148 + "rev": "3cbe716e2346710d6e1f7c559363d14e11c32a43", 149 + "type": "github" 150 + }, 151 + "original": { 152 + "owner": "nixos", 153 + "ref": "nixpkgs-unstable", 154 + "repo": "nixpkgs", 155 + "type": "github" 156 + } 157 + }, 158 + "root": { 159 + "inputs": { 160 + "den": "den", 161 + "flake-aspects": "flake-aspects", 162 + "flake-file": "flake-file", 163 + "flake-parts": "flake-parts", 164 + "import-tree": "import-tree", 165 + "nix-auto-follow": "nix-auto-follow", 166 + "nixpkgs": "nixpkgs_2", 167 + "nixpkgs-lib": [ 168 + "nixpkgs" 169 + ], 170 + "systems": "systems", 171 + "treefmt-nix": "treefmt-nix" 172 + } 173 + }, 174 + "systems": { 175 + "locked": { 176 + "lastModified": 1681028828, 177 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 178 + "owner": "nix-systems", 179 + "repo": "default", 180 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 181 + "type": "github" 182 + }, 183 + "original": { 184 + "owner": "nix-systems", 185 + "repo": "default", 186 + "type": "github" 187 + } 188 + }, 189 + "treefmt-nix": { 190 + "inputs": { 191 + "nixpkgs": "nixpkgs_3" 192 + }, 193 + "locked": { 194 + "lastModified": 1760945191, 195 + "narHash": "sha256-ZRVs8UqikBa4Ki3X4KCnMBtBW0ux1DaT35tgsnB1jM4=", 196 + "owner": "numtide", 197 + "repo": "treefmt-nix", 198 + "rev": "f56b1934f5f8fcab8deb5d38d42fd692632b47c2", 199 + "type": "github" 200 + }, 201 + "original": { 202 + "owner": "numtide", 203 + "repo": "treefmt-nix", 204 + "type": "github" 205 + } 206 + } 207 + }, 208 + "root": "root", 209 + "version": 7 210 + }
+40
templates/default/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 + { 4 + 5 + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 6 + 7 + inputs = { 8 + den = { 9 + url = "path:../.."; 10 + }; 11 + flake-aspects = { 12 + url = "github:vic/flake-aspects"; 13 + }; 14 + flake-file = { 15 + url = "github:vic/flake-file"; 16 + }; 17 + flake-parts = { 18 + url = "github:hercules-ci/flake-parts"; 19 + }; 20 + import-tree = { 21 + url = "github:vic/import-tree"; 22 + }; 23 + nix-auto-follow = { 24 + url = "github:fzakaria/nix-auto-follow"; 25 + }; 26 + nixpkgs = { 27 + url = "github:nixos/nixpkgs/nixpkgs-unstable"; 28 + }; 29 + nixpkgs-lib = { 30 + follows = "nixpkgs"; 31 + }; 32 + systems = { 33 + url = "github:nix-systems/default"; 34 + }; 35 + treefmt-nix = { 36 + url = "github:numtide/treefmt-nix"; 37 + }; 38 + }; 39 + 40 + }
+36
templates/default/modules/_example/aspects.nix
··· 1 + # example aspect dependencies for our hosts 2 + # Feel free to remove it, adapt or split into modules. 3 + { ... }: 4 + { 5 + flake.aspects = 6 + { aspects, ... }: 7 + { 8 + # hosts 9 + rockhopper.includes = [ aspects.example.provides.host ]; 10 + 11 + # users 12 + alice.includes = [ 13 + (aspects.example.provides.user "alice" "password") 14 + ]; 15 + 16 + # aspects for demo purposes only. 17 + example.provides = 18 + { ... }: 19 + { 20 + user = userName: insecurePassword: _: { 21 + nixos.users.users.${userName} = { 22 + password = insecurePassword; 23 + isNormalUser = true; 24 + extraGroups = [ "wheel" ]; 25 + }; 26 + }; 27 + host = _: { 28 + nixos = 29 + { modulesPath, ... }: 30 + { 31 + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; 32 + }; 33 + }; 34 + }; 35 + }; 36 + }
+9
templates/default/modules/_example/hosts.nix
··· 1 + # This is a fully working example configuration. 2 + # Feel free to remove it, adapt or split into several modules. 3 + # See documentation at <den>/nix/types.nix 4 + { 5 + den.hosts.rockhopper = { 6 + system = "x86_64-linux"; 7 + users.alice = { }; 8 + }; 9 + }
+16
templates/default/modules/_example/vm.nix
··· 1 + { inputs, ... }: 2 + { 3 + perSystem = 4 + { pkgs, ... }: 5 + { 6 + 7 + # Use `nix run .` to run the rockhopper vm. 8 + packages.default = pkgs.writeShellApplication { 9 + name = "vm"; 10 + text = '' 11 + ${inputs.self.nixosConfigurations.rockhopper.config.system.build.vm}/bin/run-nixos-vm "$@" 12 + ''; 13 + }; 14 + 15 + }; 16 + }
+13
templates/default/modules/den.nix
··· 1 + { inputs, lib, ... }: 2 + { 3 + flake-file.inputs.den.url = 4 + if lib.hasInfix "templates/default" (builtins.toString ./.) then "path:../.." else "github:vic/den"; 5 + 6 + imports = [ 7 + inputs.den.flakeModule 8 + 9 + # USER TODO: remove this import-tree 10 + # copy any desired module to your ./modules and let it be auto-imported. 11 + (inputs.import-tree ./_example) 12 + ]; 13 + }
+7
templates/default/modules/dendritic.nix
··· 1 + { inputs, lib, ... }: 2 + { 3 + flake-file.inputs.flake-file.url = lib.mkDefault "github:vic/flake-file"; 4 + imports = [ 5 + inputs.flake-file.flakeModules.dendritic 6 + ]; 7 + }