Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
57 lines (53 loc) · 1.87 KB
/
Copy pathflake.nix
File metadata and controls
57 lines (53 loc) · 1.87 KB
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
{
description = "Development shell for tmc-server";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-ruby = {
url = "github:bobvanderlinden/nixpkgs-ruby";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, flake-utils, nixpkgs-ruby, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
# Keep in step with the image in DockerfileBase; nixpkgs only carries the newest Rubies.
ruby = nixpkgs-ruby.packages.${system}."ruby-4.0";
in
{
devShells.default = pkgs.mkShell {
packages = [
ruby
pkgs.nodejs
pkgs.postgresql
# Without it the pg gem finds the host pg_config and links against the host glibc.
pkgs.postgresql.pg_config
pkgs.libyaml
pkgs.openssl
pkgs.zlib
pkgs.libffi
pkgs.pkg-config
pkgs.gnumake
pkgs.vips
pkgs.git
pkgs.lefthook
];
shellHook = ''
# Gems go into the project rather than the Nix store or another Ruby's GEM_HOME.
export BUNDLE_PATH="$PWD/vendor/bundle"
export GEM_HOME="$PWD/vendor/bundle/ruby/${ruby.version.libDir}"
export PATH="$GEM_HOME/bin:$PWD/bin:$PATH"
# ruby-vips dlopens libvips through ffi, which doesn't search the Nix store.
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.vips pkgs.glib ]}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Never in CI or Docker builds.
if [ -z "''${CI:-}" ] && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
lefthook install >/dev/null
fi
'';
};
}
);
}