Skip to content

Commit

Permalink
Merge pull request #415 from PierreR/master
Browse files Browse the repository at this point in the history
Build with ghc-8.2.2 using Nix
  • Loading branch information
colonelpanic8 committed Sep 17, 2018
2 parents 09c600c + 065975b commit 316ff1e
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
.stack-work
.cabal-sandbox
cabal.sandbox.config
/result
39 changes: 39 additions & 0 deletions default.nix
@@ -0,0 +1,39 @@
# You can build this repository by running:
# $ nix-build

{
pkgs_path ? ./nix/nixpkgs.nix
, compiler ? "ghc822"
}:

let
overlay = import ./nix/overlay.nix;
pkgs = import pkgs_path {
config = {};
overlays = [ overlay ];
};
filter = import ./nix/filter.nix {inherit (pkgs)lib;};
haskellPackages = pkgs.haskell.packages.${compiler}.override {
overrides = self: super: {
taffybar = with pkgs.haskell.lib;
(addPkgconfigDepend (disableLibraryProfiling (dontCheck (dontHaddock
( pkgs.haskell.packages.${compiler}.callCabal2nix
"taffybar"
(builtins.path { name = "taffybar"; inherit filter; path = ./.; } )
{ }
)))) pkgs.gtk3);
};
};
ghcWithTaffybar = haskellPackages.ghcWithPackages (p: with p; [taffybar]);

in

pkgs.stdenv.mkDerivation {
name = "taffy-ghc-env";
nativeBuildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
makeWrapper ${ghcWithTaffybar}/bin/taffybar $out/bin/taffybar \
--set NIX_GHC "${ghcWithTaffybar}/bin/ghc"
'';
}
7 changes: 7 additions & 0 deletions nix/.nixpkgs.json
@@ -0,0 +1,7 @@
{
"url": "https://github.com/nixos/nixpkgs.git",
"rev": "903306a74d31542935f6cd32758d5df2359b3b98",
"date": "2018-08-23T09:40:12+02:00",
"sha256": "1wlch8lfc1x5xawqc630mg9n5586yv4d1nnvzcm95gq0yq779y97",
"fetchSubmodules": true
}
17 changes: 17 additions & 0 deletions nix/filter.nix
@@ -0,0 +1,17 @@
# Filter source files that are not part of the build
{ lib }:

path: type:

let
baseName = baseNameOf (toString path);
in
type != "symlink"
&& baseName != ".stack-work"
&& baseName != ".git"
&& baseName != "default.nix"
&& baseName != "README.md"
&& baseName != "CHANGELOG.md"
&& baseName != "Dockerfile"
&& baseName != "Dockerfile.base"
&& ! lib.hasSuffix ".example" baseName
7 changes: 7 additions & 0 deletions nix/nixpkgs.nix
@@ -0,0 +1,7 @@
let
nixpkgs = builtins.fromJSON (builtins.readFile ./.nixpkgs.json);
in
import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgs.rev}.tar.gz";
inherit (nixpkgs) sha256;
})
10 changes: 10 additions & 0 deletions nix/overlay.nix
@@ -0,0 +1,10 @@
self: super:

{
haskell = super.haskell // { packages = super.haskell.packages // { ghc822 = super.haskell.packages.ghc822.override {
overrides = hpkgs: _: {
haskell-gi-overloading = hpkgs.haskell-gi-overloading_0_0;
};
};};};

}
55 changes: 55 additions & 0 deletions stack-11.22.yaml
@@ -0,0 +1,55 @@
packages:
- '.'
extra-deps:
- X11-xft-0.3.1
- dbus-1.0.1
- dbus-hslogger-0.1.0.1
- gi-dbusmenu-0.4.1
- gi-dbusmenugtk3-0.4.1
- gi-gdk-3.0.15
- gi-gdkpixbuf-2.0.16
- gi-gdkx11-3.0.2
- gi-gio-2.0.18
- gi-gtk-3.0.21
- gi-gtk-hs-0.3.6.1
- gi-glib-2.0.17
- gi-pango-1.0.16
- gi-xlib-2.0.2
- gio-0.13.4.1
- gtk-sni-tray-0.1.5.0
- gtk-strut-0.1.2.1
- gtk-traymanager-1.0.1
- gtk3-0.14.9
- haskell-gi-0.21.2
- haskell-gi-base-0.21.1
- libxml-sax-0.7.5
- rate-limit-1.1.1
- spool-0.1
- status-notifier-item-0.3.0.0
- time-units-1.0.0
- xml-helpers-1.0.0
resolver: lts-11.22
allow-newer: true
system-ghc: true
skip-ghc-check: true
nix:
enable: true
packages:
- cairo
- gcc
- gnome2.pango
- gobjectIntrospection
- gtk3
- hicolor-icon-theme
- libdbusmenu-glib
- libdbusmenu-gtk3
- libxml2
- numix-icon-theme-circle
- pkgconfig
- x11
- xorg.libX11
- xorg.libXext
- xorg.libXinerama
- xorg.libXrandr
- xorg.libXrender
- zlib
2 changes: 1 addition & 1 deletion stack.yaml

0 comments on commit 316ff1e

Please sign in to comment.