mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Nix flake (#758)
* Added Flake for nix * Removed Cargo lock from ignore As it's now reccomended by rust team to keep it in repo as well as nix needs it fetch dependacies for nix run * Added Nix Compatbilty for package I forgot to add it that's why this commit is here. * Made flake minimal
This commit is contained in:
52
flake.nix
Normal file
52
flake.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs@{ nixpkgs, flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
manifest = (pkgs.lib.importTOML ./pumpkin/Cargo.toml).package;
|
||||
in
|
||||
{
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
_module.args.pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(import inputs.rust-overlay)
|
||||
];
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell
|
||||
{
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rustToolchain
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
packages.default = (pkgs.makeRustPlatform {rustc = rustToolchain; cargo = rustToolchain;}).buildRustPackage {
|
||||
pname = manifest.name;
|
||||
version = manifest.version;
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user