Skip to content

Commit

Permalink
Merge pull request #101 from cdepillabout/get-stack-working-with-buil…
Browse files Browse the repository at this point in the history
…dFHSUserEnv

Get stack working with buildFHSUserEnv on NixOS
  • Loading branch information
cdepillabout authored Jan 2, 2019
2 parents 14ea2db + c4df6cc commit db185e3
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 3 deletions.
75 changes: 75 additions & 0 deletions .nix-helpers/stack-fhs-env.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This is a nix derivation that gives us a `stack` binary that will run in a
# chroot. This is needed to workaround
# https://github.com/cdepillabout/termonad/issues/99.
#
# This is nice to use if you're having trouble running `stack` on nixos
# normally. It generally shouldn't be needed any other time.
#
# You can use this by starting a `nix-shell` with it:
#
# $ nix-shell --pure .nix-helpers/stack-fhs-env.nix
#
# From here, you can run `stack` normally.

let
# recent version of nixpkgs master as of 2018-12-23
nixpkgsTarball = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c31c0558ddad7161a4025117694197264cda9750.tar.gz";
sha256 = "09xl8fshyyddcm5nw5fkl6fbjlh5szjcdm43ii6jsvykdr516ghp";
};

# Additional packages or fixes for individual packages.
pkgOverlay = self: pkgs: {
fhsStack =
self.buildFHSUserEnv {
name = "stack";
runScript = "stack";
targetPkgs = _: with self; [
binutils
cairo
ghc
git
gnome3.atk
gnome3.gdk_pixbuf
gnome3.glib
gnome3.gtk
gnome3.vte
gnutls
gobjectIntrospection
gtk3
haskell.compiler.ghc863
iana-etc
pango
pcre2
pkgconfig
stack
zlib
] ++
self.stdenv.lib.optional
(self.stdenv.hostPlatform.libc == "glibc")
self.glibcLocales;
profile = ''
export STACK_IN_NIX_SHELL=1
export GI_TYPELIB_PATH=/usr/lib/girepository-1.0
'';
extraOutputsToInstall = ["dev"];
};
};

nixpkgs = import nixpkgsTarball {
overlays = [
pkgOverlay
];
};

in

with nixpkgs;

mkShell {
buildInputs = [
fhsStack
gitAndTools.gitFull
gitAndTools.hub
];
}
File renamed without changes.
2 changes: 1 addition & 1 deletion stack-lts-12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ extra-package-dbs: []
nix:
packages: []
pure: true
shell-file: .nix-helpers/stack-nix-shell.nix
shell-file: .nix-helpers/stack-shell.nix
2 changes: 1 addition & 1 deletion stack-lts-13.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ extra-package-dbs: []
nix:
packages: []
pure: true
shell-file: .nix-helpers/stack-nix-shell.nix
shell-file: .nix-helpers/stack-shell.nix
3 changes: 2 additions & 1 deletion termonad.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ extra-source-files: README.md
, img/termonad.png
, .nix-helpers/nixops.nix
, .nix-helpers/nixpkgs.nix
, .nix-helpers/stack-nix-shell.nix
, .nix-helpers/stack-fhs-env.nix
, .nix-helpers/stack-shell.nix
, .nix-helpers/termonad-with-packages.nix
, shell.nix
data-files: img/termonad-lambda.png
Expand Down

0 comments on commit db185e3

Please sign in to comment.