treewide: Update and adapt to new dream2nix project.toml
This commit is contained in:
parent
f034fbe7e4
commit
b2894e4fef
30
flake.lock
30
flake.lock
|
@ -43,11 +43,11 @@
|
|||
"crane": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1670284777,
|
||||
"narHash": "sha256-JF0pc0s4z/X+Iy+lNHOwUQ8I5bz+q7uX4HrKTNIEj24=",
|
||||
"lastModified": 1670900067,
|
||||
"narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "2243fb9c872de25cb564a02d324ea6a5b9853052",
|
||||
"rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -89,11 +89,11 @@
|
|||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670669673,
|
||||
"narHash": "sha256-2ESsFsll4n5e3I2e/J4CDzihrX9K+NuWpcsOh7aVxbw=",
|
||||
"lastModified": 1672661134,
|
||||
"narHash": "sha256-WqBUyKeiv+jI11ug+qP0OnZ4nngK6eBRVTGHgdzEGvc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "a46b77e2243415ff5eb76b8b35277c0a9b9b072c",
|
||||
"rev": "9f6911c78dcb0832f7fcc955e847db1a5a9ce29a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -133,11 +133,11 @@
|
|||
"rust-analyzer-src": "rust-analyzer-src_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670653386,
|
||||
"narHash": "sha256-n3PWSTkyyNVnP316epb7VXHrVQHIcED1LWFKrkYiKIA=",
|
||||
"lastModified": 1672813381,
|
||||
"narHash": "sha256-PKt6orRiFO19KFKnOhzK26hbFLtimlRNE2dGwrTEhII=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "2745d0c04a278231140125b81996d23fe00d923c",
|
||||
"rev": "eb6583fcd626051c4d284f2fb51cd2659a43e7f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -293,11 +293,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1670543317,
|
||||
"narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=",
|
||||
"lastModified": 1672781980,
|
||||
"narHash": "sha256-L+yqt2szcp+BFiWoMJCisDsNA5OrpYVW1QSbbS5U8RU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19",
|
||||
"rev": "a9eedea7232f5d00f0aca7267efb69a54da1b8a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -376,11 +376,11 @@
|
|||
"rust-analyzer-src_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1670614565,
|
||||
"narHash": "sha256-9XSIUkTYVO2uYG7sy5wv1mlvqIkLzj02UfHMpf3CzqA=",
|
||||
"lastModified": 1672757238,
|
||||
"narHash": "sha256-BK1njXsjprMT0f+1aQYmZ/ueN9D3Y3wrz9gw4UvieRQ=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "14492043dba29d626ea98667c3c7c0002f75feff",
|
||||
"rev": "a97c71f92d574cb5104e3e1246eb9038d1a214a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
12
flake.nix
12
flake.nix
|
@ -16,15 +16,15 @@
|
|||
nixpkgs,
|
||||
dream2nix,
|
||||
fenix,
|
||||
}: let
|
||||
} @ flake-inputs: let
|
||||
# At the moment, we only deploy to x86_64-linux. Update when we
|
||||
# care about another platform.
|
||||
system = "x86_64-linux";
|
||||
flakeOutputs = import ./nix/packages.nix {inherit nixpkgs dream2nix fenix system;};
|
||||
flakeOutputs = nixpkgs.lib.callPackageWith flake-inputs (import ./nix/packages.nix) {inherit system;};
|
||||
in {
|
||||
packages.${system} = {
|
||||
server = flakeOutputs.server.packages.${system}.default;
|
||||
templates = flakeOutputs.templates.packages.${system}.default;
|
||||
server = flakeOutputs.packages.${system}.tlaternet-webserver;
|
||||
templates = flakeOutputs.packages.${system}.tlaternet;
|
||||
};
|
||||
|
||||
apps.${system}.default = let
|
||||
|
@ -40,7 +40,7 @@
|
|||
nixosModules.default = import ./nix/module.nix {inherit self system;};
|
||||
|
||||
devShells.${system} = {
|
||||
templates = flakeOutputs.templates.devShells.${system}.default.overrideAttrs (old: {
|
||||
templates = flakeOutputs.devShells.${system}.default.overrideAttrs (old: {
|
||||
buildInputs = with nixpkgs.legacyPackages.${system};
|
||||
[
|
||||
yj
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
server = nixpkgs.legacyPackages.${system}.mkShell {
|
||||
packages = [
|
||||
(flakeOutputs.server.rust-toolchain.withComponents [
|
||||
(flakeOutputs.rust-toolchain.withComponents [
|
||||
"rustc"
|
||||
"cargo"
|
||||
"rustfmt"
|
||||
|
|
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;
|
||||
}
|
||||
|
|
31
projects.toml
Normal file
31
projects.toml
Normal file
|
@ -0,0 +1,31 @@
|
|||
# projects.toml file describing inputs for dream2nix
|
||||
#
|
||||
# To re-generate this file, run:
|
||||
# nix run .#detect-projects $source
|
||||
# ... where `$source` points to the source of your project.
|
||||
#
|
||||
# If the local flake is unavailable, alternatively execute the app from the
|
||||
# upstream dream2nix flake:
|
||||
# nix run github:nix-community/dream2nix#detect-projects $source
|
||||
[tlaternet]
|
||||
name = "tlaternet"
|
||||
relPath = "templates"
|
||||
subsystem = "nodejs"
|
||||
translator = "package-lock"
|
||||
translators = [ "package-lock", "package-json",]
|
||||
|
||||
[tlaternet.subsystemInfo]
|
||||
|
||||
[tlaternet-webserver]
|
||||
name = "tlaternet-webserver"
|
||||
relPath = "server"
|
||||
subsystem = "rust"
|
||||
translator = "cargo-lock"
|
||||
translators = [ "cargo-lock", "cargo-toml",]
|
||||
|
||||
[tlaternet-webserver.subsystemInfo]
|
||||
workspaceMembers = []
|
||||
[[tlaternet-webserver.subsystemInfo.crates]]
|
||||
name = "tlaternet-webserver"
|
||||
relPath = "server"
|
||||
version = "0.1.0"
|
Loading…
Reference in a new issue