forked from ringcentral/slate
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
105 lines (92 loc) · 2.73 KB
/
Copy pathflake.nix
File metadata and controls
105 lines (92 loc) · 2.73 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
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
94
95
96
97
98
99
100
101
102
103
104
105
{
description = "Drip API documentation - a Middleman (Slate) static site";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
outputs = { self, nixpkgs }:
let
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
devShells = forAllSystems (pkgs:
let
# Everything the site build itself depends on.
siteTools = with pkgs; [
ruby_3_3
bundler
pkg-config
nodejs
gnumake
git
];
siteLibs = with pkgs; [
libxml2
libxslt
zlib
libffi
openssl
];
# gnu toolset, shadowing the macOS bsd variants in /usr/bin
gnuTools = with pkgs; [
coreutils
gnused
gnugrep
gawk
findutils
gnutar
diffutils
];
repoTools = with pkgs; [
ripgrep
fd
jq
yq-go
curl
tree
python3
];
shellTools = with pkgs; [
bashInteractive
bash-completion
neovim
less
];
archiveTools = with pkgs; [
gzip
xz
zstd
unzip
delta
bat
];
common = {
buildInputs = siteLibs;
# Gems live in the checkout, not the user profile.
BUNDLE_PATH = "vendor/bundle";
BUNDLE_BIN = "vendor/bundle/bin";
# nokogiri links against the libxml2/libxslt above rather than
# compiling its vendored copies.
BUNDLE_BUILD__NOKOGIRI = "--use-system-libraries";
shellHook = ''
export GEM_HOME="$PWD/.gem"
mkdir -p "$GEM_HOME/bin" "$PWD/vendor/bundle/bin"
export PATH="$PWD/vendor/bundle/bin:$GEM_HOME/bin:$PATH"
'';
};
in
{
# Build-only closure, for CI.
ci = pkgs.mkShell (common // {
name = "api-docs-ci";
nativeBuildInputs = siteTools ++ gnuTools;
});
default = pkgs.mkShell (common // {
name = "api-docs";
nativeBuildInputs = siteTools ++ gnuTools ++ repoTools ++ shellTools ++ archiveTools;
shellHook = common.shellHook + ''
export BASH_COMPLETION="${pkgs.bash-completion}/share/bash-completion/bash_completion"
'';
});
});
};
}