项目文件夹

文件
wehub-resource-sync 8c89588461
CI / Coverage (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Nix Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:16:47 +08:00

84 行
2.6 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = cargoToml.package.name;
version = cargoToml.package.version;
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
}
);
in
{
description = cargoToml.package.description;
packages = forAllSystems ({ pkgs }: {
default = pkgs.rustPlatform.buildRustPackage rec {
pname = "gittype";
version = "0.10.0";
src = pkgs.fetchFromGitHub {
owner = "unhappychoice";
repo = "gittype";
rev = "v${version}";
hash = "sha256-pzJWXVCGUn85OCHMRlMY5ufrGyJyuhhkYLUk4e01Ri0=";
};
cargoHash = "sha256-E1LKaiTClHmrF7zhGEj1rfELKryIiyVKIf/8Rozm1RQ=";
nativeBuildInputs = [ pkgs.perl pkgs.pkg-config pkgs.git ];
buildInputs = [ pkgs.openssl ];
doCheck = false;
};
unstable = let
rustToolchain = pkgs.rust-bin.stable.latest.default;
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in
rustPlatform.buildRustPackage rec {
inherit pname version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.perl pkgs.pkg-config pkgs.git ];
buildInputs = [ pkgs.openssl ];
doCheck = false;
};
});
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
buildInputs = [
pkgs.rust-bin.stable.latest.default
pkgs.openssl
pkgs.pkg-config
pkgs.perl
pkgs.git
];
};
});
defaultPackage = forAllSystems ({ pkgs }: self.packages.${pkgs.system}.default);
defaultDevShell = forAllSystems ({ pkgs }: self.devShells.${pkgs.system}.default);
apps = forAllSystems ({ pkgs }: {
default = {
type = "app";
program = "${self.packages.${pkgs.system}.default}/bin/gittype";
};
unstable = {
type = "app";
program = "${self.packages.${pkgs.system}.unstable}/bin/gittype";
};
});
};
}