Initial commit

This commit is contained in:
2026-05-23 03:12:03 +09:00
commit 5219faa20f
14 changed files with 3707 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, rust-overlay }:
let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
"armv7l-linux"
];
forAllSystems = f: lib.genAttrs systems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
];
};
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
toolchain = rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "rust-std" ];
};
in f system pkgs toolchain);
in {
devShells = forAllSystems (system: pkgs: toolchain: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
toolchain
cargo-nextest
cargo-edit
cargo-deny
];
env.RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
};
});
overlays = {
default = self.overlays.bro;
bro = final: prev: {
inherit (self.packages.${prev.stdenv.hostPlatform.system}) bro;
};
};
packages = forAllSystems (system: pkgs: _:
let
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
cargoLock = ./Cargo.lock;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./src
];
};
in {
default = self.packages.${system}.bro;
bro = pkgs.callPackage ./nix/default.nix { inherit cargoToml cargoLock src; };
filteredSource = pkgs.runCommandLocal "filtered-source" { } ''
ln -s ${src} $out
'';
});
checks = forAllSystems (system: pkgs: _: {
inherit (self.packages.${system}) bro;
});
};
}