treewide: Update and adapt to new dream2nix project.toml
This commit is contained in:
parent
f034fbe7e4
commit
b2894e4fef
4 changed files with 97 additions and 103 deletions
nix
127
nix/packages.nix
127
nix/packages.nix
|
@ -1,94 +1,57 @@
|
|||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
dream2nix,
|
||||
fenix,
|
||||
system,
|
||||
}: {
|
||||
server = let
|
||||
rust-toolchain = fenix.packages.${system}.stable;
|
||||
in
|
||||
dream2nix.lib.makeFlakeOutputs {
|
||||
systems = [system];
|
||||
config.projectRoot = ../server;
|
||||
source = ../server;
|
||||
...
|
||||
}: let
|
||||
inherit (nixpkgs.legacyPackages.${system}) runCommandLocal yj;
|
||||
|
||||
packageOverrides = {
|
||||
"^.*".set-toolchain.overrideRustToolchain = old: {
|
||||
cargo = rust-toolchain.minimalToolchain;
|
||||
rustc = rust-toolchain.minimalToolchain;
|
||||
rust-toolchain = fenix.packages.${system}.stable;
|
||||
in
|
||||
dream2nix.lib.makeFlakeOutputs {
|
||||
systems = [system];
|
||||
config.projectRoot = self;
|
||||
projects = ../projects.toml;
|
||||
|
||||
source = runCommandLocal "source" {nativeBuildInputs = [yj];} ''
|
||||
cp -r ${self} $out/
|
||||
chmod -R u+w $out
|
||||
yj < $out/templates/package.yaml > $out/templates/package.json
|
||||
'';
|
||||
|
||||
packageOverrides = {
|
||||
tlaternet-webserver.set-toolchain.overrideRustToolchain = old: {
|
||||
cargo = rust-toolchain.minimalToolchain;
|
||||
rustc = rust-toolchain.minimalToolchain;
|
||||
};
|
||||
|
||||
tlaternet-webserver-deps.set-toolchain.overrideRustToolchain = old: {
|
||||
cargo = rust-toolchain.minimalToolchain;
|
||||
rustc = rust-toolchain.minimalToolchain;
|
||||
};
|
||||
|
||||
tlaternet = {
|
||||
install-only-dist = {
|
||||
installPhase = ''
|
||||
cp -r $nodeModules/tlaternet/dist $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
// {
|
||||
inherit rust-toolchain;
|
||||
};
|
||||
|
||||
templates = let
|
||||
inherit (nixpkgs.legacyPackages.${system}) runCommandLocal yj;
|
||||
in
|
||||
dream2nix.lib.makeFlakeOutputs {
|
||||
systems = [system];
|
||||
config.projectRoot = ../templates;
|
||||
|
||||
# Generate `package.json` from `package.yaml`, since the nodejs
|
||||
# ecosystem doesn't support yaml.
|
||||
source = runCommandLocal "templates" {nativeBuildInputs = [yj];} ''
|
||||
cp -r ${../templates} $out/
|
||||
chmod u+w $out
|
||||
yj < ${../templates/package.yaml} > $out/package.json
|
||||
'';
|
||||
|
||||
packageOverrides = {
|
||||
tlaternet = {
|
||||
add-build-script = {
|
||||
# Dream2nix' built-in install script assumes this is just
|
||||
# a usual npm package and will install it in
|
||||
# `node_modules`.
|
||||
#
|
||||
# Parcel will detect this, and completely break all
|
||||
# configuration. Furthermore, we don't actually want to
|
||||
# install this as if it was an npm library.
|
||||
#
|
||||
# The easiest way to fix this is just to rename the
|
||||
# top-level directory.
|
||||
preBuild = ''
|
||||
# Rename top-level directory so parcel doesn't think we're in a
|
||||
# node_module
|
||||
mv ../../node_modules ../../top-level
|
||||
|
||||
# Rewrite $PATH and co. to use the new path.
|
||||
export PATH=''${PATH//lib\/node_modules\/.bin/lib\/top-level\/.bin}
|
||||
export NODE_PATH=''${NODE_PATH//lib\/node_modules/lib\/top-level}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# For some reason, dream2nix builds in the out directory. Don't ask
|
||||
# me, I don't know either.
|
||||
|
||||
# First, go to a sane directory and back up our actual build output
|
||||
mv dist /build/dist
|
||||
cd /build
|
||||
|
||||
# Then, delete everything currently in $out
|
||||
chmod -R u+rwx $out
|
||||
rm -r $out
|
||||
|
||||
# Finally, actually install our output
|
||||
mv dist $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
sharp = {
|
||||
add-libvips = {
|
||||
buildInputs = old:
|
||||
old
|
||||
++ (with nixpkgs.legacyPackages.${system}; [
|
||||
vips
|
||||
pkg-config
|
||||
]);
|
||||
};
|
||||
sharp = {
|
||||
add-libvips = {
|
||||
buildInputs = old:
|
||||
old
|
||||
++ (with nixpkgs.legacyPackages.${system}; [
|
||||
vips
|
||||
pkg-config
|
||||
]);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
// {
|
||||
inherit rust-toolchain;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue