build everything with nix, and fast
This commit is contained in:
parent
e039c8cde0
commit
5ace438d57
21
default.nix
21
default.nix
@ -1,20 +1,7 @@
|
|||||||
{ rustPlatform, lib, callPackage, project-config ? callPackage ./project-config.nix { }, ... }: rustPlatform.buildRustPackage {
|
{ callPackage, defaultCrateOverrides, cargoNix? callPackage ./Cargo.nix {}, projectConfig ? callPackage ./project-config.nix { }, ... }: cargoNix.workspaceMembers.chat-signaling-server.build.override {
|
||||||
pname = "chat-signaling-server";
|
crateOverrides = defaultCrateOverrides // {
|
||||||
version = "1.0.0";
|
signaling = { ... }: {
|
||||||
|
inherit (projectConfig) buildInputs nativeBuildInputs;
|
||||||
nativeBuildInputs = project-config.buildTools;
|
|
||||||
buildInputs = project-config.libraries;
|
|
||||||
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
cargoLock = {
|
|
||||||
lockFile = ./Cargo.lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "rust project scaffold";
|
|
||||||
homepage = "https://git.jeffthecoder.xyz/public/os-flakes";
|
|
||||||
license = licenses.unlicense;
|
|
||||||
maintainers = [ ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
16
docker-image.nix
Normal file
16
docker-image.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ dockerTools, callPackage, ... }:
|
||||||
|
let
|
||||||
|
pkg = callPackage ./default.nix {};
|
||||||
|
in
|
||||||
|
dockerTools.buildImage {
|
||||||
|
name = pkg.crateName;
|
||||||
|
tag = pkg.crateVersion;
|
||||||
|
|
||||||
|
config = {
|
||||||
|
Volumes = {
|
||||||
|
"/data" = {};
|
||||||
|
};
|
||||||
|
WorkingDir = "/data";
|
||||||
|
Entrypoint = ["${pkg}/bin/server"];
|
||||||
|
};
|
||||||
|
}
|
@ -1,19 +1,17 @@
|
|||||||
{ pkg-config
|
{ callPackage
|
||||||
, callPackage
|
|
||||||
|
|
||||||
, sqlite
|
|
||||||
, cargo-tarpaulin
|
, cargo-tarpaulin
|
||||||
, protobuf
|
, protobuf
|
||||||
, rustfmt
|
, rustfmt
|
||||||
|
, crate2nix
|
||||||
|
|
||||||
, sea-orm-cli
|
, sea-orm-cli
|
||||||
|
|
||||||
, extra-tools ? callPackage ./extra-tools.nix
|
, extra-tools ? callPackage ./extra-tools.nix
|
||||||
, ...
|
, ...
|
||||||
}: {
|
}: {
|
||||||
buildTools = [ pkg-config protobuf ];
|
nativeBuildInputs = [ protobuf ];
|
||||||
libraries = [ sqlite ];
|
buildInputs = [ ];
|
||||||
developmentTools = [
|
developmentTools = [
|
||||||
# bpf-linker
|
# bpf-linker
|
||||||
cargo-tarpaulin
|
cargo-tarpaulin
|
||||||
@ -34,6 +32,7 @@
|
|||||||
# trunk
|
# trunk
|
||||||
# wasm-bindgen-cli
|
# wasm-bindgen-cli
|
||||||
rustfmt
|
rustfmt
|
||||||
|
crate2nix
|
||||||
|
|
||||||
# extra-tools.kopium
|
# extra-tools.kopium
|
||||||
];
|
];
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{ rustPackages, stdenv, rustc, rust-analyzer, project-config ? rustPackages.callPackage ./project-config.nix { }, ... }: let
|
{ rustPackages, stdenv, rustc, rust-analyzer, projectConfig ? rustPackages.callPackage ./project-config.nix { }, ... }: let
|
||||||
package = rustPackages.callPackage ./default.nix { inherit project-config; };
|
package = rustPackages.callPackage ./default.nix { inherit projectConfig; };
|
||||||
in
|
in
|
||||||
package.overrideAttrs (final: (prevAttrs: {
|
package.overrideAttrs (final: (prevAttrs: {
|
||||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ project-config.developmentTools ++ [rust-analyzer];
|
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ projectConfig.developmentTools ++ [rust-analyzer];
|
||||||
|
|
||||||
RUST_SRC_PATH = stdenv.mkDerivation {
|
RUST_SRC_PATH = stdenv.mkDerivation {
|
||||||
inherit (rustc) src;
|
inherit (rustc) src;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user