trying to make nix expressions
This commit is contained in:
parent
bda77139a8
commit
94cc683134
4 changed files with 79 additions and 1 deletions
21
default.nix
Normal file
21
default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ compiler ? "ghc822" }:
|
||||
let
|
||||
config = {
|
||||
packageOverrides = pkgs: with pkgs.haskell.lib; {
|
||||
haskell = pkgs.haskell // {
|
||||
packages = pkgs.haskell.packages // {
|
||||
${compiler} = pkgs.haskell.packages.${compiler}.override {
|
||||
overrides = self: super: rec {
|
||||
nanovg =
|
||||
buildStrictly (self.callPackage ../nanovg-hs/nanovg.nix {});
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
let
|
||||
pkgs = import <nixpkgs> { inherit config; };
|
||||
nanovg = pkgs.haskell.packages.${compiler}.nanovg;
|
||||
in { inherit nanovg; }
|
|
@ -52,6 +52,7 @@ executable haskelloids
|
|||
main-is: Main.hs
|
||||
ghc-options: -Wall
|
||||
extra-libraries: GLEW
|
||||
pkgconfig-depends: glew
|
||||
|
||||
-- Modules included in this executable, other than Main.
|
||||
other-modules: Types
|
||||
|
|
17
haskelloids.nix
Normal file
17
haskelloids.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ mkDerivation, affection, base, containers, glew, linear
|
||||
, nanovg, OpenGL, random, sdl2, stdenv, stm
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "haskelloids";
|
||||
version = "0.0.0.1";
|
||||
src = ./.;
|
||||
isLibrary = false;
|
||||
isExecutable = true;
|
||||
executableHaskellDepends = [
|
||||
affection base containers linear nanovg OpenGL random sdl2 stm
|
||||
];
|
||||
executableSystemDepends = [ glew ];
|
||||
executablePkgconfigDepends = [ glew sdl2 ];
|
||||
description = "A little game using Affection";
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
}
|
39
shell.nix
Normal file
39
shell.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ nixpkgs ? import <nixpkgs> {}
|
||||
, compiler ? "default"
|
||||
, doBenchmark ? false
|
||||
, nanovg
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
inherit (nixpkgs) pkgs;
|
||||
|
||||
f = { mkDerivation, affection, base, containers, glew
|
||||
, linear, nanovg, OpenGL, random, sdl2, stdenv, stm
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "haskelloids";
|
||||
version = "0.0.0.1";
|
||||
src = ./.;
|
||||
isLibrary = false;
|
||||
isExecutable = true;
|
||||
executableHaskellDepends = [
|
||||
affection base containers linear nanovg OpenGL random sdl2 stm
|
||||
];
|
||||
executableSystemDepends = [ glew ];
|
||||
executablePkgconfigDepends = [ glew ];
|
||||
description = "A little game using Affection";
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
};
|
||||
|
||||
haskellPackages = if compiler == "default"
|
||||
then pkgs.haskellPackages
|
||||
else pkgs.haskell.packages.${compiler};
|
||||
|
||||
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
|
||||
|
||||
drv = variant (haskellPackages.callPackage f {});
|
||||
|
||||
in
|
||||
|
||||
if pkgs.lib.inNixShell then drv.env else drv
|
Loading…
Reference in a new issue