Skip to content

Instantly share code, notes, and snippets.

@jperras
Created August 29, 2024 16:53
Show Gist options
  • Save jperras/f2d07f8db72664352071c3f80f93b7aa to your computer and use it in GitHub Desktop.
Save jperras/f2d07f8db72664352071c3f80f93b7aa to your computer and use it in GitHub Desktop.
Simple nix flake for Rust project
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
with nixpkgs.legacyPackages.${system}; {
packages.foo = rustPlatform.buildRustPackage {
name = "foo";
version = "0.1";
src = lib.cleanSource ./.;
cargoSha256 =
"<sha>";
};
defaultPackage = self.packages.${system}.foo;
devShell = mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = [ cargo ];
nativeBuildInputs = [ cargo ];
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment