Skip to content

Sandboxable stack.yaml Nix generator

License

Notifications You must be signed in to change notification settings

transumption/stack-to-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stack-to-nix

This is a handy nix function for building stack projects with nix, fully inside the nix sandbox. It parses the stack.yaml file and translates the dependencies into a series of fetchUrl, fetchGit calls.

Example

{ pkgs }:

let
  stackToNix = pkgs.callPackage (fetchTarball https://github.com/serokell/stack-to-nix/archive/master.tar.gz) { };
in
stackToNix {
  # root: the path with stack.yaml. you may want to filter this. for example using nix-gitignore.
  root = ./.;
  # shell: get the .env instead of the nix-build derivation. recommended that you do this with shell.nix/default.nix.
  # see https://github.com/DisciplinaOU/disciplina/blob/master/shell.nix
  shell = false;
  # you shouldn't need overrides, but you can ;)
  overrides = final: previous: with pkgs.haskell.lib; {
    qtah = overrideCabal previous.qtah (super: {
      libraryToolDepends = with pkgs.qt5; [ qtbase qttools ];
    });
  };
}

Problems

If you use this on a repo with git dependencies, you will need NixOS/nix#2409. It's in our patch set. nix-env -f https://github.com/serokell/serokell-closure/archive/master.tar.gz -iA nix

About

Sandboxable stack.yaml Nix generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •