From ca5de24eac40449b541fd15b33df74ac24620fd2 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 6 May 2019 17:44:14 +0200 Subject: [PATCH] Add .cabal file; better, hopefully purer shell.nix --- .envrc | 1 + .gitignore | 1 + all-hies.cabal | 23 +++++++++++++++++++++++ shell.nix | 28 ++++++---------------------- update.hs | 2 +- 5 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 .envrc create mode 100644 all-hies.cabal diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4a4726a --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_nix diff --git a/.gitignore b/.gitignore index fcfc4a1..3ed74cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result* +dist diff --git a/all-hies.cabal b/all-hies.cabal new file mode 100644 index 0000000..cef7dd5 --- /dev/null +++ b/all-hies.cabal @@ -0,0 +1,23 @@ +cabal-version: 2.4 +name: all-hies +version: 0.1.0.0 +author: Silvan Mosberger +maintainer: infinisil@icloud.com + +executable update + main-is: update.hs + build-depends: base ^>=4.12.0.0 + , haskeline + , process + , regex-applicative + , directory + , filepath + , stack2nix + , http-client + , http-client-tls + , time + , aeson + , mtl + , bytestring + , Cabal + default-language: Haskell2010 diff --git a/shell.nix b/shell.nix index c435b05..0fdab67 100644 --- a/shell.nix +++ b/shell.nix @@ -1,25 +1,9 @@ { pkgs ? import ./nixpkgs.nix }: - -let - ghcWithPkgs = pkgs.haskellPackages.ghcWithPackages (p: with p; [ - directory - filepath - process - http-client - http-client-tls - aeson - regex-applicative - haskeline - stack2nix - cabal-install - ]); -in - -pkgs.mkShell { - buildInputs = with pkgs; [ - ghcWithPkgs - git - nix-prefetch-scripts +(pkgs.haskellPackages.callCabal2nix "all-hies" ./. {}).env.overrideAttrs (old: { + nativeBuildInputs = old.nativeBuildInputs or [] ++ [ + pkgs.nix-prefetch-scripts + pkgs.git + pkgs.haskellPackages.cabal-install ]; -} +}) diff --git a/update.hs b/update.hs index c3bd68a..c5e44e1 100755 --- a/update.hs +++ b/update.hs @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i runhaskell shell.nix +#!nix-shell --pure -i runhaskell shell.nix {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-}