From f987e50725ad75a9ee3443a6ac14318e1adf459c Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:21:50 +0300 Subject: [PATCH 1/9] feat: flake.nix trick for experimental nix cli --- templates/flakeless-parts/.gitignore | 0 templates/flakeless-parts/README.md | 18 ++ templates/flakeless-parts/default.nix | 18 ++ templates/flakeless-parts/flake.nix | 1 + templates/flakeless-parts/modules/default.nix | 11 + templates/flakeless-parts/npins/default.nix | 249 ++++++++++++++++++ templates/flakeless-parts/npins/sources.json | 52 ++++ 7 files changed, 349 insertions(+) create mode 100644 templates/flakeless-parts/.gitignore create mode 100644 templates/flakeless-parts/README.md create mode 100644 templates/flakeless-parts/default.nix create mode 100644 templates/flakeless-parts/flake.nix create mode 100644 templates/flakeless-parts/modules/default.nix create mode 100644 templates/flakeless-parts/npins/default.nix create mode 100644 templates/flakeless-parts/npins/sources.json diff --git a/templates/flakeless-parts/.gitignore b/templates/flakeless-parts/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/templates/flakeless-parts/README.md b/templates/flakeless-parts/README.md new file mode 100644 index 0000000..e2aad71 --- /dev/null +++ b/templates/flakeless-parts/README.md @@ -0,0 +1,18 @@ +# npins + +This template is an example of using `flake-file.inputs` in a non-flakes +project with [npins](https://github.com/andir/npins). + +It uses npins to pin and fetch inputs defined as options inside `./modules`. + +## Update npins + +Update the `npins/` directory from your declared inputs: + +```shell +nix-shell . -A flake-file.sh --run write-npins +``` + +This will run `npins add` for +each input declared in your modules, using the correct npins subcommand +(`github`, `tarball`, `git`, etc.) based on the input URL scheme. diff --git a/templates/flakeless-parts/default.nix b/templates/flakeless-parts/default.nix new file mode 100644 index 0000000..d55bef3 --- /dev/null +++ b/templates/flakeless-parts/default.nix @@ -0,0 +1,18 @@ +let + sources = import ./npins; + with-inputs = import sources.with-inputs sources { + # uncomment on CI for local checkout + # flake-file = import ./../../modules; + }; + + outputs = + inputs: + (inputs.nixpkgs.lib.evalModules { + modules = [ (inputs.import-tree ./modules) ]; + specialArgs = { + inherit inputs; + self = inputs.self; + }; + }).config; +in +with-inputs outputs diff --git a/templates/flakeless-parts/flake.nix b/templates/flakeless-parts/flake.nix new file mode 100644 index 0000000..dbee3f2 --- /dev/null +++ b/templates/flakeless-parts/flake.nix @@ -0,0 +1 @@ +{ outputs = _: import ./.; } diff --git a/templates/flakeless-parts/modules/default.nix b/templates/flakeless-parts/modules/default.nix new file mode 100644 index 0000000..7f5c511 --- /dev/null +++ b/templates/flakeless-parts/modules/default.nix @@ -0,0 +1,11 @@ +{ inputs, ... }: +{ + imports = [ inputs.flake-file.flakeModules.npins ]; + + flake-file.inputs = { + flake-file.url = "github:vic/flake-file"; + import-tree.url = "github:vic/import-tree"; + with-inputs.url = "github:vic/with-inputs"; + nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; + }; +} diff --git a/templates/flakeless-parts/npins/default.nix b/templates/flakeless-parts/npins/default.nix new file mode 100644 index 0000000..884fc8c --- /dev/null +++ b/templates/flakeless-parts/npins/default.nix @@ -0,0 +1,249 @@ +/* + This file is provided under the MIT licence: + + 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: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + 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. +*/ +# Generated by npins. Do not modify; will be overwritten regularly +let + # Backwards-compatibly make something that previously didn't take any arguments take some + # The function must return an attrset, and will unfortunately be eagerly evaluated + # Same thing, but it catches eval errors on the default argument so that one may still call it with other arguments + mkFunctor = + fn: + let + e = builtins.tryEval (fn { }); + in + (if e.success then e.value else { error = fn { }; }) // { __functor = _self: fn; }; + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatStrings = builtins.concatStringsSep ""; + + # If the environment variable NPINS_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + # (Taken from Niv for compatibility) + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path + else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" + ); + + mkSource = + name: spec: + { + pkgs ? null, + }: + assert spec ? type; + let + # Unify across builtin and pkgs fetchers. + # `fetchGit` requires a wrapper because of slight API differences. + fetchers = + if pkgs == null then + { + inherit (builtins) fetchTarball fetchurl; + # For some fucking reason, fetchGit has a different signature than the other builtin fetchers … + fetchGit = args: (builtins.fetchGit args).outPath; + } + else + { + fetchTarball = + { + url, + sha256, + }: + pkgs.fetchzip { + inherit url sha256; + extension = "tar"; + }; + inherit (pkgs) fetchurl; + fetchGit = + { + url, + submodules, + rev, + name, + narHash, + }: + pkgs.fetchgit { + inherit url rev name; + fetchSubmodules = submodules; + hash = narHash; + }; + }; + + # Dispatch to the correct code path based on the type + path = + if spec.type == "Git" then + mkGitSource fetchers spec + else if spec.type == "GitRelease" then + mkGitSource fetchers spec + else if spec.type == "PyPi" then + mkPyPiSource fetchers spec + else if spec.type == "Channel" then + mkChannelSource fetchers spec + else if spec.type == "Tarball" then + mkTarballSource fetchers spec + else if spec.type == "Container" then + mkContainerSource pkgs spec + else + builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = mayOverride name path; }; + + mkGitSource = + { + fetchTarball, + fetchGit, + ... + }: + { + repository, + revision, + url ? null, + submodules, + hash, + ... + }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null && !submodules then + fetchTarball { + inherit url; + sha256 = hash; + } + else + let + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else if repository.type == "Forgejo" then + "${repository.server}/${repository.owner}/${repository.repo}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName url revision; + in + fetchGit { + rev = revision; + narHash = hash; + + inherit name submodules url; + }; + + mkPyPiSource = + { fetchurl, ... }: + { + url, + hash, + ... + }: + fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = + { fetchTarball, ... }: + { + url, + hash, + ... + }: + fetchTarball { + inherit url; + sha256 = hash; + }; + + mkTarballSource = + { fetchTarball, ... }: + { + url, + locked_url ? url, + hash, + ... + }: + fetchTarball { + url = locked_url; + sha256 = hash; + }; + + mkContainerSource = + pkgs: + { + image_name, + image_tag, + image_digest, + ... + }: + if pkgs == null then + builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers" + else + pkgs.dockerTools.pullImage { + imageName = image_name; + imageDigest = image_digest; + finalImageTag = image_tag; + }; +in +mkFunctor ( + { + input ? ./sources.json, + }: + let + data = + if builtins.isPath input then + # while `readFile` will throw an error anyways if the path doesn't exist, + # we still need to check beforehand because *our* error can be caught but not the one from the builtin + # *piegames sighs* + if builtins.pathExists input then + builtins.fromJSON (builtins.readFile input) + else + throw "Input path ${toString input} does not exist" + else if builtins.isAttrs input then + input + else + throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset"; + version = data.version; + in + if version == 7 then + builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins + else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" +) diff --git a/templates/flakeless-parts/npins/sources.json b/templates/flakeless-parts/npins/sources.json new file mode 100644 index 0000000..9369931 --- /dev/null +++ b/templates/flakeless-parts/npins/sources.json @@ -0,0 +1,52 @@ +{ + "pins": { + "flake-file": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "vic", + "repo": "flake-file" + }, + "branch": "main", + "submodules": false, + "revision": "cdb4abe76b3ff0b611343514f584faa2688a12af", + "url": "https://github.com/vic/flake-file/archive/cdb4abe76b3ff0b611343514f584faa2688a12af.tar.gz", + "hash": "sha256-5FB/FQ+gCvFbEuyMxydkUHuMCe0UEgMra5jI2D6SAQU=" + }, + "import-tree": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "vic", + "repo": "import-tree" + }, + "branch": "main", + "submodules": false, + "revision": "205675fa599ff8a74b6c8c2cc5149cdaeac76f5f", + "url": "https://github.com/vic/import-tree/archive/205675fa599ff8a74b6c8c2cc5149cdaeac76f5f.tar.gz", + "hash": "sha256-4TRO+jUycfR3g4KAbyK0wQEEJ7Xcmid2Ry+tWv4HPLw=" + }, + "nixpkgs": { + "type": "Tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz", + "hash": "sha256-5xZ8rQTzV4cSAPMvIZpVpF05p5iwUnEuONeelwseA4g=" + }, + "with-inputs": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "vic", + "repo": "with-inputs" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.1.0", + "revision": "8eeec49f4d349ddee87aa6a60ba7f8b25781f747", + "url": "https://api.github.com/repos/vic/with-inputs/tarball/refs/tags/v0.1.0", + "hash": "sha256-5TOTPl8CYewaDoV5O7zvezQeA/NrXx3tzjstOMc2oN8=" + } + }, + "version": 7 +} From 3fc901f9a549338f836a1ce70001c876c92d7410 Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:23:08 +0300 Subject: [PATCH 2/9] chore: add flake-parts --- templates/flakeless-parts/default.nix | 1 + templates/flakeless-parts/modules/default.nix | 1 + templates/flakeless-parts/npins/sources.json | 39 +++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/templates/flakeless-parts/default.nix b/templates/flakeless-parts/default.nix index d55bef3..c6d2fe8 100644 --- a/templates/flakeless-parts/default.nix +++ b/templates/flakeless-parts/default.nix @@ -1,6 +1,7 @@ let sources = import ./npins; with-inputs = import sources.with-inputs sources { + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; # uncomment on CI for local checkout # flake-file = import ./../../modules; }; diff --git a/templates/flakeless-parts/modules/default.nix b/templates/flakeless-parts/modules/default.nix index 7f5c511..8416bdc 100644 --- a/templates/flakeless-parts/modules/default.nix +++ b/templates/flakeless-parts/modules/default.nix @@ -7,5 +7,6 @@ import-tree.url = "github:vic/import-tree"; with-inputs.url = "github:vic/with-inputs"; nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; } diff --git a/templates/flakeless-parts/npins/sources.json b/templates/flakeless-parts/npins/sources.json index 9369931..0fe8860 100644 --- a/templates/flakeless-parts/npins/sources.json +++ b/templates/flakeless-parts/npins/sources.json @@ -12,6 +12,18 @@ "revision": "cdb4abe76b3ff0b611343514f584faa2688a12af", "url": "https://github.com/vic/flake-file/archive/cdb4abe76b3ff0b611343514f584faa2688a12af.tar.gz", "hash": "sha256-5FB/FQ+gCvFbEuyMxydkUHuMCe0UEgMra5jI2D6SAQU=" + "flake-parts": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "hercules-ci", + "repo": "flake-parts" + }, + "branch": "main", + "submodules": false, + "revision": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "url": "https://github.com/hercules-ci/flake-parts/archive/3107b77cd68437b9a76194f0f7f9c55f2329ca5b.tar.gz", + "hash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=" }, "import-tree": { "type": "Git", @@ -27,9 +39,30 @@ "hash": "sha256-4TRO+jUycfR3g4KAbyK0wQEEJ7Xcmid2Ry+tWv4HPLw=" }, "nixpkgs": { - "type": "Tarball", - "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz", - "hash": "sha256-5xZ8rQTzV4cSAPMvIZpVpF05p5iwUnEuONeelwseA4g=" + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nixos", + "repo": "nixpkgs" + }, + "branch": "nixpkgs-unstable", + "submodules": false, + "revision": "b0188973b4b2a5b6bdba8b65381d6cd09a533da0", + "url": "https://github.com/nixos/nixpkgs/archive/b0188973b4b2a5b6bdba8b65381d6cd09a533da0.tar.gz", + "hash": "sha256-BuTK9z1QEwWPOIakQ1gCN4pa4VwVJpfptYCviy2uOGc=" + }, + "nixpkgs-lib": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "nixpkgs.lib" + }, + "branch": "master", + "submodules": false, + "revision": "2890b0f0d5edd3b5bf795294a04f9879d9d50fef", + "url": "https://github.com/nix-community/nixpkgs.lib/archive/2890b0f0d5edd3b5bf795294a04f9879d9d50fef.tar.gz", + "hash": "sha256-bK65+s0Xbt0fq5K/i9Ez02AbDv7HBSXEfdDhUlYphDg=" }, "with-inputs": { "type": "GitRelease", From 65c84dbaaa6b8201ae8171934033b7edf43d1951 Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:23:08 +0300 Subject: [PATCH 3/9] chore: update other inputs --- templates/flakeless-parts/npins/sources.json | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/templates/flakeless-parts/npins/sources.json b/templates/flakeless-parts/npins/sources.json index 0fe8860..a06d4f1 100644 --- a/templates/flakeless-parts/npins/sources.json +++ b/templates/flakeless-parts/npins/sources.json @@ -9,9 +9,10 @@ }, "branch": "main", "submodules": false, - "revision": "cdb4abe76b3ff0b611343514f584faa2688a12af", - "url": "https://github.com/vic/flake-file/archive/cdb4abe76b3ff0b611343514f584faa2688a12af.tar.gz", - "hash": "sha256-5FB/FQ+gCvFbEuyMxydkUHuMCe0UEgMra5jI2D6SAQU=" + "revision": "3daadf37de2bb85b0ff34e2a7ab0d71e077c2b9e", + "url": "https://github.com/vic/flake-file/archive/3daadf37de2bb85b0ff34e2a7ab0d71e077c2b9e.tar.gz", + "hash": "sha256-w2LoQVM6DXrSdGUZBZqa1nYkMzHoB0t82DrptzZKhTs=" + }, "flake-parts": { "type": "Git", "repository": { @@ -34,9 +35,9 @@ }, "branch": "main", "submodules": false, - "revision": "205675fa599ff8a74b6c8c2cc5149cdaeac76f5f", - "url": "https://github.com/vic/import-tree/archive/205675fa599ff8a74b6c8c2cc5149cdaeac76f5f.tar.gz", - "hash": "sha256-4TRO+jUycfR3g4KAbyK0wQEEJ7Xcmid2Ry+tWv4HPLw=" + "revision": "c41e7d58045f9057880b0d85e1152d6a4430dbf1", + "url": "https://github.com/vic/import-tree/archive/c41e7d58045f9057880b0d85e1152d6a4430dbf1.tar.gz", + "hash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=" }, "nixpkgs": { "type": "Git", @@ -75,10 +76,10 @@ "version_upper_bound": null, "release_prefix": null, "submodules": false, - "version": "v0.1.0", - "revision": "8eeec49f4d349ddee87aa6a60ba7f8b25781f747", - "url": "https://api.github.com/repos/vic/with-inputs/tarball/refs/tags/v0.1.0", - "hash": "sha256-5TOTPl8CYewaDoV5O7zvezQeA/NrXx3tzjstOMc2oN8=" + "version": "v0.3.0", + "revision": "920b35279fb800c147017c8332e04a3daa994af4", + "url": "https://api.github.com/repos/vic/with-inputs/tarball/refs/tags/v0.3.0", + "hash": "sha256-3rNFfdLJ/nivZkgBoVi+M8tJQQpupuojaHyNig1Qzrs=" } }, "version": 7 From acd1b8ec23b7464cce7081faee96c9677292bf1b Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:23:08 +0300 Subject: [PATCH 4/9] feat: invoke mkFlake to load modules --- templates/flakeless-parts/default.nix | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/templates/flakeless-parts/default.nix b/templates/flakeless-parts/default.nix index c6d2fe8..a9bb428 100644 --- a/templates/flakeless-parts/default.nix +++ b/templates/flakeless-parts/default.nix @@ -7,13 +7,7 @@ let }; outputs = - inputs: - (inputs.nixpkgs.lib.evalModules { - modules = [ (inputs.import-tree ./modules) ]; - specialArgs = { - inherit inputs; - self = inputs.self; - }; - }).config; + inputs@{ flake-parts, import-tree, ... }: + flake-parts.lib.mkFlake { inherit inputs; } (import-tree ./modules); in with-inputs outputs From e366a9eb3577f306f525a6337359348c2ce776af Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:23:08 +0300 Subject: [PATCH 5/9] feat: create flakeless-parts variant --- modules/default.nix | 12 ++++++++++++ modules/flakeless-parts.nix | 12 ++++++++++++ templates/flakeless-parts/README.md | 6 +++--- templates/flakeless-parts/modules/default.nix | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 modules/flakeless-parts.nix diff --git a/modules/default.nix b/modules/default.nix index 82ce7dd..e4ba56f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -8,6 +8,7 @@ let dendritic import-tree npins + flakeless-parts unflake nixlock flake-options @@ -34,6 +35,12 @@ let ./npins ]; + flakeless-parts.imports = [ + base + ./npins + ./flakeless-parts.nix + ]; + unflake.imports = [ base ./unflake @@ -82,6 +89,11 @@ let path = ./../templates/npins; }; + templates.flakeless-parts = { + description = "flakeless-parts template"; + path = ./../templates/flakeless-parts; + }; + templates.unflake = { description = "unflake template"; path = ./../templates/unflake; diff --git a/modules/flakeless-parts.nix b/modules/flakeless-parts.nix new file mode 100644 index 0000000..a4b2a3a --- /dev/null +++ b/modules/flakeless-parts.nix @@ -0,0 +1,12 @@ +{ config, lib, ... }: +{ + systems = lib.mkDefault lib.systems.flakeExposed; + + perSystem = + { pkgs, ... }: + { + apps.write-npins = { + program = config.flake-file.apps.write-npins pkgs; + }; + }; +} diff --git a/templates/flakeless-parts/README.md b/templates/flakeless-parts/README.md index e2aad71..d89ef0e 100644 --- a/templates/flakeless-parts/README.md +++ b/templates/flakeless-parts/README.md @@ -1,7 +1,7 @@ -# npins +# flakeless-parts (npins w/ flake-parts) This template is an example of using `flake-file.inputs` in a non-flakes -project with [npins](https://github.com/andir/npins). +project with [npins](https://github.com/andir/npins), while still using [flake-parts](https://flake.parts). It uses npins to pin and fetch inputs defined as options inside `./modules`. @@ -10,7 +10,7 @@ It uses npins to pin and fetch inputs defined as options inside `./modules`. Update the `npins/` directory from your declared inputs: ```shell -nix-shell . -A flake-file.sh --run write-npins +nix run .#write-npins ``` This will run `npins add` for diff --git a/templates/flakeless-parts/modules/default.nix b/templates/flakeless-parts/modules/default.nix index 8416bdc..2783972 100644 --- a/templates/flakeless-parts/modules/default.nix +++ b/templates/flakeless-parts/modules/default.nix @@ -1,6 +1,6 @@ { inputs, ... }: { - imports = [ inputs.flake-file.flakeModules.npins ]; + imports = [ inputs.flake-file.flakeModules.flakeless-parts ]; flake-file.inputs = { flake-file.url = "github:vic/flake-file"; From f44828e3da288168c6e3b8e9b0758bfb651cc19e Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 15:23:08 +0300 Subject: [PATCH 6/9] ci: create test for flakeless-parts --- .github/workflows/flake-check.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/flake-check.yaml b/.github/workflows/flake-check.yaml index dfc5ee4..5b05f2e 100644 --- a/.github/workflows/flake-check.yaml +++ b/.github/workflows/flake-check.yaml @@ -94,6 +94,21 @@ jobs: sed -i 's/# flake-file = import/flake-file = import/' default.nix echo "{ inputs, ... }: { npins.pkgs = import inputs.nixpkgs {}; }" | tee modules/pkgs.nix nix-shell . -A flake-file.sh --run write-npins + flakeless-parts: + needs: [dev] + name: Check flakeless-parts + runs-on: ubuntu-latest + if: ${{ contains(github.event.pull_request.labels.*.name, 'flakeless-parts') }} + steps: + - uses: actions/checkout@v4 + - uses: wimpysworld/nothing-but-nix@v10 + - uses: cachix/install-nix-action@v31 + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: | + set -e -o pipefail + cd templates/flakeless-parts + sed -i 's/# flake-file = import/flake-file = import/' default.nix + nix run .#write-npins unflake: needs: [dev] name: Check unflake From 32212a5274472ce3c474128f65b044ee502d7944 Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 19:46:56 +0300 Subject: [PATCH 7/9] ci: exclude flakeless-parts from matrix test --- .github/workflows/flake-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake-check.yaml b/.github/workflows/flake-check.yaml index 5b05f2e..7d0c816 100644 --- a/.github/workflows/flake-check.yaml +++ b/.github/workflows/flake-check.yaml @@ -56,7 +56,7 @@ jobs: matrix: template: ${{ fromJSON(needs.find-templates.outputs.templates) }} exclude: - - template: minimal + - template: ["minimal", "flakeless-parts"] steps: - uses: wimpysworld/nothing-but-nix@v10 - uses: cachix/install-nix-action@v31 From 662d6c28ac2f273f9ef6727d1aece2129281a8aa Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 21:12:51 +0300 Subject: [PATCH 8/9] ci: exclude actual template --- .github/workflows/flake-check.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flake-check.yaml b/.github/workflows/flake-check.yaml index 7d0c816..7fe676f 100644 --- a/.github/workflows/flake-check.yaml +++ b/.github/workflows/flake-check.yaml @@ -56,7 +56,8 @@ jobs: matrix: template: ${{ fromJSON(needs.find-templates.outputs.templates) }} exclude: - - template: ["minimal", "flakeless-parts"] + - template: minimal + - template: flakeless-parts steps: - uses: wimpysworld/nothing-but-nix@v10 - uses: cachix/install-nix-action@v31 From 11a278cc7990d179123020bb9a1fc4e0b4e0227b Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Fri, 10 Apr 2026 21:45:41 +0300 Subject: [PATCH 9/9] ci: empty to test