feat(nix): remove devenv, build backend with nix
This commit is contained in:
24
nix/backend.nix
Normal file
24
nix/backend.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
target: let
|
||||
cargoToml = fromTOML (builtins.readFile ../backend/Cargo.toml);
|
||||
inherit (cargoToml.package) name version;
|
||||
pkgs = target.crossPkgs;
|
||||
buildArgs = {
|
||||
pname = name;
|
||||
inherit version;
|
||||
src = pkgs.lib.cleanSource ../.;
|
||||
cargoLock.lockFile = ../Cargo.lock;
|
||||
useNextest = true;
|
||||
meta = {
|
||||
inherit (cargoToml.package) description homepage;
|
||||
};
|
||||
postBuild = "${pkgs.upx}/bin/upx target/*/release/*${name}";
|
||||
};
|
||||
rustVersion = pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = [target.triple];
|
||||
};
|
||||
rustPlatform = target.crossPkgs.makeRustPlatform {
|
||||
cargo = rustVersion;
|
||||
rustc = rustVersion;
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage buildArgs
|
||||
Reference in New Issue
Block a user