yoke/flake.nix
2025-10-31 15:31:19 +11:00

51 lines
1.4 KiB
Nix

{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:nix-systems/default-linux";
outputs =
{
self,
nixpkgs,
systems,
}:
let
forAllSystems =
func: nixpkgs.lib.genAttrs (import systems) (system: func (import nixpkgs { inherit system; }));
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
clippy
];
};
});
packages = forAllSystems (pkgs: {
default = self.packages.${pkgs.system}.yoke;
yoke =
let
details = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
lib = pkgs.lib;
in
pkgs.rustPlatform.buildRustPackage (finalAttrs: {
pname = details.name;
inherit (details) version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
RUSTFLAGS = "-C prefer-dynamic=yes";
meta = {
description = details.description;
homepage = details.repository;
license = lib.licenses.gpl3Plus;
maintainers = [ lib.maintainers.atagen ];
mainProgram = details.name;
};
});
});
};
}