Skip to content

refactor: split flake.nix into multiple files - #8272

Merged
link2xt merged 1 commit into
mainfrom
link2xt/refactor-flake.nix
Sep 4, 2026
Merged

refactor: split flake.nix into multiple files#8272
link2xt merged 1 commit into
mainfrom
link2xt/refactor-flake.nix

Conversation

@link2xt

@link2xt link2xt commented May 25, 2026

Copy link
Copy Markdown
Collaborator

There are more things to split out, cleanup and refactor e.g. around rustPlatform and rust toolchains, but i'm not going to do it now, so this PR is finished.

I tried to split out everything without changes and refactoring, the only minimal changes are for relative paths and replacing manifest.version with inherit version where the version is passed as an argument.

@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch 2 times, most recently from 934507f to 2dc8943 Compare May 25, 2026 07:45
@link2xt link2xt changed the title refactor: factor out nix/wheel.nix out of flake.nix Update and refactor flake.nix May 25, 2026
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch 4 times, most recently from 7423df2 to b2d9153 Compare May 27, 2026 19:28
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from 026e495 to 6b70af4 Compare May 27, 2026 20:33
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from b7b4eee to c5bb4fa Compare May 27, 2026 23:03
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from f4ec5a8 to 81df158 Compare May 29, 2026 11:34
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from 81df158 to e426879 Compare June 15, 2026 20:42
@link2xt link2xt changed the title Update and refactor flake.nix Refactor flake.nix into multiple files Jun 15, 2026
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from e426879 to f06237f Compare June 15, 2026 20:49
@link2xt
link2xt marked this pull request as ready for review June 15, 2026 20:49
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from f06237f to 4259198 Compare June 15, 2026 20:55
@link2xt link2xt changed the title Refactor flake.nix into multiple files refactor: split flake.nix into muiltple files Jun 15, 2026
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch 4 times, most recently from 62c1877 to 32b0e63 Compare June 22, 2026 21:02
@dotlambda
dotlambda self-requested a review June 22, 2026 23:27
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from 32b0e63 to 9462af9 Compare July 13, 2026 11:18
@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from 9462af9 to f0bac1a Compare August 26, 2026 14:39
@Septias
Septias self-requested a review September 4, 2026 10:22
@Septias

Septias commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

CI filters only on the Nix file and not on the subfolder nix/ so CI will not run on changes to these files. Also, the formatter would only check the format of the top-level flake file, so the folder needs to be added. I propose this fix:

--- a/.github/workflows/nix.yml
+++ b/.github/workflows/nix.yml
@@ -5,11 +5,13 @@ on:
     paths:
       - flake.nix
       - flake.lock
+      - nix/**
       - .github/workflows/nix.yml
   push:
     paths:
       - flake.nix
       - flake.lock
+      - nix/**
       - .github/workflows/nix.yml
@@ -26,7 +28,7 @@ jobs:
-      - run: nix fmt flake.nix -- --check
+      - run: nix fmt flake.nix nix/ -- --check

@Septias

Septias commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Using nix eval and Claude, I verified that the output paths are similar for 30 of 40 packages, and the 10 changed derivations are mostly due to changes to env.src which should be unproblematic. (I could not test the 6 Darwin packages that don't evaluate on my x86_64 machine). Same output paths (drvPaths) mean the build will be the same. To unblock the waiting PRs #8337 #8349 #8632, I think it is fine to merge this with only the fixed CI. If you do so, I can give the green checkmark.

There are quite a few things to be improved, though:

  1. Lots of code duplication between the files in nix/
  2. The instantiation in cross-rust-package, leads to ~14 full nixpkgs instantiations. Costly during evaluation.
  3. Nix-filter should be used for the packages to prevent unnecessary rebuilds (due to changes on readme, etc.)
  4. Nixpkgs should not point to master, since these builds are often not cached yet and could lead to stdenv builds (very costly).
  5. Some inputs are (partly) discouraged (flake-utils, ~nearsk)
  6. Lots of smaller changes (dead code, no default-build, nixpkgs-fmt is archived, …)

I propose splitting these into multiple follow-up PRs. I can take care of them if wanted.

@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from f0bac1a to 2b3fedd Compare September 4, 2026 13:45
@link2xt

link2xt commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Some inputs are (partly) discouraged (flake-utils, ~nearsk)

I tried to get rid of naersk is the past, can be reused: #8281
But there were some problems with windows cross-compilation and i didn't want to risk windows build changing.

@Septias

Septias commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

minor: your last commit has a typo btw.

@link2xt
link2xt force-pushed the link2xt/refactor-flake.nix branch from 2b3fedd to f1e6489 Compare September 4, 2026 16:21
@link2xt link2xt changed the title refactor: split flake.nix into muiltple files refactor: split flake.nix into multiple files Sep 4, 2026
@link2xt
link2xt merged commit 49c30ec into main Sep 4, 2026
92 of 93 checks passed
@link2xt
link2xt deleted the link2xt/refactor-flake.nix branch September 4, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants