-
-
Notifications
You must be signed in to change notification settings - Fork 10
flake: Remove flake-parts from top-level flake #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I don't like using flake-parts for a few reasons: - Pollutes downstreams Which Requires application of flake follows to avoid duplication - Obfuscates things - Impossible to profile I also don't see how it adds any value here.
}; | ||
|
||
# TODO: Figure out how to distribute flake-parts without using flake-parts on the top-level | ||
modules = throw "Dunno lol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ nix repl .
nix-repl> :p modules
{
flake = {
default = {
_class = "flake";
_file = "/nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/flake.nix#modules.flake.default";
imports = [
{
imports = [
{
_file = "/nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/lib/modules.nix, via option flake.modules.flake.default";
imports = [ «lambda default @ /nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/lib/modules.nix:26:7» ];
}
];
}
];
};
testsOutput = {
_class = "flake";
_file = "/nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/flake.nix#modules.flake.testsOutput";
imports = [
{
imports = [
{
_file = "/nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/lib/modules.nix, via option flake.modules.flake.testsOutput";
imports = [ /nix/store/m3z8yiszmgzj9nj921h6frw2jddhxy4q-source/lib/modules/flakes/tests-output.nix ];
}
];
}
];
};
};
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this?
{
modules.flake.default.imports = [ ./my-module.nix ];
}
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
in | ||
(treefmt-nix.lib.evalModule pkgs ./dev/treefmt.nix).config.build.wrapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still missing checks.treefmt
in CI.
|
||
flake.githubActions = nix-github-actions.lib.mkGithubMatrix { | ||
githubActions = nix-github-actions.lib.mkGithubMatrix { | ||
checks = { | ||
x86_64-linux = builtins.removeAttrs (self.packages.x86_64-linux // self.checks.x86_64-linux) [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there actually a better API to this? This will silently ignore conflicts in those two sets. Also mkGithubMatrix
should be able to filter out itself by doing a builtins.groupBy
|
||
# Extra things to load only when accessing development-specific attributes | ||
# such as `checks` | ||
partitionedAttrs.checks = "dev"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this line disconnects the check derivation for the flake-parts module.
Considering that subflakes still are still quite broken until the next NixOS release, it still has to be wired through /flake.nix
.
You'll need flake-compat
to load the inputs from dev
and then cherry-pick the relevant attributes from a mkFlake
call that resembles a combination of module
below.
(I guess that's a partial answer to your question about the added value here. flake-parts.flakeModules.partitions
is a ready to use solution for this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subflakes still are still quite broken until the next NixOS release
where can I find out about the upcoming improvements? Thanks!
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; | ||
nix-github-actions.url = "github:nix-community/nix-github-actions"; | ||
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of removing flake-parts, or in addition to removing it, you could gain some fetching (or really, locking) efficiency by moving these two over to the dev
partition instead.
I don't like using flake-parts for a few reasons:
Pollutes downstreams Which Requires application of flake follows to avoid duplication
Obfuscates things
Impossible to profile
I also don't see how it adds any value here.