68 lines
1.9 KiB
Nix
68 lines
1.9 KiB
Nix
{
|
|
description = "";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
rustVersion = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
cargo = rustVersion;
|
|
rustc = rustVersion;
|
|
};
|
|
|
|
appName = "rse-backend";
|
|
|
|
appRustBuild = rustPlatform.buildRustPackage {
|
|
pname = appName;
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
doCheck = false;
|
|
};
|
|
|
|
dockerImage = pkgs.dockerTools.buildLayeredImage {
|
|
name = appName;
|
|
config = {
|
|
Entrypoint = [ "${appRustBuild}/bin/${appName}" ];
|
|
Env = [ "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ];
|
|
Tag = "latest";
|
|
};
|
|
contents = [ appRustBuild pkgs.cacert ];
|
|
};
|
|
in {
|
|
packages = {
|
|
rustPackage = appRustBuild;
|
|
docker = dockerImage;
|
|
};
|
|
defaultPackage = dockerImage;
|
|
devShell = with pkgs; mkShell {
|
|
buildInputs = [
|
|
bacon
|
|
cargo
|
|
cargo-audit
|
|
cargo-auditable
|
|
cargo-msrv
|
|
cargo-tarpaulin
|
|
dockerfile-language-server-nodejs
|
|
just
|
|
loco-cli
|
|
nodePackages."@volar/vue-language-server"
|
|
nodejs_20
|
|
rust-analyzer
|
|
rustVersion
|
|
sea-orm-cli
|
|
vscode-langservers-extracted
|
|
yaml-language-server
|
|
];
|
|
};
|
|
});
|
|
}
|