-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathflake.nix
69 lines (58 loc) · 1.9 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, utils, flake-compat }:
utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in with pkgs;
let
inherit (lib) optional optionals;
basePackages = [
git
libxml2
openssl
zlib
curl
libiconv
docker-compose
postgresql_13
] ++ optional stdenv.isLinux inotify-tools ++ optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [
# For file_system on macOS.
CoreFoundation
CoreServices
]);
elixirPackages = [ beam.packages.erlangR26.elixir_1_15 ];
nodePackages = [ nodejs yarn ];
deployPackages = [ flyctl ];
# Decorative prompt override so we know when we're in a dev shell
baseHook = ''
export PS1="\[\e[1;33m\][dev]\[\e[1;34m\] \w $ \[\e[0m\]"
'';
elixirHook = ''
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export ERL_AFLAGS="-kernel shell_history enabled"
export ERL_LIBS="" # see https://elixirforum.com/t/compilation-warnings-clause-cannot-match-in-mix-and-otp-tutorial/25114/4
'';
nodeHook = ''
export NODE_BIN=$PWD/assets/node_modules/.bin
export PATH=$NODE_BIN:$PATH
'';
in {
devShell = with pkgs;
mkShell {
buildInputs = basePackages ++ elixirPackages ++ nodePackages
++ deployPackages;
shellHook = baseHook + elixirHook + nodeHook;
};
});
}