-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
77 lines (67 loc) · 3.16 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
inputs = {
# Here you can adjust the IHP version of your project
# You can find new releases at https://github.com/digitallyinduced/ihp/releases
ihp.url = "github:digitallyinduced/ihp?ref=cafe4325b66f6364d91da23a392620527bd0be46";
ihp.flake = false;
# See https://ihp.digitallyinduced.com/Guide/package-management.html#nixpkgs-pinning
nixpkgs.url = "github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
};
outputs = { self, nixpkgs, devenv, systems, ihp, ... } @ inputs:
let
devenvConfig = { pkgs, ... }: {
# See full reference at https://devenv.sh/reference/options/
# For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html
# Enable IHP support in devenv.sh
imports = [ "${inputs.ihp}/NixSupport/devenv.nix" ];
ihp.enable = true;
ihp.projectPath = ./.;
ihp.haskellPackages = p: with p; [
# Haskell dependencies go here
p.ihp
cabal-install
base
wai
text
hlint
jwt
];
packages = with pkgs; [
# Native dependencies, e.g. imagemagick
imagemagick
nodejs
];
};
# Settings when running `nix build`
releaseEnv = pkgs: import "${ihp}/NixSupport/default.nix" {
ihp = ihp;
haskellDeps = (devenvConfig pkgs).ihp.haskellPackages;
otherDeps = p: (devenvConfig pkgs).packages;
projectPath = ./.;
# Dev tools are not needed in the release build
includeDevTools = false;
# Set optimized = true to get more optimized binaries, but slower build times
optimized = false;
};
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
# Dev shells are used for development, e.g. when running `nix develop --impure`
devShells = forEachSystem (system: {
default = let pkgs = nixpkgs.legacyPackages.${system}; in devenv.lib.mkShell {
inherit inputs pkgs;
modules = [devenvConfig];
};
});
# Binaries for deploying IHP apps. These are used by `nix build --impure`
defaultPackage = forEachSystem (system: releaseEnv nixpkgs.legacyPackages.${system});
};
# The following is needed to use the IHP binary cache.
# This binary cache provides binaries for all IHP packages and commonly used dependencies for all nixpkgs versions used by IHP.
nixConfig = {
extra-substituters = "https://digitallyinduced.cachix.org";
extra-trusted-public-keys = "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE=";
};
}