Skip to content

Conversation

adisbladis
Copy link
Member

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.

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";
Copy link
Member Author

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.

Copy link
Member

@Mic92 Mic92 Dec 11, 2024

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 ];
            }
          ];
        }
      ];
    };
  };
}

Copy link
Member

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
Copy link
Member

@Mic92 Mic92 Dec 11, 2024

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) [
Copy link
Member

@Mic92 Mic92 Dec 11, 2024

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";
Copy link
Contributor

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.)

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!

Comment on lines 6 to 9
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";
Copy link
Contributor

@roberth roberth Dec 11, 2024

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.

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.

4 participants