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

update checkmate (#108)

authored by oeiuwq.com and committed by

GitHub 7c04e8a8 61ce6a5e

+30 -49
+2 -2
.github/workflows/gh-pages.yml
··· 25 25 - name: Checkout 26 26 uses: actions/checkout@v4 27 27 with: 28 - repository: '${{github.repository}}.wiki' 28 + repository: "${{github.repository}}.wiki" 29 29 - name: Build 30 30 run: mdbook build 31 31 - name: Setup Pages ··· 33 33 - name: Upload artifact 34 34 uses: actions/upload-pages-artifact@v3 35 35 with: 36 - path: './book' 36 + path: "./book" 37 37 - name: Deploy to GitHub Pages 38 38 id: deployment 39 39 uses: actions/deploy-pages@v4
+10 -10
README.md
··· 47 47 48 48 - Concepts [documented](https://vic.github.io/den). 49 49 50 - Need more __batteries__? See [vic/denful](https://github.com/vic/denful). 50 + Need more **batteries**? See [vic/denful](https://github.com/vic/denful). 51 51 52 52 **❄️ Try it now!** 53 53 ··· 130 130 # modules in a single file: 131 131 132 132 # any NixOS configuration 133 - nixos = { 133 + nixos = { 134 134 # A nixos class module, see NixOS options. 135 135 # import third-party NixOS modules 136 - imports = [ 136 + imports = [ 137 137 inputs.disko.nixosModules.disko 138 138 ]; 139 139 disko.devices = { /* ... */ }; 140 140 }; 141 141 # any nix-darwin configuration 142 - darwin = { 142 + darwin = { 143 143 # import third-party Darwin modules 144 - imports = [ 145 - inputs.nix-homebrew.darwinModules.nix-homebrew 144 + imports = [ 145 + inputs.nix-homebrew.darwinModules.nix-homebrew 146 146 ]; 147 147 nix-homebrew.enableRosetta = true; 148 148 }; ··· 160 160 nixos.users.users = { 161 161 vic.description = "oeiuwq"; 162 162 }; 163 - includes = [ 164 - den.aspects.tiling-wm 165 - den._.primary-user 163 + includes = [ 164 + den.aspects.tiling-wm 165 + den._.primary-user 166 166 ]; 167 167 }; 168 168 } ··· 174 174 175 175 You are done! You know everything to start creating configurations with `den`. 176 176 177 - Feel free to to __explore__ the codebase, particularly our [included batteries](modules/aspects/provides) and [tests](templates/examples/modules/_example/ci). 177 + Feel free to to **explore** the codebase, particularly our [included batteries](modules/aspects/provides) and [tests](templates/examples/modules/_example/ci). 178 178 179 179 ## Learn more at our [documentation website](https://vic.github.io/den) 180 180
-13
checkmate.nix
··· 1 - { lib, ... }: 2 - { 3 - imports = 4 - let 5 - files = builtins.readDir ./checkmate/tests; 6 - names = builtins.attrNames files; 7 - nixes = builtins.filter (lib.hasSuffix ".nix") names; 8 - tests = map (file: "${./checkmate/tests}/${file}") nixes; 9 - in 10 - tests; 11 - 12 - perSystem.treefmt.settings.global.excludes = [ ".github/*/*.md" ]; 13 - }
-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 - }
+3
checkmate/modules/formatter.nix
··· 1 + { 2 + perSystem.treefmt.settings.global.excludes = [ ".github/*TEMPLATE*/*" ]; 3 + }
checkmate/tests/aspect-functor.nix checkmate/modules/aspect-functor.nix
checkmate/tests/den-brackets.nix checkmate/modules/den-brackets.nix
checkmate/tests/function_can_take.nix checkmate/modules/function_can_take.nix
+1 -2
modules/aspects/dependencies.nix
··· 1 1 { 2 2 den, 3 - lib, 4 3 ... 5 4 }: 6 5 let ··· 81 80 82 81 hmStandaloneDependencies = 83 82 { HM, home }: 84 - { 83 + den.lib.take.unused home { 85 84 includes = [ 86 85 (owned den.default) 87 86 (statics den.default)
+1 -2
modules/aspects/provides/import-tree.nix
··· 61 61 62 62 den._.import-tree.__functor = 63 63 _: root: 64 - # deadnix: skip 65 64 { class, aspect-chain }: 66 65 let 67 - path = "${toString root}/_${class}"; 66 + path = den.lib.take.unused aspect-chain "${toString root}/_${class}"; 68 67 aspect.${class}.imports = [ (inputs.import-tree path) ]; 69 68 in 70 69 if builtins.pathExists path then aspect else { };
+2 -3
modules/aspects/provides/unfree.nix
··· 1 - { lib, ... }: 1 + { lib, den, ... }: 2 2 { 3 3 den.provides.unfree.description = '' 4 4 A class generic aspect that enables unfree packages by name. ··· 14 14 15 15 den.provides.unfree.__functor = 16 16 _self: allowed-names: 17 - # deadnix: allow 18 17 { class, aspect-chain }: 19 - { 18 + den.lib.take.unused aspect-chain { 20 19 ${class}.nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) allowed-names; 21 20 }; 22 21 }
+5 -3
nix/den-brackets.nix
··· 23 23 aspectsPath = [ 24 24 "den" 25 25 "aspects" 26 - ] ++ path; 26 + ] 27 + ++ path; 27 28 readFromAspects = lib.getAttrFromPath aspectsPath config; 28 29 29 30 headIsDenful = lib.hasAttrByPath [ "ful" head ] config.den; ··· 32 33 "den" 33 34 "ful" 34 35 head 35 - ] ++ denfulTail; 36 + ] 37 + ++ denfulTail; 36 38 readFromDenful = lib.getAttrFromPath denfulPath config; 37 39 38 40 found = ··· 51 53 lib.pipe name [ 52 54 (lib.strings.replaceStrings [ "/" ] [ ".provides." ]) 53 55 (lib.strings.splitString ".") 54 - (findAspect) 56 + findAspect 55 57 ]
+3 -2
templates/default/modules/aspects/alice.nix
··· 8 8 # as part of any aspect-subtree. 9 9 includes = 10 10 let 11 - # deadnix: skip # not required, showcasing angle-brackets syntax. 12 - inherit (den.lib) __findFile; 11 + # hack for nixf linter to keep findFile :/ 12 + unused = den.lib.take.unused __findFile; 13 + __findFile = unused den.lib.__findFile; 13 14 14 15 customEmacs.homeManager = 15 16 { pkgs, ... }:
+1 -2
templates/default/modules/aspects/defaults.nix
··· 37 37 # 38 38 # # Instead try to be explicit if a function is intended for ONLY { host }. 39 39 (den.lib.take.exactly ( 40 - # deadnix: skip 41 40 { OS, host }: 42 - { 41 + den.lib.take.unused OS { 43 42 nixos.networking.hostName = host.hostName; 44 43 } 45 44 ))
+1 -1
templates/default/modules/aspects/eg/routes.nix
··· 13 13 # Be sure to read: https://vic.github.io/den/dependencies.html 14 14 # See usage at: defaults.nix, alice.nix, igloo.nix 15 15 # 16 - { den, eg, ... }: 16 + { den, ... }: 17 17 { 18 18 # Usage: `den.default.includes [ eg.routes ]` 19 19 eg.routes =
+1 -1
templates/default/modules/inputs.nix
··· 7 7 # 8 8 # For our template, we enable home-manager and nix-darwin by default, but 9 9 # you are free to remove them if not being used by you. 10 - { inputs, ... }: 10 + { ... }: 11 11 { 12 12 13 13 flake-file.inputs = {