From 9b7ec300bfaf9485f7822828f5458322560e623c Mon Sep 17 00:00:00 2001 From: Yvan Sraka Date: Sun, 2 May 2021 23:01:10 +0200 Subject: [PATCH] Setup direnv with `use nix` for haskell stack --- .envrc | 1 + .gitignore | 3 ++- shell.nix | 8 ++++++ stack.yaml | 68 ++++++++++++++++--------------------------------- stack.yaml.lock | 24 +++++++++++++---- 5 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index 5db8f6c..82bef2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ _cache/ _site/ -.stack-work/ .DS_Store +.direnv/ +.stack-work/ diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..e850203 --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +{ pkgs ? import { }, ghc ? pkgs.ghc }: +pkgs.haskell.lib.buildStackProject { + name = "newtype.fr"; + inherit ghc; + buildInputs = with pkgs; [ zlib ]; + LANG = "en_US.UTF-8"; + TMPDIR = "/tmp"; +} diff --git a/stack.yaml b/stack.yaml index f85862d..feb51cf 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,66 +1,42 @@ -# This file was automatically generated by 'stack init' -# -# Some commonly used options have been documented as comments in this file. -# For advanced use and comprehensive documentation of the format, please see: -# https://docs.haskellstack.org/en/stable/yaml_configuration/ +# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html -# Resolver to choose a 'specific' stackage snapshot or a compiler version. -# A snapshot resolver dictates the compiler version and the set of packages -# to be used for project dependencies. For example: -# -# resolver: lts-3.5 -# resolver: nightly-2015-09-21 -# resolver: ghc-7.10.2 -# -# The location of a snapshot can be provided as a file or url. Stack assumes -# a snapshot provided as a file might change, whereas a url resource does not. -# -# resolver: ./custom-snapshot.yaml -# resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: nightly-2020-05-06 +# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) +resolver: lts-17.14 -# User packages to be built. -# Various formats can be used as shown in the example below. -# -# packages: -# - some-directory -# - https://example.com/foo/bar/baz-0.0.2.tar.gz -# subdirs: -# - auto-update -# - wai +# Local packages, usually specified by relative directory name packages: -- . -# Dependency packages to be pulled from upstream that are not in the resolver. -# These entries can reference officially published versions as well as -# forks / in-progress versions pinned to a git hash. For example: -# -# extra-deps: -# - acme-missiles-0.3 -# - git: https://github.com/commercialhaskell/stack.git -# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# -# extra-deps: [] +- '.' + +# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) +extra-deps: +- hakyll-4.13.4.1@sha256:af3096c611bcb164143df2d9543e88f1eaabe76e8f0261423aff8382f10368c3 +- pandoc-citeproc-0.17.0.2@sha256:39c5c60a5eca2c1cb50ae9a00dc7093ca1baac78ad5be4e222505de257dce456 # Override default flag values for local packages and extra-deps -# flags: {} +flags: {} # Extra package databases containing global packages -# extra-package-dbs: [] +extra-package-dbs: [] # Control whether we use the GHC we find on the path # system-ghc: true -# + # Require a specific version of stack, using version ranges # require-stack-version: -any # Default -# require-stack-version: ">=2.1" -# +# require-stack-version: >= 1.0.0 + # Override the architecture used by stack, especially useful on Windows # arch: i386 # arch: x86_64 -# + # Extra directories used by stack for building # extra-include-dirs: [/path/to/dir] # extra-lib-dirs: [/path/to/dir] -# + # Allow a newer minor version of GHC than the snapshot specifies # compiler-check: newer-minor + +nix: + enable: true + pure: true + shell-file: shell.nix diff --git a/stack.yaml.lock b/stack.yaml.lock index a0c3d08..cffdcb9 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -3,10 +3,24 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/lock_files -packages: [] +packages: +- completed: + hackage: hakyll-4.13.4.1@sha256:af3096c611bcb164143df2d9543e88f1eaabe76e8f0261423aff8382f10368c3,9212 + pantry-tree: + size: 7842 + sha256: 2cf57f61b0eb6f30beb01f78a65078138bfee0e4a4d8b6630ac4ddd91c7de6db + original: + hackage: hakyll-4.13.4.1@sha256:af3096c611bcb164143df2d9543e88f1eaabe76e8f0261423aff8382f10368c3 +- completed: + hackage: pandoc-citeproc-0.17.0.2@sha256:39c5c60a5eca2c1cb50ae9a00dc7093ca1baac78ad5be4e222505de257dce456,8737 + pantry-tree: + size: 25684 + sha256: 8a5f6398d750902d79c215a4c8f85c74f3e7ea572dd1f950d57e784669ac7a48 + original: + hackage: pandoc-citeproc-0.17.0.2@sha256:39c5c60a5eca2c1cb50ae9a00dc7093ca1baac78ad5be4e222505de257dce456 snapshots: - completed: - size: 521183 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2020/5/6.yaml - sha256: 8f91f3cd1ba1a7e0d478773969dc64236c76d8b0231e8ca3e0550f0593c15f57 - original: nightly-2020-05-06 + size: 567677 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/14.yaml + sha256: 3740f22286bf5e6e3d82f88125e1c708b6e27847211f956b530aa5d83cf39383 + original: lts-17.14