treewide: Migrate to the new dream2nix API

This commit is contained in:
Tristan Daniël Maat 2024-01-01 19:56:16 +01:00
parent 5163ef9d6a
commit 40e0946201
Signed by: tlater
GPG key ID: 49670FD774E43268
59 changed files with 15003 additions and 24504 deletions

View file

@ -1,57 +0,0 @@
{
self,
nixpkgs,
dream2nix,
fenix,
system,
...
}: let
inherit (nixpkgs.legacyPackages.${system}) runCommandLocal yj;
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
'';
};
};
sharp = {
add-libvips = {
buildInputs = old:
old
++ (with nixpkgs.legacyPackages.${system}; [
vips
pkg-config
]);
};
};
};
}
// {
inherit rust-toolchain;
}

View file

@ -10,7 +10,7 @@ echo 'Note: Update the flake inputs with `nix flake update --commit-lockfile *fi
cd "$(git rev-parse --show-toplevel)" || exit
# Update cargo deps
cd server || exit
cd packages/server || exit
cargo update
if ! git diff --quiet Cargo.lock Cargo.toml; then

View file

@ -1,14 +1,25 @@
{
lib,
self,
system,
writeShellApplication,
cargo,
git,
nix,
npm,
npm-check-updates,
yq-go,
}:
writeShellApplication {
name = "update";
runtimeInputs = [cargo git nix npm npm-check-updates yq-go];
text = builtins.readFile ./scripts/update.sh;
}
}: let
selfPackages = self.packages.${system};
inherit (selfPackages.server.config.deps) cargo;
inherit (selfPackages.templates.config.deps) npm;
npm-check-updates =
(builtins.elemAt (lib.attrValues
selfPackages.templates.config.nodejs-granular-v3.deps.npm-check-updates)
0)
.package-func
.result;
in
writeShellApplication {
name = "update";
runtimeInputs = [cargo git nix npm npm-check-updates yq-go];
text = builtins.readFile ./scripts/update.sh;
}