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

update templates

+64 -41
+1
dev/modules/formatter.nix
··· 36 36 "**/npins/default.nix" # generated by write-npins 37 37 "*.bash" 38 38 "docs/*" 39 + "**/nixlock.lock.nix" # generated by write-nixlock 39 40 ]; 40 41 }; 41 42 };
+2 -2
modules/write-inputs.nix
··· 1 - { lib, config, ... }: 1 + { lib, config, ... }@top: 2 2 let 3 3 inherit (config) flake-file; 4 4 ··· 46 46 pkgs = lib.mkOption { 47 47 type = lib.types.raw; 48 48 description = "nixpkgs instance for unflake generator"; 49 - default = import <nixpkgs> { }; 49 + default = import (top.inputs.nixpkgs or <nixpkgs>) { }; 50 50 }; 51 51 52 52 apps = lib.mkOption {
+11 -15
templates/nixlock/default.nix
··· 1 1 let 2 - outputs = 3 - inputs: 4 - (inputs.nixpkgs.lib.evalModules { 5 - modules = [ (inputs.import-tree ./modules) ]; 6 - specialArgs = { inherit inputs; }; 7 - }).config; 8 - 9 - input-overrides = { 2 + with-inputs = import sources.with-inputs; 3 + locals = { 10 4 # uncomment for local checkout on CI 11 5 # flake-file = import ./../../modules; 12 6 }; 13 7 14 - with-inputs = import (fetchTarball { 15 - url = "https://github.com/vic/with-inputs/archive/f19ccc093928f4987ab56534e0de37b25d8f5817.zip"; 16 - sha256 = "sha256:0bcfic6myy2qmyj40kxpxv04hp925l9b0wkd507v69d070qsg285"; 17 - }); 18 - 19 - nixlock-inputs = builtins.mapAttrs ( 8 + sources = builtins.mapAttrs ( 20 9 _n: v: 21 10 v 22 11 // { ··· 26 15 }; 27 16 } 28 17 ) (import ./nixlock.lock.nix); 18 + 19 + outputs = 20 + inputs: 21 + (inputs.nixpkgs.lib.evalModules { 22 + modules = [ (inputs.import-tree ./modules) ]; 23 + specialArgs = { inherit inputs; }; 24 + }).config; 29 25 in 30 - with-inputs nixlock-inputs input-overrides outputs 26 + with-inputs sources locals outputs
+1
templates/nixlock/modules/default.nix
··· 5 5 flake-file.inputs = { 6 6 flake-file.url = "github:vic/flake-file"; 7 7 import-tree.url = "github:vic/import-tree"; 8 + with-inputs.url = "github:vic/with-inputs"; 8 9 nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 9 10 }; 10 11 }
+17 -5
templates/nixlock/nixlock.lock.nix
··· 1 1 { 2 2 "flake-file" = { 3 3 "lock" = { 4 - "hash" = "sha256-qIpm5BtK3EkqlGXBG0jCZ3sg3gdxyPxI10iubZwMGFk="; 5 - "url" = "https://github.com/vic/flake-file/archive/8a5c8771ac5be1af11192bcd88e6a1cdabd038a5.tar.gz"; 4 + "hash" = "sha256-mVVAJ+QnmA/gbQmbPEi3RFtLJwWCjNslVxv1bhVRB2c="; 5 + "url" = "https://github.com/vic/flake-file/archive/b0477cfb25e745dfd4e10a5a6b81ab4c4ad5c0f8.tar.gz"; 6 6 }; 7 7 "meta" = { 8 8 "ref" = "HEAD"; ··· 12 12 }; 13 13 "import-tree" = { 14 14 "lock" = { 15 - "hash" = "sha256-AkfVgWWxt1pa1SlfKzcL1oQpMzgP70U3fBtzXqEGOms="; 15 + "hash" = "sha256-4TRO+jUycfR3g4KAbyK0wQEEJ7Xcmid2Ry+tWv4HPLw="; 16 16 "url" = 17 - "https://github.com/vic/import-tree/archive/78c35e32f2b499c25e0671e41662537a6b1edbf0.tar.gz"; 17 + "https://github.com/vic/import-tree/archive/205675fa599ff8a74b6c8c2cc5149cdaeac76f5f.tar.gz"; 18 18 }; 19 19 "meta" = { 20 20 "ref" = "HEAD"; ··· 24 24 }; 25 25 "nixpkgs" = { 26 26 "lock" = { 27 - "hash" = "sha256-OgUF+EoJ36hz3jo8qBuizb8suT0mu1n7mzmcGdeOjWE="; 27 + "hash" = "sha256-BHKMR414WpfUddNyUtx2GR1VPl0R9sWGQs/opgYm9rc="; 28 28 "url" = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 29 29 }; 30 30 "meta" = { 31 31 "type" = "archive"; 32 32 "url" = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 33 + }; 34 + }; 35 + "with-inputs" = { 36 + "lock" = { 37 + "hash" = "sha256-5TOTPl8CYewaDoV5O7zvezQeA/NrXx3tzjstOMc2oN8="; 38 + "url" = 39 + "https://github.com/vic/with-inputs/archive/8eeec49f4d349ddee87aa6a60ba7f8b25781f747.tar.gz"; 40 + }; 41 + "meta" = { 42 + "ref" = "HEAD"; 43 + "type" = "gitArchive"; 44 + "url" = "https://github.com/vic/with-inputs"; 33 45 }; 34 46 }; 35 47 }
+9 -13
templates/npins/default.nix
··· 1 1 let 2 + sources = import ./npins; 3 + with-inputs = import sources.with-inputs; 4 + 5 + locals ={ 6 + # uncomment on CI for local checkout 7 + # flake-file = import ./../../modules; 8 + }; 9 + 2 10 outputs = 3 11 inputs: 4 12 (inputs.nixpkgs.lib.evalModules { ··· 8 16 self = inputs.self; 9 17 }; 10 18 }).config; 11 - 12 - with-inputs = import (builtins.fetchTarball { 13 - url = "https://github.com/vic/with-inputs/archive/f19ccc093928f4987ab56534e0de37b25d8f5817.zip"; 14 - sha256 = "sha256:0bcfic6myy2qmyj40kxpxv04hp925l9b0wkd507v69d070qsg285"; 15 - }); 16 - 17 - inputs-overrides ={ 18 - # uncomment on CI for local checkout 19 - # flake-file = import ./../../modules; 20 - }; 21 - 22 - sources = import ./npins; 23 19 in 24 - with-inputs sources inputs-overrides outputs 20 + with-inputs sources locals outputs
+1
templates/npins/modules/default.nix
··· 5 5 flake-file.inputs = { 6 6 flake-file.url = "github:vic/flake-file"; 7 7 import-tree.url = "github:vic/import-tree"; 8 + with-inputs.url = "github:vic/with-inputs"; 8 9 nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; 9 10 }; 10 11 }
+22 -6
templates/npins/npins/sources.json
··· 9 9 }, 10 10 "branch": "main", 11 11 "submodules": false, 12 - "revision": "619d2212482c104fd3bbc815d80c6227b1b01338", 13 - "url": "https://github.com/vic/flake-file/archive/619d2212482c104fd3bbc815d80c6227b1b01338.tar.gz", 14 - "hash": "sha256-SQhPQRbs35fQ8ZE7tbfHsf2eu5r+oICyZL1SpGIPvGg=" 12 + "revision": "b0477cfb25e745dfd4e10a5a6b81ab4c4ad5c0f8", 13 + "url": "https://github.com/vic/flake-file/archive/b0477cfb25e745dfd4e10a5a6b81ab4c4ad5c0f8.tar.gz", 14 + "hash": "sha256-mVVAJ+QnmA/gbQmbPEi3RFtLJwWCjNslVxv1bhVRB2c=" 15 15 }, 16 16 "import-tree": { 17 17 "type": "Git", ··· 22 22 }, 23 23 "branch": "main", 24 24 "submodules": false, 25 - "revision": "c968d3b54d12cf5d9c13f16f7c545a06c9d1fde6", 26 - "url": "https://github.com/vic/import-tree/archive/c968d3b54d12cf5d9c13f16f7c545a06c9d1fde6.tar.gz", 27 - "hash": "sha256-oYO4poyw0Sb/db2PigqugMlDwsvwLg6CSpFrMUWxA3Q=" 25 + "revision": "205675fa599ff8a74b6c8c2cc5149cdaeac76f5f", 26 + "url": "https://github.com/vic/import-tree/archive/205675fa599ff8a74b6c8c2cc5149cdaeac76f5f.tar.gz", 27 + "hash": "sha256-4TRO+jUycfR3g4KAbyK0wQEEJ7Xcmid2Ry+tWv4HPLw=" 28 28 }, 29 29 "nixpkgs": { 30 30 "type": "Tarball", 31 31 "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz", 32 32 "hash": "sha256-5xZ8rQTzV4cSAPMvIZpVpF05p5iwUnEuONeelwseA4g=" 33 + }, 34 + "with-inputs": { 35 + "type": "GitRelease", 36 + "repository": { 37 + "type": "GitHub", 38 + "owner": "vic", 39 + "repo": "with-inputs" 40 + }, 41 + "pre_releases": false, 42 + "version_upper_bound": null, 43 + "release_prefix": null, 44 + "submodules": false, 45 + "version": "v0.1.0", 46 + "revision": "8eeec49f4d349ddee87aa6a60ba7f8b25781f747", 47 + "url": "https://api.github.com/repos/vic/with-inputs/tarball/refs/tags/v0.1.0", 48 + "hash": "sha256-5TOTPl8CYewaDoV5O7zvezQeA/NrXx3tzjstOMc2oN8=" 33 49 } 34 50 }, 35 51 "version": 7