-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathflake.nix
More file actions
133 lines (124 loc) · 4.96 KB
/
flake.nix
File metadata and controls
133 lines (124 loc) · 4.96 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{
description = "Nix expressions for defining Replit development environments";
inputs.nixpkgs-23_05.url = "github:nixos/nixpkgs/nixos-23.05";
inputs.nixpkgs-24_11.url = "github:nixos/nixpkgs/nixos-24.11";
inputs.nixpkgs-25_05.url = "github:nixos/nixpkgs/nixos-25.05";
inputs.nixpkgs-master.url = "github:nixos/nixpkgs/master";
inputs.nixpkgs-staging.url = "github:nixos/nixpkgs/staging-next";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.nil.url = "github:oxalica/nil";
inputs.nil.inputs.nixpkgs.follows = "nixpkgs";
inputs.prybar.url = "github:replit/prybar";
inputs.prybar.inputs.nixpkgs.follows = "nixpkgs";
inputs.java-language-server.url = "github:replit/java-language-server";
inputs.java-language-server.inputs.nixpkgs.follows = "nixpkgs-23_05";
inputs.ztoc-rs.url = "github:replit/ztoc-rs";
inputs.ztoc-rs.inputs.nixpkgs.follows = "nixpkgs";
inputs.replit-rtld-loader.url = "github:replit/replit_rtld_loader";
inputs.replit-rtld-loader.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, nixpkgs-23_05, nixpkgs-24_11, nixpkgs-25_05, nixpkgs-master, nixpkgs-staging, prybar, java-language-server, nil, fenix, replit-rtld-loader, ... }:
let
mkPkgs = nixpkgs-spec: system: import nixpkgs-spec {
inherit system;
overlays = [
self.overlays.default
prybar.overlays.default
java-language-server.overlays.default
nil.overlays.default
fenix.overlays.default
replit-rtld-loader.overlays.default
];
# replbox and databricks-cli have unfree licenses
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"@replit/replbox"
"databricks-cli"
];
};
pkgs-23_05 = mkPkgs nixpkgs-23_05 "x86_64-linux";
pkgs-24_11 = mkPkgs nixpkgs-24_11 "x86_64-linux";
pkgs-25_05 = mkPkgs nixpkgs-25_05 "x86_64-linux";
# TODO: once nodejs update lands in unstable, switch to that
pkgs-master = mkPkgs nixpkgs-master "x86_64-linux";
pkgs-staging = mkPkgs nixpkgs-staging "x86_64-linux";
patched-unstable = nixpkgs.legacyPackages.x86_64-linux.applyPatches {
name = "nixpkgs-unstable-patched";
src = nixpkgs;
patches = [
# rexml broke solargraph at some point in the past.
# Attempting to run:
# echo 'x = (5 + "hey")' > main.rb
# /nix/store/.../ruby /nix/store/.../bin/solargraph typecheck main.rb
# curently emits a bunch of "Unrecognized RBS type:" warnings, followed by
# "0 problems found."
# This patch used to apply, but even when massaged to apply to the
# current unstable HEAD, still produces the same result:
# ./patches/rexml.patch
];
};
pkgs = mkPkgs patched-unstable "x86_64-linux";
pkgs-aarch64-darwin = mkPkgs patched-unstable "aarch64-darwin";
in
{
overlays.default = final: prev: {
moduleit = self.packages.${prev.system}.moduleit;
lib = prev.lib // {
mkWrapper-replit_ld_library_path = package: final.stdenvNoCC.mkDerivation {
name = "${package.name}-wrapped";
inherit (package) meta version;
buildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
if [ ! -d ${package}/bin ]; then
echo "No bin directory found in ${package}"
exit 1
fi
mkdir -p $out/bin
for bin in ${package}/bin/*; do
local binName=$(basename $bin)
cat >$out/bin/$binName <<-EOF
#!${final.bash}/bin/bash
if [ -n "\''${REPLIT_LD_LIBRARY_PATH-}" ]; then
if test "\''${REPLIT_RTLD_LOADER:-}" = "1" && test "\''${REPLIT_NIX_CHANNEL:-}" != "legacy"
then
# activate RTLD loader!
export LD_AUDIT="${pkgs.replit-rtld-loader}/rtld_loader.so"
else
export LD_LIBRARY_PATH="\$REPLIT_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
fi
fi
exec "$bin" "\$@"
EOF
chmod +x $out/bin/$binName
done
'';
};
};
};
formatter.x86_64-linux = pkgs.nixpkgs-fmt;
formatter.aarch64-darwin = pkgs-aarch64-darwin.nixpkgs-fmt;
packages.x86_64-linux = import ./pkgs {
inherit pkgs self;
};
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [
python310
pigz
coreutils
findutils
e2fsprogs
gnutar
gzip
];
};
} // (
import ./pkgs/modules {
inherit pkgs;
inherit pkgs-23_05;
inherit pkgs-24_11;
inherit pkgs-25_05;
inherit pkgs-master;
inherit pkgs-staging;
}
);
}