-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
41 lines (41 loc) · 1.43 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
{
# inspired by: https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications
description = "A Hello World in Haskell with a dependency and a devShell";
inputs = {
nixpkgs.url = "nixpkgs";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ (self.overlay system) ];
});
in
{
overlay = (system: final: prev: {
data-forced = final.haskellPackages.callPackage (import ./default.nix) {};
});
packages = forAllSystems (system: {
data-forced = nixpkgsFor.${system}.data-forced;
});
defaultPackage = forAllSystems (system: self.packages.${system}.data-forced);
checks = self.packages;
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
pkgs.haskellPackages.shellFor {
packages = p: [self.packages.${system}.data-forced];
withHoogle = true;
buildInputs = with pkgs.haskellPackages; [
haskell-language-server
cabal-install
pkgs.zlib
];
# Change the prompt to show that you are in a devShell
# shellHook = "export PS1='\\e[1;34mdev > \\e[0m'";
});
};
}