-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathflake.nix
58 lines (56 loc) · 1.98 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
# inspired by: https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications
description = "explore hvega and IHaskell";
inputs = {
nixpkgs.url = "nixpkgs";
# IHaskell.url = "github:IHaskell/IHaskell";
};
# outputs = { self, nixpkgs, IHaskell }:
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
# supportedSystems = [ "x86_64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = (final: prev: {
hvega = final.haskellPackages.callCabal2nix "hvega" ./hvega {};
ihaskell-hvega = final.haskellPackages.callCabal2nix "ihaskell-hvega" ./ihaskell-hvega {};
});
packages = forAllSystems (system: {
hvega = nixpkgsFor.${system}.hvega;
ihaskell-hvega = nixpkgsFor.${system}.ihaskell-hvega;
});
# what do we want for the defaultPackage here?
defaultPackage = forAllSystems (system: self.packages.${system}.hvega);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.hvega
self.packages.${system}.ihaskell-hvega];
# withHoogle = true;
withHoogle = false; # faster ...
buildInputs = with haskellPackages; [
haskell-language-server
hlint
cabal-install
ihaskell
nixpkgsFor.${system}.jupyter
];
# Change the prompt to show that you are in a devShell
shellHook = ''
echo -e "*** \e[1;32mWelcome to hvega development\e[0m ***"
ghc --version
cabal --version
hlint --version
echo -e "IHaskell: `ihaskell --version`"
echo -e ""
export PS1='hvegadev:\A \e[1;34m\w\e[0m '
'';
});
};
}