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

Update to data-fix-0.3 #679

Merged
merged 1 commit into from
Jul 24, 2020
Merged

Update to data-fix-0.3 #679

merged 1 commit into from
Jul 24, 2020

Conversation

sjakobi
Copy link
Member

@sjakobi sjakobi commented Jul 23, 2020

@sjakobi sjakobi force-pushed the sjakobi/data-fix-0.3 branch from 8e64f83 to 49f75ee Compare July 23, 2020 12:03
@sjakobi sjakobi marked this pull request as ready for review July 23, 2020 12:04
Comment on lines +218 to +228
data-fix = haskellPackages.callPackage
({ mkDerivation, base, deepseq, hashable, stdenv }:
mkDerivation {
pname = "data-fix";
version = "0.3.0";
sha256 = "9e59b3ed694b5139316093b3767842e60ad4821858459e7cd763e5773dfa99a0";
libraryHaskellDepends = [ base deepseq hashable ];
homepage = "https://github.com/spell-music/data-fix";
description = "Fixpoint data types";
license = stdenv.lib.licenses.bsd3;
}) {};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I arrived at this setup after a bit of trial and error. If there's a better way to achieve the same, I'd happily use it.

Copy link
Collaborator

@Anton-Latukha Anton-Latukha Jul 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try haskellPackages.callHackage:

Given example is:

...
foo = self.callHackage "foo" "1.5.3" {};
...

It is much more clear and obvious what it is and does.

It calls official hackage2nix machinery into motion and takes Haskell package and automatically generates Nix Haskell package.

callHackage is wonderful to use in cases when Nixpkgs dodges to follow the upstream Hackage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting an error with this patch:

--- a/default.nix
+++ b/default.nix
@@ -215,17 +215,7 @@ let
 
       # 2020-07-23 hnix uses multiple functions that are unavailable in
       # data-fix < 0.3.
-      data-fix = haskellPackages.callPackage
-       ({ mkDerivation, base, deepseq, hashable, stdenv }:
-        mkDerivation {
-          pname = "data-fix";
-          version = "0.3.0";
-          sha256 = "9e59b3ed694b5139316093b3767842e60ad4821858459e7cd763e5773dfa99a0";
-          libraryHaskellDepends = [ base deepseq hashable ];
-          homepage = "https://github.com/spell-music/data-fix";
-          description = "Fixpoint data types";
-          license = stdenv.lib.licenses.bsd3;
-        }) {};
+      data-fix = haskellPackages.callHackage "data-fix" "0.3.0" {};
     };
$ nix-build --argstr compiler ghc883 --arg buildFromSdist true
building '/nix/store/h8zl5khhsf9x2w86qgqw1f48g2y8fxhv-cabal2nix-hnix.drv'...
installing
building '/nix/store/zknicl0518i1m0sh7f7yfk0dby6dsv3q-all-cabal-hashes-component-data-fix-0.3.0.drv'...
tar: */data-fix/0.3.0/data-fix.json: Not found in archive
tar: */data-fix/0.3.0/data-fix.cabal: Not found in archive
tar: Exiting with failure status due to previous errors
builder for '/nix/store/zknicl0518i1m0sh7f7yfk0dby6dsv3q-all-cabal-hashes-component-data-fix-0.3.0.drv' failed with exit code 2
cannot build derivation '/nix/store/9h8v1aia6ak6fb29ljc356aissz0rzbz-cabal2nix-data-fix-0.3.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/9h8v1aia6ak6fb29ljc356aissz0rzbz-cabal2nix-data-fix-0.3.0.drv' failed
(use '--show-trace' to show detailed location information)

Any ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, it means that Nixpkgs does not imported/updated Hackage revision information into the system.

Seems like callHackageDirect should be used.

I am looking into it, you also can look into haskell-modules/make-package-set.nix to understand this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like callHackageDirect should be used.

Do you mean this?

--- a/default.nix
+++ b/default.nix
@@ -215,17 +215,11 @@ let
 
       # 2020-07-23 hnix uses multiple functions that are unavailable in
       # data-fix < 0.3.
-      data-fix = haskellPackages.callPackage
-       ({ mkDerivation, base, deepseq, hashable, stdenv }:
-        mkDerivation {
-          pname = "data-fix";
-          version = "0.3.0";
-          sha256 = "9e59b3ed694b5139316093b3767842e60ad4821858459e7cd763e5773dfa99a0";
-          libraryHaskellDepends = [ base deepseq hashable ];
-          homepage = "https://github.com/spell-music/data-fix";
-          description = "Fixpoint data types";
-          license = stdenv.lib.licenses.bsd3;
-        }) {};
+      data-fix = haskellPackages.callHackageDirect {
+        pkg = "data-fix";
+        ver = "0.3.0";
+        sha256 = "9e59b3ed694b5139316093b3767842e60ad4821858459e7cd763e5773dfa99a0";
+      } {};
     };
 
     modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {

That produces a different error:

$ nix-build --argstr compiler ghc883 --arg buildFromSdist true
building '/nix/store/dkf1vxj712fmq58wjl03vw2px39n36dk-cabal2nix-hnix.drv'...
installing
building '/nix/store/widy86ykjxr8mviq5c9kkj4alvcgnq4i-source.drv'...

trying http://hackage.haskell.org/package/data-fix-0.3.0/data-fix-0.3.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5516  100  5516    0     0  61977      0 --:--:-- --:--:-- --:--:-- 61288
unpacking source archive /tmp/nix-build-source.drv-0/data-fix-0.3.0.tar.gz
hash mismatch in fixed-output derivation '/nix/store/cg310v82g2pnmi6gyp2dhd544jdnxhcj-source':
  wanted: sha256:184rz8ypgrb3sxy9wiaq321d82p689w7dcwkc0qkjlabd7nv6ncy
  got:    sha256:1w3z4fa28zxqwgsynlz025rkmrdcv7bj66031l502nc3x3yfljn6
cannot build derivation '/nix/store/khmfa7xv97fbziibldgi120dccjfkxqj-cabal2nix-data-fix.drv': 1 dependencies couldn't be built
error: build of '/nix/store/khmfa7xv97fbziibldgi120dccjfkxqj-cabal2nix-data-fix.drv' failed
(use '--show-trace' to show detailed location information)

Copy link
Collaborator

@Anton-Latukha Anton-Latukha Jul 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

      data-fix = haskellPackages.callHackageDirect {
        pkg = "dafa-fix";
        ver = "0.3.0";
        sha256 = "184rz8ypgrb3sxy9wiaq321d82p689w7dcwkc0qkjlabd7nv6ncy";
      };

Did not work, nor self.callHackageDirect.

With cryptic:

building '/nix/store/zk6fk22k39h6nprx99qsmysrgnbhf11i-cabal2nix-hnix.drv'...
installing
error: 'callHackageDirect' at /nix/store/5cbvaaalcqj2cczgvp122h4w2sms79jn-nixos-20.09pre235279.5717d9d2f7c/nixos/pkgs/development/haskell-modules/make-package-set.nix:193:25 called with unexpected argument 'pname', at /home/pyro/src/haskell/hnix/default.nix:218:18
(use '--show-trace' to show detailed location information)

We can develop override to more modern Hackage etc.

Lets do not get in the weeds further for this.


At this point I think - lets merge it as you presented it working, and move forward - it is a temporary change and we can and would rehash it in any case.

@sjakobi
Copy link
Member Author

sjakobi commented Jul 23, 2020

BTW I wish it was a bit easier to stay compatible with data-fix-0.2, but the deprecation of ana, cata etc. makes this somewhat uncomfortable.

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Jul 23, 2020

Well, lets do not worry about reverse compatibility now. I would restate that breakages following latest releases is the strong point of HNix now, we must break often, so the use of the unfinished product would not spread.

If we would support old versions - the use would spread and that would put too much uninvited and unmet responsibility on our shoulders, we would need to keep supporting everyone and being stable and somehow transform the project at the same time - it is a contradictory situation nor we nor project are not ready to take on.

Good example is Nixpkgs, where structural changes are much needed, but they are not possible to migrate to, because too many people deployed and rely on NixOS in business, Nixpkgs is very long-term play, and people started using it too quickly in business deployments when it is still raw.

Remember what the Haskell motto talks about, it fits perfectly currently.

@sjakobi
Copy link
Member Author

sjakobi commented Jul 23, 2020

Tight version constraints like these can be rather painful for downstream users. I've experienced that often enough, and I don't want to inflict this pain unnecessarily. In this case a compatible solution just seemed too complex.

@Anton-Latukha Anton-Latukha self-requested a review July 23, 2020 13:16
@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Jul 23, 2020

That is what I am talking about.

The more HNix spreads and more widely used, especially when people start to try to build business infrastructures on it - the more not readiness of the project spreads suffering, and development breakages would be more painful for downstream and for us. If we have no or minimal downstream - we have less unused baggage to drag when we move forward.

That the HNix is not deployed - is a strong point.

We are interested in growing the enthusiasts and hobbyist around the project currently, they do not care much for stability. They even may not use HNix at all, and work on the code in the project, just being Haskell devs interested to work in the project, moving Nix into Haskell, or Nix users interested in this as a project.

We need to attract enthusiasts and scare away users until we consider the project is ready for deployments, use and we ready to support it all.

We are an experiment lab project that needs more scientists, we are not production-ready, HNix has strong side-effects we not treated, studied or aware, so giving-out this state of the product to the public market is...

We need as few users as possible and as much scientists as possible to work in the project.

Breakages prevent users, and or do not interfere with scientific interests and even attract active developers to come into the project. Also, new shiny things (bleeding-edge extreme development and technologies, ideas) attract enthusiasts, even if the shiny thing does not work.

@Anton-Latukha Anton-Latukha merged commit 5403028 into master Jul 24, 2020
@sjakobi sjakobi deleted the sjakobi/data-fix-0.3 branch July 24, 2020 12:38
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.

2 participants