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

Expose overrides in flake #12

Closed
srid opened this issue Jun 2, 2022 · 8 comments
Closed

Expose overrides in flake #12

srid opened this issue Jun 2, 2022 · 8 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@srid
Copy link
Owner

srid commented Jun 2, 2022

Rationale: When I want to use emanote as a library, I want to use its overrides (and source-overrides) so as to be able to re-use it without replicating it in the local project (that uses emanote as a dependency).

https://github.com/srid/emanote/blob/6f83b857741fb6607716cf97cee3382c7f029180/flake.nix#L43-L51

@srid

This comment was marked as outdated.

@srid
Copy link
Owner Author

srid commented Nov 20, 2022

@locallycompact's https://horizon-haskell.net/ 's overlay could also be exposed in this manner?

@roberth
Copy link
Collaborator

roberth commented Dec 1, 2022

https://github.com/srid/emanote/blob/6f83b857741fb6607716cf97cee3382c7f029180/flake.nix#L43-L51

I think these lines could be turned into a small module that can be imported at the project level.

      flake.haskellFlakeProjectModules.default =
        ... those lines ...;
      perSystem = { pkgs, system, inputs', self', ... }: {
        haskellProjects.default = {
          imports = [ self.haskellFlakeProjectModules.default ];

@srid
Copy link
Owner Author

srid commented Dec 1, 2022

Interesting idea. What happens if two modules define the same option, say buildTools? Merge, or replace, or ?

@roberth
Copy link
Collaborator

roberth commented Dec 1, 2022

It's determined by the option type.
attrsOf and lazyAttrsOf will merge; listOf appends. Types like package and str will error out.
mkForce and mkOverride replace.

@srid
Copy link
Owner Author

srid commented Dec 1, 2022

I suppose for overrides we ought to create a custom type with composeExtensions-based merge semantics, because the default semantics for types.functionTo just calls the functions and merges the results (attrsets): https://github.com/NixOS/nixpkgs/blob/cd71c681ca4e49de4f65e6a45f686f11f3e1b7d3/lib/types.nix#L620-L621

@srid
Copy link
Owner Author

srid commented Feb 1, 2023

It just occurred to me that this approach (imports) can also solve the problem of decoupling the hardcoded buildTools, so that imports = [ inputs.haskell-flake.defaultSettings ]; for example could set the buildTools defaults (and the user can ignore them if they want to start pristine).

@srid srid pinned this issue Feb 1, 2023
@srid srid changed the title Expose overrides and source-overrides in flake Expose overrides in flake Feb 1, 2023
@srid srid self-assigned this Feb 9, 2023
@srid
Copy link
Owner Author

srid commented Feb 11, 2023

@srid srid closed this as completed Feb 11, 2023
@srid srid unpinned this issue Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants