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

Problem: Output is not composable #196

Merged
merged 6 commits into from
Sep 3, 2018

Conversation

clacke
Copy link
Member

@clacke clacke commented Sep 3, 2018

Solution: Use makeExtensible.

Closes #175

  • Wrap all the dependencies in an attribute set.
  • Export that attribute set as an attribute of the package.
  • Wrap the attribute set in a function called with makeExtensible.
  • Move our functions into a sub-attribute 'lib', minimize collision.
  • Take the chance to rename attributes to names without a '_' prefix.

Example:

$ nix-build -A racket-packages.racket2nix
error: attribute 'racket2nix' in selection path 'racket-packages.racket2nix' not found
$ nix-build -A racket-packages.nix
/nix/store/l5dnla8gjg04v7v4q8pzkqaxqgp0l8cd-racket-minimal-7.0-nix
$ nix-build -E 'with import ./. {}; (racket-packages.extend (self: super: { racket2nix = self.nix.overrideRacketDerivation (oldAttrs: { pname = "racket2nix-stage1"; }); })).racket2nix'
/nix/store/zqlpq7iqcbia8wqiv03v9nlfdl637wvf-racket-minimal-7.0-racket2nix-stage1

Solution: Start by enclosing them all in an attribute set.
Solution: Put the package itself and all its dependencies in racket-packages.
Solution: Wrap packages in makeExtensible, all references via self.
Solution: Move functions into 'lib' attribute.
Now that we are referring to them with 'self.name' we can skip the workaround. Packages like 2
'2d-lib' can be safely addressed now that we can have quotes around the name.

Solution: Remove the '_' prefix, address attributes with a quoted string.

We are banking on nobody ever calling a racket package 'lib', 'extend'
or '__unfix__'. For the moment it holds.
Solution: Use makeExtensible.

Closes fractalide#175

 - Wrap all the dependencies in an attribute set.
 - Export that attribute set as an attribute of the package.
 - Wrap the attribute set in a function called with makeExtensible.
 - Move our functions into a sub-attribute 'lib', minimize collision.
 - Take the chance to rename attributes to names without a '_' prefix.

Example:

    $ nix-build -A racket-packages.racket2nix
    error: attribute 'racket2nix' in selection path 'racket-packages.racket2nix' not found
    $ nix-build -A racket-packages.nix
    /nix/store/l5dnla8gjg04v7v4q8pzkqaxqgp0l8cd-racket-minimal-7.0-nix
    $ nix-build -E 'with import ./. {}; (racket-packages.extend (self: super: { racket2nix = self.nix.overrideRacketDerivation (oldAttrs: { pname = "racket2nix-stage1"; }); })).racket2nix'
    /nix/store/zqlpq7iqcbia8wqiv03v9nlfdl637wvf-racket-minimal-7.0-racket2nix-stage1
@sjmackenzie sjmackenzie merged commit c182170 into fractalide:master Sep 3, 2018
@clacke clacke deleted the racket-packages branch September 3, 2018 14:59
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.

Problem: Output is not composable
2 participants