1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-14 06:59:43 +01:00

Simplify Stack Nix integration

Let Stack generate the nix-shell internally instead of writing it
manually.
This commit is contained in:
Bart Schuurmans 2023-01-17 10:53:52 +01:00 committed by fkm3
parent d088e30b80
commit ed445a76a4
5 changed files with 4 additions and 61 deletions

View file

@ -126,19 +126,11 @@ After running the script to install system dependencies, build the project with
## Build on NixOS
The `shell.nix` provides an environment containing the necessary
The `stack.yaml` file describes a NixOS environment containing the necessary
dependencies. To build, run:
$ stack --nix build
or alternatively you can run
$ nix-shell
to enter the environment and build the project. Note, that it is an emulation
of common Linux environment rather than full-featured Nix package expression.
No exportable Nix package will appear, but local development is possible.
## Installation on CentOS
[Xiaokui Shu (@subbyte)](https://github.com/subbyte) maintains [separate instructions for installation on CentOS](https://github.com/subbyte/haskell-learn/blob/master/tensorflow_setup.md).

View file

@ -1,6 +0,0 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8731aaaf8b30888bc24994096db830993090d7c4",
"sha256": "1hcc89rxi47nb0mpk05nl9rbbb04kfw97xfydhpmmgh57yrp3zqa"
}

View file

@ -1,26 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nix curl jq
# vim: filetype=sh
# Updates the nixpkgs.json to the latest release
# See https://gist.github.com/zimbatm/de5350245874361762b6a4dfe5366530
set -euo pipefail
cd "$(dirname "$0")" || exit 1
branch=release-19.09
owner=NixOS
repo=nixpkgs
rev=$(curl -sfL https://api.github.com/repos/$owner/$repo/git/refs/heads/$branch | jq -r .object.sha)
url=https://github.com/$owner/$repo/archive/$rev.tar.gz
release_sha256=$(nix-prefetch-url --unpack "$url")
cat <<NIXPKGS | tee src.json
{
"owner": "$owner",
"repo": "$repo",
"rev": "$rev",
"sha256": "$release_sha256"
}
NIXPKGS

View file

@ -1,19 +0,0 @@
{ghc ? null }:
let
# Use pinned packages
nixpkgs = with (builtins.fromJSON (builtins.readFile ./nix/src.json));
builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
inherit sha256;
};
pkgs = import nixpkgs {};
in
pkgs.haskell.lib.buildStackProject {
# Either use specified GHC or use GHC 8.6.5 (which we need for LTS 14.4)
ghc = if isNull ghc then pkgs.haskell.compiler.ghc865 else ghc;
extraArgs = "--system-ghc";
name = "tf-env";
buildInputs = with pkgs; [ snappy zlib protobuf libtensorflow ];
}

View file

@ -27,4 +27,6 @@ extra-include-dirs:
nix:
enable: false
shell-file: shell.nix
# release-19.09 with libtensorflow 1.14.0
path: ["nixpkgs=https://github.com/NixOS/nixpkgs/archive/8731aaaf8b30888bc24994096db830993090d7c4.tar.gz"]
packages: [snappy, zlib, protobuf, libtensorflow]