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

custom option is broken for *new* packages #283

Closed
srid opened this issue Mar 27, 2024 · 7 comments · Fixed by #284
Closed

custom option is broken for *new* packages #283

srid opened this issue Mar 27, 2024 · 7 comments · Fixed by #284
Labels
bug Something isn't working
Milestone

Comments

@srid
Copy link
Owner

srid commented Mar 27, 2024

Triggered (if not introduced) by #253 which made it so that buildFromSdist is applied (alphabetically) before the custom option, and for some reason x: x in Nix is not lazily propagating the argument.

       error: attribute 'hello_rust' missing

         at /nix/store/lz0159maimglzlpd6gmn0f02047mmih0-source/nix/modules/project/settings/all.nix:325:19:

          324|             (x: log.traceDebug "${name}.buildFromSdist ${x.outPath}" x)
          325|           ]) else x: x;
             |                   ^
          326|     };

       error: attribute 'hello_rust' missing

       at /nix/store/lz0159maimglzlpd6gmn0f02047mmih0-source/nix/modules/project/settings/default.nix:75:20:

           74|           in
           75|           lib.pipe super.${name} (
             |                    ^
           76|             # TODO: Do we care about the *order* of overrides?

Repro & Details

https://nixos.zulipchat.com/#narrow/stream/413949-haskell-flake/topic/.60custom.60.20setting.20stopped.20working

Proposed design change

Replace custom with two setting options:

  • settings.<name>.init : drv: assigns the initial value before settings are applied
  • settings.<name>.final : drv -> drv: transforms the final drv after the other settings are applied.

Open question: putting these two options in the same namespace as other settings is a bit of hack, because they are semantically different. Main questions: a) Is this the best we can do as proposal? b) if so, where should these options live?

(See Zulip for further proposals/ refinements/ ideas)

@srid srid added the bug Something isn't working label Mar 27, 2024
@srid srid added this to the 0.5.0 milestone Mar 27, 2024
shivaraj-bh added a commit to shivaraj-bh/haskell-rust-ffi-template that referenced this issue Mar 28, 2024
…ad of custom

custom is broken, see: srid/haskell-flake#283

Perhaps, custom is not the right way to add non-haskell pkg deps, it makes more sense to add them under otherOverlays
@shivaraj-bh
Copy link
Contributor

It probably doesn’t make sense to add non-haskell pkg dependencies in custom, it should only be used for managing haskell packages, which it is meant for.

It made more sense to move hello_rust to otherOverlays and that did the job: shivaraj-bh/haskell-rust-ffi-template@bb60ff1

@shivaraj-bh
Copy link
Contributor

it should only be used for managing haskell packages, which it is meant for.

If we stick to that, we needn’t worry about the order in which the setting is applied, do we?

@srid
Copy link
Owner Author

srid commented Mar 28, 2024

People use custom option to add Haskell dependency too. See https://community.flake.parts/haskell-flake/dependency#nixpkgs

Regarding, otherOvelays it won't compose like settings does. So if somebody defines otherOverlays in their own project, and imports your FFI template (which also defines otherOverlays), they will get conflict, because of this:

merge = lib.mergeOneOption;

(The reason for preventing merging of overlay lists here is due to nondeterministic semantics of list merge)

@srid srid changed the title custom option is broken custom option is broken for *new* packages Mar 28, 2024
@srid srid closed this as completed in #284 Mar 28, 2024
@shivaraj-bh
Copy link
Contributor

It is breaking again after #286

Reproducer:

nix build github:shivaraj-bh/haskell-rust-ffi-template --override-input haskell-flake github:srid/haskell-flake/51bcbc27194e734a1524ac3d36e1539fba9a3baa

@srid
Copy link
Owner Author

srid commented Apr 2, 2024

@shivaraj-bh It is breaking, but it is not the same error.

From the issue description:

error: attribute 'hello_rust' missing

What I'm seeing when using master branch:

       error: attribute 'override' missing

       at /nix/store/fjvkr94j3lwca8y66zccn15rjwzqn0rd-source/pkgs/development/haskell-modules/lib/compose.nix:38:28:

           37|    */
           38|   overrideCabal = f: drv: (drv.override (args: args // {
             |                            ^
           39|     mkDerivation = drv: (args.mkDerivation drv).override f;

Could you open a separate bug report?

@srid
Copy link
Owner Author

srid commented Apr 2, 2024

Could you open a separate bug report?

Actually, wait. Let me figure out what the issue is first.

@srid srid reopened this Apr 2, 2024
@srid
Copy link
Owner Author

srid commented Apr 2, 2024

#292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants