-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
93 lines (79 loc) · 2.11 KB
/
default.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{ pkgs ? import ./nix { } }:
let
# The development shell definition
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
# common tooling
gitAndTools.pre-commit
niv
vim
# Elm app
elmPackages.elm
elmPackages.elm-format
elmPackages.elm-analyse
elmPackages.elm-verify-examples
elmPackages.elm-test
elmPackages.elm-coverage
elm2nix
nodePackages.npm
yarn
yarnPkg
# Python helper scripts
geckodriver
poetry
poetryEnv
]
# Currently, both firefox and firefox-bin are broken on Darwin (MacOS)
# so if you are on a MacBook, you have to manually install firefox.
# If https://github.com/NixOS/nixpkgs/issues/53979 gets fixed,
# we can remove this if.
++ lib.optionals (!pkgs.stdenv.isDarwin) [
pkgs.firefox
];
shellHook = ''
if [[ -d .git ]]; then
pre-commit install -f --hook-type pre-commit
pre-commit install -f --hook-type pre-push
fi
dest=./node_modules
${copyGeneratedFiles}
'';
};
# Elm stuff
yarnPkg = pkgs.mkYarnPackage {
name = "salary-calculator-node-packages";
src = pkgs.lib.cleanSourceWith {
src = ./.;
name = "salary-calculator-package.json";
filter = name: type: baseNameOf (toString name) == "package.json";
};
yarnLock = ./yarn.lock;
publishBinsFor = [
"eslint"
"parcel"
];
};
copyGeneratedFiles = ''
echo "symlinking node_modules ..." >> /dev/stderr
rm -rf $dest
ln -s ${yarnPkg}/libexec/salary-calculator/node_modules $dest
'';
# Python stuff
poetryEnv = pkgs.poetry2nix.mkPoetryEnv {
python = pkgs.python311;
projectDir = ./.;
editablePackageSources = {
salarycalc = ./.;
};
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend(self: super: {
flake8-assertive = super.flake8-assertive.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
});
});
};
in {
inherit devShell;
# Used to install dependencies for CI and Heroku
inherit pkgs;
}