initial commit
This commit is contained in:
commit
c6b956ffa9
33 changed files with 3077 additions and 0 deletions
62
flake.nix
Normal file
62
flake.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/25.11";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, ... }:
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||
|
||||
# All packages are built from x86_64-linux host via zig cross-compilation
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
|
||||
zig = import ./support/zig.nix { inherit pkgs; system = "x86_64-linux"; };
|
||||
|
||||
compileRust = import ./support/compile-rust.nix { inherit pkgs zig; };
|
||||
|
||||
mkYaar = target:
|
||||
let
|
||||
muslLibs = import ./support/musl-libs.nix {
|
||||
inherit pkgs zig;
|
||||
name-target = target;
|
||||
};
|
||||
in compileRust {
|
||||
inherit target;
|
||||
src = self;
|
||||
cargoLock = { lockFile = ./Cargo.lock; };
|
||||
extraLibs = muslLibs.allLibs;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux = {
|
||||
yaar-amd64-linux = mkYaar "amd64-linux";
|
||||
yaar-arm64-linux = mkYaar "arm64-linux";
|
||||
};
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
let
|
||||
devPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
};
|
||||
rust = devPkgs.rust-bin.stable.latest.default.override {
|
||||
extensions = [ "rust-src" "rust-analyzer" ];
|
||||
targets = [ "x86_64-unknown-linux-musl" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
default = devPkgs.mkShell {
|
||||
buildInputs = [
|
||||
rust
|
||||
devPkgs.pkg-config
|
||||
devPkgs.libarchive
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue