-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
72 lines (57 loc) · 2.31 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
{
description = "Nix-Flake-based development environment for hex2txt";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
elixir = pkgs.elixir;
elixir-ls = pkgs.elixir-ls;
next-ls = pkgs.next-ls;
lexical = pkgs.lexical;
node = pkgs.nodejs_20;
base-packages = [ elixir pkgs.git node pkgs.just ];
elixir-language-servers = [ elixir-ls next-ls lexical ];
base-scripts = [ ];
in {
# A stripped-down dev shell, for use in CI environments.
#
# Example usage:
#
# nix develop .#ci -c COMMAND
#
# This shell is faster to build than the default, because it doesn't
# include the Elixir language servers and other dependencies that are
# only useful for development.
devShells.ci =
pkgs.mkShell { packages = base-packages ++ base-scripts; };
devShells.default = pkgs.mkShell {
packages = base-packages ++ elixir-language-servers ++ base-scripts
++ pkgs.lib.optionals pkgs.stdenv.isLinux
(with pkgs; [ inotify-tools libnotify ])
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
pkgs.terminal-notifier
CoreFoundation
CoreServices
]);
shellHook = ''
export PATH=$PWD/assets/node_modules/.bin:$PATH
# Store configuration files and scripts used by Mix in this local directory.
mkdir -p .nix-shell/.mix
export MIX_HOME=$PWD/.nix-shell/.mix
export PATH=$MIX_HOME/bin:$PATH
export PATH=$MIX_HOME/escripts:$PATH
# Store cache and configuration files used by Hex in this local directory.
mkdir -p .nix-shell/.hex
export HEX_HOME=$PWD/.nix-shell/.hex
export PATH=$HEX_HOME/bin:$PATH
# Enable shell history for IEx.
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.nix-shell/.erlang-history\"'"
'';
};
});
}