Skip to content
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

What is the best way to custom attributes for debugging purpose inside perSystem? #256

Open
bglgwyng opened this issue Oct 31, 2024 · 3 comments

Comments

@bglgwyng
Copy link

I'm debugging my flake-parts code with nix repl. To do this, I put custom values into flake attribute.
However, sometimes I need values provided for perSystem lambda like lib, pkgs to debug more conveniently.
AFAIK, I can't add custom attributes inside perSystem without adding custom options. It would be great if I could add attributes for debugging purpose into perSystem. Do we have any?

@bglgwyng bglgwyng changed the title What is the best way to debug things inside perSystem? What is the best way to custom attributes for debugging purpose inside perSystem? Oct 31, 2024
@bglgwyng
Copy link
Author

{
  imports = [
        ({ lib, flake-parts-lib, ... }:
          let
            inherit (lib) mkOption types;
            inherit (flake-parts-lib) mkTransposedPerSystemModule;
          in mkTransposedPerSystemModule {
            name = "debug2";
            option = mkOption {
              type = types.lazyAttrsOf types.bool;
              default = { };
            };
            file = ./.;
          })
      ];

The best solution I found so far is to put debug2 attribute manually in imports. debug is different from what I expected. Do we have such thing in default?

@roberth
Copy link
Member

roberth commented Oct 31, 2024

Did you find the debug option?
I think it covers your needs. It adds to the flake outputs:

  • currentSystem (perSystem for builtins.currentSystem if applicable)
    • currentSystem._module.args.pkgs
    • ...
  • allSystems
  • debug

@bglgwyng
Copy link
Author

bglgwyng commented Nov 4, 2024

Using debug, I should define values for debugging purposes in REPL. Is it correct?
#256 (comment)
This approach allows arbitrary properties inside perSystem.debug.

What about adding this feature into the existing debug option?

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

No branches or pull requests

2 participants