-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
shell.nix
71 lines (57 loc) · 2.12 KB
/
shell.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
# Using a fixed nix commit for maximum reproducability
{ pkgs ? import <nixpkgs> {
config.allowUnfree = true;
config.allowBroken = true;
}
, ci ? false}:
let
clipiousNix = import ./nix/clipious.nix {
ci = ci;
pkgs = pkgs;
};
aliases = [
{
name = "build-runner";
command = "dart run build_runner build --delete-conflicting-outputs";
description = "Run code generation once";
}
{
name = "build-runner-watch";
command = "dart run build_runner watch --delete-conflicting-outputs";
description = "Watch for changes and run code generation";
}
];
in
pkgs.mkShell {
buildInputs = with pkgs; builtins.concatLists [
clipiousNix.packages
[ flutter git ]
];
# What to run when the shell starts
# clipiousNix.prepareShell is a helper function to sort things properly. It returns a string so it's possible to just concatenate stuff afterwards
# to run CI or DB migrations
shellHook = (clipiousNix.prepareShell {}) + ''
echo "Setting up submodules"
git submodule init
git submodule update
echo "Setting up pre-commit hook"
dart run tools/setup_git_hooks.dart
"Adding flutter submodule to path"
export PATH="./submodules/flutter/bin:$PATH"
echo "creating useful aliases..."
''+
pkgs.lib.concatStrings (map (x: ''alias ${x.name}="${x.command}";'') aliases)
+''
echo -e "\nAll done 🎉 \nAvailable aliases:"
''+
pkgs.lib.concatStrings (map (x: ''echo "${x.name}: ${x.description}";'') aliases);
####################################################################
# Without this, almost everything fails with locale issues when
# using `nix-shell --pure` (at least on NixOS).
# See
# + https://github.com/NixOS/nix/issues/318#issuecomment-52986702
# + http://lists.linuxfromscratch.org/pipermail/lfs-support/2004-June/023900.html
####################################################################
LOCALE_ARCHIVE = if pkgs.stdenv.isLinux then "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
}
# vim: set tabstop=2 shiftwidth=2 expandtab: