Nix & Haskell

Creating shell.nix

$ nix-shell -p cabal2nix
[nix-shell:~/Werk/foo]$ cabal2nix --shell . > shell.nix

Running tests

[nix-shell:~/Werk/sfoo]$ runhaskell -isrc -itest test/Spec.hs 

Building

$ cabal2nix . > default.nix
$ echo "let pkgs = import <nixpkgs> {}; in pkgs.haskellPackages.callPackage ./default.nix {}" > build.nix
$ nix-build build.nix
$ ./result/bin/foo

For disabling tests in dependencies, I added the following to ~/.nixpkgs/config.nix:

{
  packageOverrides = super: let self = super.pkgs; in
  {
    noTestsHaskellPackages = self.haskellPackages.override {
      overrides = self: super: {
        mkDerivation = args: super.mkDerivation (args // {
          doCheck = false;
        });
      };
    };
  };
}
 
0
Kudos
 
0
Kudos

Now read this

Lucid: Conditional rendering

I have a form written in Lucid and I need to add a prompt to the user based on some condition: someForm :: Bool -> Html () someForm condition = body_ $ ... renderIfCondition where renderIfCondition | condition = div_ $ p_ [] "Some... Continue →