get working flake

This commit is contained in:
nek0 2022-12-01 19:56:25 +01:00
parent efbb9b4c5e
commit 5bef189c30
2 changed files with 61 additions and 49 deletions

View file

@ -127,12 +127,11 @@ executable example00
ghc-options: -threaded -Wall ghc-options: -threaded -Wall
default-language: Haskell2010 default-language: Haskell2010
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 >= 2.5 , sdl2 >= 2.5
, stm , stm
else if !flag(examples)
buildable: False buildable: False
-- A small game of life implementation -- A small game of life implementation
@ -143,7 +142,6 @@ executable example01
ghc-options: -threaded -Wall ghc-options: -threaded -Wall
default-language: Haskell2010 default-language: Haskell2010
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 >= 2.5 , sdl2 >= 2.5
@ -155,7 +153,7 @@ executable example01
, matrix , matrix
, nanovg >= 0.6.0.0 , nanovg >= 0.6.0.0
, deepseq , deepseq
else if !flag(examples)
buildable: False buildable: False
-- Another small game of life implementation -- Another small game of life implementation
@ -166,7 +164,6 @@ executable example02
ghc-options: -threaded -Wall ghc-options: -threaded -Wall
default-language: Haskell2010 default-language: Haskell2010
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 >= 2.5 , sdl2 >= 2.5
@ -178,5 +175,5 @@ executable example02
, matrix , matrix
, nanovg >= 0.6.0.0 , nanovg >= 0.6.0.0
, deepseq , deepseq
else if !flag(examples)
buildable: False buildable: False

View file

@ -19,28 +19,43 @@
packageName = "affection"; packageName = "affection";
in rec { in rec {
packages.${packageName} = # (ref:haskell-package-def) packages.${packageName} = # (ref:haskell-package-def)
haskellPackages.callCabal2nixWithOptions packageName self "--flag examples" rec { haskellPackages.callCabal2nixWithOptions packageName self "--flag examples" {
# Dependency overrides go here # Dependency overrides go here
}; };
defaultPackage = self.packages.${system}.${packageName}; defaultPackage = self.packages.${system}.${packageName};
devShell = defaultPackage.env; apps = {
#devShell = pkgs.mkShell { example00 = {
# buildInputs = with haskellPackages; [ type = "app";
# haskell-language-server program = "${self.packages.${system}.${packageName}}/bin/example00";
# ghcid };
# cabal-install example01 = {
# ]; type = "app";
# nativeBuildInputs = with pkgs; [ program = "${self.packages.${system}.${packageName}}/bin/example01";
# pkg-config };
# glib example02 = {
# SDL2 type = "app";
# freetype program = "${self.packages.${system}.${packageName}}/bin/example02";
# glew };
# ]; };
# inputsFrom = builtins.attrValues self.packages.${system};
#}; #devShell = packages.${packageName}.env;
devShell = pkgs.mkShell {
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
];
nativeBuildInputs = with pkgs; [
pkg-config
glib
SDL2
freetype
glew
];
inputsFrom = builtins.attrValues self.packages.${system};
};
}); });
} }