60 lines
No EOL
1.2 KiB
Nix
60 lines
No EOL
1.2 KiB
Nix
{
|
|
inputs.nixpkgs.url = "nixpkgs";
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
...
|
|
}: let
|
|
version = builtins.substring 0 7 self.lastModifiedDate;
|
|
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
|
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
|
|
|
packageFn = pkgs:
|
|
pkgs.rustPlatform.buildRustPackage {
|
|
pname = "e4vc";
|
|
inherit version;
|
|
|
|
src = builtins.path {
|
|
name = "source";
|
|
path = ./.;
|
|
};
|
|
|
|
cargoSha256 = "sha256-YZHQCFojC8Ch9jcyxXLKEVsMNtI4ufzbCPUPLbUkMCI=";
|
|
};
|
|
in rec {
|
|
packages = forAllSystems (s: let
|
|
pkgs = nixpkgsFor.${s};
|
|
in rec {
|
|
e4vc = packageFn pkgs;
|
|
default = e4vc;
|
|
});
|
|
|
|
devShells = forAllSystems (s: let
|
|
pkgs = nixpkgsFor.${s};
|
|
inherit (pkgs) mkShell;
|
|
in {
|
|
default = mkShell {
|
|
packages = with pkgs; [rustc cargo rustfmt];
|
|
};
|
|
});
|
|
|
|
dockerImage = forAllSystems (s: let
|
|
pkgs = nixpkgsFor.${s};
|
|
in pkgs.dockerTools.buildImage {
|
|
name = "e4vc";
|
|
tag = "latest";
|
|
config = {
|
|
Cmd = ["${packageFn pkgs}/bin/e4vc"];
|
|
};
|
|
});
|
|
};
|
|
} |