sebastiaanvisser / clay

A CSS preprocessor as embedded Haskell.
Other
357 stars 72 forks source link

Clay is broken on NixOS #184

Closed JonathanReeve closed 4 years ago

JonathanReeve commented 5 years ago

Forgive me if this isn't the right place to post this, but I'm trying to start a project that uses clay, but I can't, because the version in Nixpkgs won't build. I describe the issue here, but nixpkgs devs don't seem to think it's their responsibility to fix. Is there a way you can fix your package so that it plays nice with Nix/nixpkgs?

Also if you're good at Nix, and know a way I can simply replace the call to "clay" with a call to the GitHub version, that would be cool, too.

locallycompact commented 5 years ago

Is this project being maintained? I'd also like the version bounds for this fixed so it runs on NixOS. I'm happy to take ownership if the original author can not continue maintenance.

sebastiaanvisser commented 5 years ago

Hi, I’m the ‘original’ original author but others have taken over maintenance for a long time now and I haven’t been involved at all anymore. Not sure if anyone feels responsible right now. I can check if can add you to the project so you can try to fix the build issues on nix.

Haven’t used nix myself so can’t be of any help there.

locallycompact commented 5 years ago

Thanks, I'd appreciate that.

bsima commented 5 years ago

I'm also interested in this project. I was in the progress of writing a small CSS EDSL myself when I found this...

turion commented 5 years ago

@JonathanReeve My workaround is currently using haskell.lib.markUnbroken and haskell.lib.dontCheck, since hspec etc. are only needed for tests. The whole derivation looks something like this:

{ lotsOfInputs,
, haskell
}:
mkDerivation {
  pname = "foo";
  version = "0.1.0.0";
  src = ./.;
  executableHaskellDepends = [
    base (haskell.lib.markUnbroken (haskell.lib.dontCheck clay)) 
  ];
  license = stdenv.lib.licenses.bsd3;
}
kenranunderscore commented 4 years ago

@JonathanReeve I just found this via your (supposedly) SO post. I posted my answer there, but it might be of interest to @turion as well: Jailbreaking the clay package works as well (haskell.lib.doJailbreak). This way the tests will still run (successfully). (See here for what I did).

turion commented 4 years ago

Should be fixed soon after we've figured out a way how I can upload to hackage. (#189)

turion commented 4 years ago

Uploaded to hackage. This should fix it as soon as nixpkgs automatically downloads hackage again.

573 commented 4 years ago

@JonathanReeve My workaround is currently using haskell.lib.markUnbroken and haskell.lib.dontCheck, since hspec etc. are only needed for tests. The whole derivation looks something like this:

{ lotsOfInputs,
, haskell
}:
mkDerivation {
  pname = "foo";
  version = "0.1.0.0";
  src = ./.;
  executableHaskellDepends = [
    base (haskell.lib.markUnbroken (haskell.lib.dontCheck clay)) 
  ];
  license = stdenv.lib.licenses.bsd3;
}

I am trying to disable tests in clay as well as it breaks my build on WSL, see here for a tracking issue, but IDK how to do it correctly. Right now I have a file ~/.config/nixpkgs/program/neuron/default.nix which somewhere in my home.nix is imported as home.packages = with pkgs; [ (import ../program/neuron {}) ];:

~/.config/nixpkgs/program/neuron/default.nix
{ pkgs ? import <nixpkgs> {}, compiler ? "ghc881", ... }:
let
  neuron = import (builtins.fetchTarball "https://github.com/srid/neuron/tarball/c2dac59a37f8d00b539dac932ec96048aa1a9b3f") {};
in
pkgs.haskell.packages.${compiler}.callPackage neuron
    {   clay =
            let clay = pkgs.haskell.packages.${compiler}.clay;
            in pkgs.haskell.lib.markUnbroken (pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.doJailbreak clay));
    }

but doesn't seem to affect my build:

Linking dist/build/Test-Clay/Test-Clay ... running tests Running 1 test suites... Test suite Test-Clay: RUNNING... Test-Clay: clock_getres: invalid argument (Invalid argument) Test suite Test-Clay: FAIL Test suite logged to: dist/test/clay-0.14.0-Test-Clay.log 0 of 1 test suites (0 of 1 test cases) passed. killing process 5326: No such process builder for '/nix/store/gvr0hyc91q82aqlvlnk48pc74cva8y6k-clay-0.14.0.drv' failed with exit code 1 cannot build derivation '/nix/store/1y882mhn0ih6anxfw41x5imiddprvasq-neuron-0.1.0.0.drv': 1 dependencies couldn't be built error: build of '/nix/store/1y882mhn0ih6anxfw41x5imiddprvasq-neuron-0.1.0.0.drv' failed

turion commented 4 years ago

@573 this issue is fixed since quite some time. If you update your nixpkgs, you won't need a workaround, I think.

srid commented 4 years ago

pkgs.haskell.packages.${compiler}.callPackage neuron

This is the problem. Don't use callPackage. Use import instead, so that neuron and rib will use whatever version of clay they have pinned. But you really should be nuking all your Nix code related to neuron and replace that with a one liner: https://neuron.srid.ca/2012401.html

turion commented 4 years ago

@573 Also, your issue is certainly not the issue here, since you're using the unreleased version 0.14.

(Weirdly, the test suite passed on CI: https://travis-ci.org/github/sebastiaanvisser/clay/jobs/648076565#L660)

srid commented 4 years ago

@turion It looks like clay tests fail only on Windows Subsystem for Linux, which is what @573 is using to install neuron which uses rib that has clay 0.14 pinned.

turion commented 4 years ago

@srid, thanks! That's why I can't reproduce these issues. I guess I'm not going support WSL in clay for the time being.

rubenmoor commented 3 years ago

Clay is still marked broken in the version 0.13.1, as available on nixos 20.09.

I could fix this in a very straightforward way by overriding clay in my default.nix:

  clay = self.callHackage "clay" "0.13.3" {};