115 lines
2.8 KiB
Nix
115 lines
2.8 KiB
Nix
{
|
|
description = "Build a cargo project without extra checks";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
crane.url = "github:ipetkov/crane";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
crane,
|
|
flake-utils,
|
|
...
|
|
}@inputs:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import inputs.rust-overlay) ];
|
|
};
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (
|
|
p:
|
|
p.rust-bin.nightly.latest.default.override {
|
|
extensions = [
|
|
"rustc-codegen-cranelift-preview"
|
|
"rust-analyzer"
|
|
"rust-src"
|
|
];
|
|
}
|
|
);
|
|
|
|
# Common arguments can be set here to avoid repeating them later
|
|
# Note: changes here will rebuild all dependency crates
|
|
commonArgs = {
|
|
src = craneLib.cleanCargoSource ./.;
|
|
strictDeps = true;
|
|
|
|
buildInputs =
|
|
[ ]
|
|
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
|
pkgs.libiconv
|
|
];
|
|
};
|
|
|
|
fileSetForCrate =
|
|
crate:
|
|
lib.fileset.toSource {
|
|
root = ./.;
|
|
fileset = lib.fileset.unions [
|
|
./Cargo.toml
|
|
./Cargo.lock
|
|
(craneLib.fileset.commonCargoSources ./crates/entity)
|
|
(craneLib.fileset.commonCargoSources ./crates/migration)
|
|
(craneLib.fileset.commonCargoSources ./crates/server)
|
|
(craneLib.fileset.commonCargoSources crate)
|
|
];
|
|
};
|
|
|
|
rtmp-to-whip-simple-server = craneLib.buildPackage (
|
|
commonArgs
|
|
// {
|
|
pname = "rtmp-to-whip";
|
|
version = "0.4.0";
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
cargoExtraArgs = "-p server";
|
|
src = fileSetForCrate ./crates/server;
|
|
}
|
|
);
|
|
|
|
in
|
|
{
|
|
checks = {
|
|
inherit rtmp-to-whip-simple-server;
|
|
};
|
|
|
|
packages.default = rtmp-to-whip-simple-server;
|
|
|
|
apps.default = flake-utils.lib.mkApp {
|
|
drv = rtmp-to-whip-simple-server;
|
|
};
|
|
|
|
devShells.default = craneLib.devShell {
|
|
checks = self.checks.${system};
|
|
|
|
ADMIN_REF_CODE = "meowmeowpurrrmeow";
|
|
|
|
packages = [
|
|
pkgs.clang
|
|
pkgs.mold
|
|
pkgs.sea-orm-cli
|
|
pkgs.cmake
|
|
pkgs.opus
|
|
pkgs.pkgconf
|
|
pkgs.just
|
|
];
|
|
};
|
|
}
|
|
);
|
|
}
|