Generate flake.nix from module options. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic nix inputs

npins support (#63)

authored by oeiuwq.com and committed by

GitHub 2af65923 619d2212

+638 -27
+14
.github/workflows/flake-check.yaml
··· 46 46 nix flake metadata 47 47 nix run .#write-flake -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" 48 48 nix flake check -L --show-trace --override-input flake-file "github:$GITHUB_REPOSITORY/$GITHUB_SHA" 49 + npins: 50 + name: Check npins 51 + runs-on: ubuntu-latest 52 + steps: 53 + - uses: actions/checkout@v4 54 + - uses: wimpysworld/nothing-but-nix@main 55 + - uses: cachix/install-nix-action@v31 56 + - uses: DeterminateSystems/magic-nix-cache-action@main 57 + - run: | 58 + set -e -o pipefail 59 + cd templates/npins 60 + sed -i 's/# flake-file = import/flake-file = import/' default.nix 61 + echo "{ inputs, ... }: { npins.pkgs = import inputs.nixpkgs {}; }" | tee modules/pkgs.nix 62 + nix-shell . -A npins.env --run write-npins 49 63 unflake: 50 64 name: Check unflake 51 65 runs-on: ubuntu-latest
+15 -2
README.md
··· 18 18 It makes your flake configuration modular and based on the Nix module system. This means you can use 19 19 `lib.mkDefault` or anything you normally do with Nix modules, and have them reflected in flake schema values. 20 20 21 - > Despite the original flake-oriented name, it NOW also works on _stable Nix_, [_non flakes_](templates/unflake) environments. 21 + > Despite the original flake-oriented name, it NOW also works on _stable Nix_, non-flakes environments via [npins](templates/npins) or [unflake](templates/unflake). 22 22 23 23 <table><tr><td> 24 24 ··· 34 34 - Incrementally add [flake-parts-builder](#parts_templates) templates. 35 35 - Pick flakeModules for different feature sets. 36 36 - [Dendritic](https://vic.github.io/dendrix/Dendritic.html) flake template. 37 - - Works on stable Nix, [unflake](templates/unflake) environments. 37 + - Works on stable Nix, [npins](templates/npins) and [unflake](templates/unflake) environments. 38 38 39 39 </td><td> 40 40 ··· 151 151 152 152 > Previously, this module included `flake-aspects` and `den` as dependencies. It now provides a pure flake-parts Dendritic setup. If you need the complete [den](https://github.com/vic/den) functionality, use den's `flakeModules.dendritic` instead. 153 153 154 + #### [`flakeModules.npins`](https://github.com/vic/flake-file/tree/main/modules/npins.nix) 155 + 156 + - Defines `flake-file` options for [npins](https://github.com/andir/npins)-based dependency pinning. 157 + - Exposes `write-npins` to generate/update the `npins/` directory from declared inputs. 158 + - Supports `github`, `gitlab`, `channel`, `tarball`, and `git` URL schemes. 159 + - Respects `follows` for transitive dependency deduplication. 160 + - Prunes stale pins automatically. 161 + - See [templates/npins](templates/npins) for usage. 162 + 154 163 #### [`flakeModules.unflake`](https://github.com/vic/flake-file/tree/main/modules/unflake.nix) 155 164 156 165 - Defines `flake-file` options. ··· 192 201 #### [`parts`](templates/parts) template 193 202 194 203 A template that uses `lib.flakeModules.flake-parts-builder`. 204 + 205 + #### [`npins`](templates/npins) template 206 + 207 + Uses [npins](https://github.com/andir/npins) to pin and fetch inputs defined as options for non-flakes stable Nix environments. Supports channels, GitHub, GitLab, tarballs, and git repos. Recommended for new non-flake projects. 195 208 196 209 #### [`unflake`](templates/unflake) template 197 210
+1
dev/modules/formatter.nix
··· 33 33 "*/.gitignore" 34 34 "**/unflake.nix" # generated by: nix-shell . -A unflake.env --run write-unflake 35 35 "**/inputs.nix" # generated by: nix-shell . -A unflake.env --run write-inputs 36 + "**/npins/default.nix" # generated by write-npins 36 37 ]; 37 38 }; 38 39 };
+11
modules/default.nix
··· 6 6 nix-auto-follow 7 7 dendritic 8 8 import-tree 9 + npins 9 10 unflake 10 11 ; 11 12 }; 13 + 14 + npins.imports = [ 15 + ./options 16 + ./npins.nix 17 + ]; 12 18 13 19 unflake.imports = [ 14 20 ./options ··· 40 46 templates.default = { 41 47 description = "default template"; 42 48 path = ./../templates/default; 49 + }; 50 + 51 + templates.npins = { 52 + description = "npins template"; 53 + path = ./../templates/npins; 43 54 }; 44 55 45 56 templates.unflake = {
+173
modules/npins.nix
··· 1 + { lib, config, ... }: 2 + let 3 + inherit (config.npins) pkgs; 4 + 5 + parseFlakeUrl = 6 + url: 7 + let 8 + parts = lib.splitString ":" url; 9 + scheme = lib.head parts; 10 + rest = lib.concatStringsSep ":" (lib.tail parts); 11 + in 12 + if scheme == "github" then 13 + parseGithub rest 14 + else if scheme == "gitlab" then 15 + parseGitlab rest 16 + else if isChannelUrl url then 17 + parseChannel url 18 + else if lib.hasPrefix "https://" url || lib.hasPrefix "http://" url then 19 + { 20 + type = "tarball"; 21 + inherit url; 22 + } 23 + else 24 + { 25 + type = "git"; 26 + inherit url; 27 + }; 28 + 29 + parseGithub = 30 + rest: 31 + let 32 + segments = lib.splitString "/" rest; 33 + owner = lib.elemAt segments 0; 34 + repo = lib.elemAt segments 1; 35 + ref = if lib.length segments > 2 then lib.elemAt segments 2 else null; 36 + in 37 + { 38 + type = "github"; 39 + inherit owner repo ref; 40 + }; 41 + 42 + parseGitlab = 43 + rest: 44 + let 45 + segments = lib.splitString "/" rest; 46 + owner = lib.elemAt segments 0; 47 + repo = lib.elemAt segments 1; 48 + ref = if lib.length segments > 2 then lib.elemAt segments 2 else null; 49 + in 50 + { 51 + type = "gitlab"; 52 + inherit owner repo ref; 53 + }; 54 + 55 + isChannelUrl = 56 + url: 57 + lib.hasPrefix "https://channels.nixos.org/" url || lib.hasPrefix "https://releases.nixos.org/" url; 58 + 59 + parseChannel = 60 + url: 61 + let 62 + path = lib.removePrefix "https://channels.nixos.org/" url; 63 + channel = lib.head (lib.splitString "/" path); 64 + in 65 + { 66 + type = "channel"; 67 + inherit channel; 68 + }; 69 + 70 + branchFlag = 71 + parsed: 72 + if parsed ? ref && parsed.ref != null then " -b ${lib.escapeShellArg parsed.ref}" else " -b main"; 73 + 74 + esc = lib.escapeShellArg; 75 + 76 + npinsAddCmd = 77 + name: parsed: 78 + if parsed.type == "github" then 79 + "npins add github --name ${esc name}${branchFlag parsed} ${esc parsed.owner} ${esc parsed.repo}" 80 + else if parsed.type == "gitlab" then 81 + "npins add gitlab --name ${esc name}${branchFlag parsed} ${esc parsed.owner} ${esc parsed.repo}" 82 + else if parsed.type == "channel" then 83 + "npins add channel --name ${esc name} ${esc parsed.channel}" 84 + else if parsed.type == "tarball" then 85 + "npins add tarball --name ${esc name} ${esc parsed.url}" 86 + else 87 + "npins add git --name ${esc name} ${esc parsed.url}"; 88 + 89 + hasFollows = sub: sub ? follows && sub.follows != null; 90 + 91 + transitiveInputs = 92 + name: input: 93 + let 94 + subs = input.inputs or { }; 95 + nonFollowed = lib.filterAttrs (_: sub: !(hasFollows sub)) subs; 96 + in 97 + lib.mapAttrs' (sub: _: lib.nameValuePair "${name}/${sub}" sub) nonFollowed; 98 + 99 + collectTransitive = lib.foldlAttrs ( 100 + acc: name: input: 101 + acc // (transitiveInputs name input) 102 + ) { }; 103 + 104 + pinnableInputs = lib.filterAttrs (_: v: v.url or "" != "") config.flake-file.inputs; 105 + 106 + allTransitive = collectTransitive config.flake-file.inputs; 107 + 108 + pinnableTransitive = lib.filterAttrs (_: v: v.url or "" != "") allTransitive; 109 + 110 + allPins = pinnableInputs // pinnableTransitive; 111 + 112 + addIfMissing = 113 + name: input: 114 + let 115 + cmd = npinsAddCmd name (parseFlakeUrl (input.url or "")); 116 + in 117 + '' 118 + if ! jq -e --arg n ${esc name} '.pins | has($n)' npins/sources.json >/dev/null 2>&1; then 119 + ${cmd} 120 + fi 121 + ''; 122 + 123 + addCommands = lib.concatStringsSep "\n" (lib.mapAttrsToList addIfMissing allPins); 124 + 125 + pinNames = lib.concatStringsSep " " (lib.attrNames allPins); 126 + 127 + write-npins = pkgs.writeShellApplication { 128 + name = "write-npins"; 129 + runtimeInputs = [ 130 + pkgs.npins 131 + pkgs.jq 132 + ]; 133 + text = '' 134 + npins init --bare 2>/dev/null || true 135 + ${addCommands} 136 + wanted="${pinNames}" 137 + if [ -f npins/sources.json ]; then 138 + for existing in $(jq -r '.pins | keys[]' npins/sources.json); do 139 + keep=false 140 + for w in $wanted; do 141 + if [ "$existing" = "$w" ]; then keep=true; break; fi 142 + done 143 + if [ "$keep" = false ]; then 144 + npins remove "$existing" 145 + fi 146 + done 147 + fi 148 + ''; 149 + }; 150 + 151 + env = pkgs.mkShell { 152 + buildInputs = [ 153 + pkgs.npins 154 + write-npins 155 + ]; 156 + }; 157 + in 158 + { 159 + options.npins = { 160 + pkgs = lib.mkOption { 161 + type = lib.types.raw; 162 + description = "nixpkgs instance for npins generator"; 163 + default = import <nixpkgs> { }; 164 + }; 165 + 166 + env = lib.mkOption { 167 + type = lib.types.raw; 168 + readOnly = true; 169 + internal = true; 170 + default = env; 171 + }; 172 + }; 173 + }
templates/npins/.gitignore

This is a binary file and will not be displayed.

+18
templates/npins/README.md
··· 1 + # npins 2 + 3 + This template is an example of using `flake-file.inputs` in a non-flakes 4 + project with [npins](https://github.com/andir/npins). 5 + 6 + It uses npins to pin and fetch inputs defined as options inside `./modules`. 7 + 8 + ## Update npins 9 + 10 + Update the `npins/` directory from your declared inputs: 11 + 12 + ```shell 13 + nix-shell . -A npins.env --run write-npins 14 + ``` 15 + 16 + This will run `npins add` for 17 + each input declared in your modules, using the correct npins subcommand 18 + (`github`, `tarball`, `git`, etc.) based on the input URL scheme.
+26
templates/npins/default.nix
··· 1 + let 2 + outputs = 3 + inputs: 4 + let 5 + nixpkgs = inputs.nixpkgs or (import <nixpkgs> { }); 6 + import-tree = inputs.import-tree or (import <import-tree>); 7 + in 8 + (nixpkgs.lib.evalModules { 9 + modules = [ (import-tree ./modules) ]; 10 + specialArgs = { 11 + inherit inputs; 12 + self = inputs.self or { }; 13 + }; 14 + }).config; 15 + 16 + withInputs = 17 + inputs: outputs: 18 + outputs ( 19 + inputs 20 + // { 21 + # uncomment on CI for local checkout 22 + # flake-file = import ./../../modules; 23 + } 24 + ); 25 + in 26 + import ./with-inputs.nix withInputs outputs
+10
templates/npins/modules/default.nix
··· 1 + { inputs, ... }: 2 + { 3 + imports = [ inputs.flake-file.flakeModules.npins ]; 4 + 5 + flake-file.inputs = { 6 + flake-file.url = "github:vic/flake-file"; 7 + import-tree.url = "github:vic/import-tree"; 8 + nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 9 + }; 10 + }
+249
templates/npins/npins/default.nix
··· 1 + /* 2 + This file is provided under the MIT licence: 3 + 4 + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 + 6 + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 + 8 + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 + */ 10 + # Generated by npins. Do not modify; will be overwritten regularly 11 + let 12 + # Backwards-compatibly make something that previously didn't take any arguments take some 13 + # The function must return an attrset, and will unfortunately be eagerly evaluated 14 + # Same thing, but it catches eval errors on the default argument so that one may still call it with other arguments 15 + mkFunctor = 16 + fn: 17 + let 18 + e = builtins.tryEval (fn { }); 19 + in 20 + (if e.success then e.value else { error = fn { }; }) // { __functor = _self: fn; }; 21 + 22 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 23 + range = 24 + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); 25 + 26 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 27 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); 28 + 29 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 30 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); 31 + concatStrings = builtins.concatStringsSep ""; 32 + 33 + # If the environment variable NPINS_OVERRIDE_${name} is set, then use 34 + # the path directly as opposed to the fetched source. 35 + # (Taken from Niv for compatibility) 36 + mayOverride = 37 + name: path: 38 + let 39 + envVarName = "NPINS_OVERRIDE_${saneName}"; 40 + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; 41 + ersatz = builtins.getEnv envVarName; 42 + in 43 + if ersatz == "" then 44 + path 45 + else 46 + # this turns the string into an actual Nix path (for both absolute and 47 + # relative paths) 48 + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( 49 + if builtins.substring 0 1 ersatz == "/" then 50 + /. + ersatz 51 + else 52 + /. + builtins.getEnv "PWD" + "/${ersatz}" 53 + ); 54 + 55 + mkSource = 56 + name: spec: 57 + { 58 + pkgs ? null, 59 + }: 60 + assert spec ? type; 61 + let 62 + # Unify across builtin and pkgs fetchers. 63 + # `fetchGit` requires a wrapper because of slight API differences. 64 + fetchers = 65 + if pkgs == null then 66 + { 67 + inherit (builtins) fetchTarball fetchurl; 68 + # For some fucking reason, fetchGit has a different signature than the other builtin fetchers … 69 + fetchGit = args: (builtins.fetchGit args).outPath; 70 + } 71 + else 72 + { 73 + fetchTarball = 74 + { 75 + url, 76 + sha256, 77 + }: 78 + pkgs.fetchzip { 79 + inherit url sha256; 80 + extension = "tar"; 81 + }; 82 + inherit (pkgs) fetchurl; 83 + fetchGit = 84 + { 85 + url, 86 + submodules, 87 + rev, 88 + name, 89 + narHash, 90 + }: 91 + pkgs.fetchgit { 92 + inherit url rev name; 93 + fetchSubmodules = submodules; 94 + hash = narHash; 95 + }; 96 + }; 97 + 98 + # Dispatch to the correct code path based on the type 99 + path = 100 + if spec.type == "Git" then 101 + mkGitSource fetchers spec 102 + else if spec.type == "GitRelease" then 103 + mkGitSource fetchers spec 104 + else if spec.type == "PyPi" then 105 + mkPyPiSource fetchers spec 106 + else if spec.type == "Channel" then 107 + mkChannelSource fetchers spec 108 + else if spec.type == "Tarball" then 109 + mkTarballSource fetchers spec 110 + else if spec.type == "Container" then 111 + mkContainerSource pkgs spec 112 + else 113 + builtins.throw "Unknown source type ${spec.type}"; 114 + in 115 + spec // { outPath = mayOverride name path; }; 116 + 117 + mkGitSource = 118 + { 119 + fetchTarball, 120 + fetchGit, 121 + ... 122 + }: 123 + { 124 + repository, 125 + revision, 126 + url ? null, 127 + submodules, 128 + hash, 129 + ... 130 + }: 131 + assert repository ? type; 132 + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository 133 + # In the latter case, there we will always be an url to the tarball 134 + if url != null && !submodules then 135 + fetchTarball { 136 + inherit url; 137 + sha256 = hash; 138 + } 139 + else 140 + let 141 + url = 142 + if repository.type == "Git" then 143 + repository.url 144 + else if repository.type == "GitHub" then 145 + "https://github.com/${repository.owner}/${repository.repo}.git" 146 + else if repository.type == "GitLab" then 147 + "${repository.server}/${repository.repo_path}.git" 148 + else if repository.type == "Forgejo" then 149 + "${repository.server}/${repository.owner}/${repository.repo}.git" 150 + else 151 + throw "Unrecognized repository type ${repository.type}"; 152 + urlToName = 153 + url: rev: 154 + let 155 + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; 156 + 157 + short = builtins.substring 0 7 rev; 158 + 159 + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; 160 + in 161 + "${if matched == null then "source" else builtins.head matched}${appendShort}"; 162 + name = urlToName url revision; 163 + in 164 + fetchGit { 165 + rev = revision; 166 + narHash = hash; 167 + 168 + inherit name submodules url; 169 + }; 170 + 171 + mkPyPiSource = 172 + { fetchurl, ... }: 173 + { 174 + url, 175 + hash, 176 + ... 177 + }: 178 + fetchurl { 179 + inherit url; 180 + sha256 = hash; 181 + }; 182 + 183 + mkChannelSource = 184 + { fetchTarball, ... }: 185 + { 186 + url, 187 + hash, 188 + ... 189 + }: 190 + fetchTarball { 191 + inherit url; 192 + sha256 = hash; 193 + }; 194 + 195 + mkTarballSource = 196 + { fetchTarball, ... }: 197 + { 198 + url, 199 + locked_url ? url, 200 + hash, 201 + ... 202 + }: 203 + fetchTarball { 204 + url = locked_url; 205 + sha256 = hash; 206 + }; 207 + 208 + mkContainerSource = 209 + pkgs: 210 + { 211 + image_name, 212 + image_tag, 213 + image_digest, 214 + ... 215 + }: 216 + if pkgs == null then 217 + builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers" 218 + else 219 + pkgs.dockerTools.pullImage { 220 + imageName = image_name; 221 + imageDigest = image_digest; 222 + finalImageTag = image_tag; 223 + }; 224 + in 225 + mkFunctor ( 226 + { 227 + input ? ./sources.json, 228 + }: 229 + let 230 + data = 231 + if builtins.isPath input then 232 + # while `readFile` will throw an error anyways if the path doesn't exist, 233 + # we still need to check beforehand because *our* error can be caught but not the one from the builtin 234 + # *piegames sighs* 235 + if builtins.pathExists input then 236 + builtins.fromJSON (builtins.readFile input) 237 + else 238 + throw "Input path ${toString input} does not exist" 239 + else if builtins.isAttrs input then 240 + input 241 + else 242 + throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset"; 243 + version = data.version; 244 + in 245 + if version == 7 then 246 + builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins 247 + else 248 + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" 249 + )
+36
templates/npins/npins/sources.json
··· 1 + { 2 + "pins": { 3 + "flake-file": { 4 + "type": "Git", 5 + "repository": { 6 + "type": "GitHub", 7 + "owner": "vic", 8 + "repo": "flake-file" 9 + }, 10 + "branch": "main", 11 + "submodules": false, 12 + "revision": "619d2212482c104fd3bbc815d80c6227b1b01338", 13 + "url": "https://github.com/vic/flake-file/archive/619d2212482c104fd3bbc815d80c6227b1b01338.tar.gz", 14 + "hash": "sha256-SQhPQRbs35fQ8ZE7tbfHsf2eu5r+oICyZL1SpGIPvGg=" 15 + }, 16 + "import-tree": { 17 + "type": "Git", 18 + "repository": { 19 + "type": "GitHub", 20 + "owner": "vic", 21 + "repo": "import-tree" 22 + }, 23 + "branch": "main", 24 + "submodules": false, 25 + "revision": "c968d3b54d12cf5d9c13f16f7c545a06c9d1fde6", 26 + "url": "https://github.com/vic/import-tree/archive/c968d3b54d12cf5d9c13f16f7c545a06c9d1fde6.tar.gz", 27 + "hash": "sha256-oYO4poyw0Sb/db2PigqugMlDwsvwLg6CSpFrMUWxA3Q=" 28 + }, 29 + "nixpkgs": { 30 + "type": "Tarball", 31 + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz", 32 + "hash": "sha256-5xZ8rQTzV4cSAPMvIZpVpF05p5iwUnEuONeelwseA4g=" 33 + } 34 + }, 35 + "version": 7 36 + }
+40
templates/npins/with-inputs.nix
··· 1 + let 2 + hasSources = builtins.pathExists ./npins; 3 + sources = if hasSources then import ./npins else { }; 4 + selfInputs = builtins.mapAttrs (name: value: mkInputs name value) sources; 5 + # from Nixlock: https://codeberg.org/FrdrCkII/nixlock/src/branch/main/default.nix 6 + mkInputs = 7 + name: sourceInfo: 8 + let 9 + flakePath = sourceInfo.outPath + "/flake.nix"; 10 + isFlake = sources.${name}.flake or true; 11 + in 12 + if isFlake && builtins.pathExists flakePath then 13 + let 14 + flake = import (sourceInfo.outPath + "/flake.nix"); 15 + inputs = builtins.mapAttrs (name: _value: selfInputs.${name}) (flake.inputs or { }); 16 + outputs = flake.outputs (inputs // { inherit self; }); 17 + self = 18 + sourceInfo 19 + // outputs 20 + // { 21 + _type = "flake"; 22 + inherit inputs outputs sourceInfo; 23 + }; 24 + in 25 + self 26 + else 27 + sourceInfo 28 + // { 29 + inherit sourceInfo; 30 + }; 31 + in 32 + selfInputs 33 + // { 34 + __functor = 35 + selfInputs: outputs: 36 + let 37 + self = outputs (selfInputs // { inherit self; }); 38 + in 39 + self; 40 + }
+45 -25
templates/unflake/unflake.nix
··· 20 20 unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz = builtins.fetchTree { 21 21 type = "tarball"; 22 22 url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 23 - lastModified = 1771423170; 24 - narHash = "sha256-V/p5M4cAMbu/MJBDn5YABy5QJgCFpsgrnXVVc2Uo5+k="; 23 + lastModified = 1771482645; 24 + narHash = "sha256-5xZ8rQTzV4cSAPMvIZpVpF05p5iwUnEuONeelwseA4g="; 25 25 }; 26 26 }; 27 27 universe = rec { 28 - unflake_github_vic_flake-file = ((import "${deps.unflake_github_vic_flake-file.outPath}/flake.nix").outputs { 29 - self = unflake_github_vic_flake-file; 30 - }) // deps.unflake_github_vic_flake-file // { 31 - _flake = true; 32 - outPath = "${deps.unflake_github_vic_flake-file.outPath}"; 33 - sourceInfo = deps.unflake_github_vic_flake-file; 34 - }; 35 - unflake_github_vic_import-tree = ((import "${deps.unflake_github_vic_import-tree.outPath}/flake.nix").outputs { 36 - self = unflake_github_vic_import-tree; 37 - }) // deps.unflake_github_vic_import-tree // { 38 - _flake = true; 39 - outPath = "${deps.unflake_github_vic_import-tree.outPath}"; 40 - sourceInfo = deps.unflake_github_vic_import-tree; 41 - }; 42 - unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz = ((import "${deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz.outPath}/flake.nix").outputs { 43 - self = unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz; 44 - }) // deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz // { 45 - _flake = true; 46 - outPath = "${deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz.outPath}"; 47 - sourceInfo = deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz; 48 - }; 28 + unflake_github_vic_flake-file = 29 + ((import "${deps.unflake_github_vic_flake-file.outPath}/flake.nix").outputs { 30 + self = unflake_github_vic_flake-file; 31 + }) 32 + // deps.unflake_github_vic_flake-file 33 + // { 34 + _flake = true; 35 + outPath = "${deps.unflake_github_vic_flake-file.outPath}"; 36 + sourceInfo = deps.unflake_github_vic_flake-file; 37 + }; 38 + unflake_github_vic_import-tree = 39 + ((import "${deps.unflake_github_vic_import-tree.outPath}/flake.nix").outputs { 40 + self = unflake_github_vic_import-tree; 41 + }) 42 + // deps.unflake_github_vic_import-tree 43 + // { 44 + _flake = true; 45 + outPath = "${deps.unflake_github_vic_import-tree.outPath}"; 46 + sourceInfo = deps.unflake_github_vic_import-tree; 47 + }; 48 + unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz = 49 + ( 50 + (import "${deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz.outPath}/flake.nix") 51 + .outputs 52 + { 53 + self = unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz; 54 + } 55 + ) 56 + // deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz 57 + // { 58 + _flake = true; 59 + outPath = "${deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz.outPath 60 + }"; 61 + sourceInfo = deps.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz; 62 + }; 49 63 }; 50 64 inputs = { 51 65 flake-file = universe.unflake_github_vic_flake-file; 52 66 import-tree = universe.unflake_github_vic_import-tree; 53 67 nixpkgs = universe.unflake_tarball_https---channels-nixos-org-nixpkgs-unstable-nixexprs-tar-xz; 54 68 self = throw "to use inputs.self, write `import ./unflake.nix (inputs: ...)`"; 55 - withInputs = outputs: let self = outputs (inputs // { inherit self; }); in self; 69 + withInputs = 70 + outputs: 71 + let 72 + self = outputs (inputs // { inherit self; }); 73 + in 74 + self; 56 75 __functor = self: self.withInputs; 57 76 }; 58 - in inputs 77 + in 78 + inputs