2023-11-20 16:36:15 +00:00
|
|
|
{
|
|
|
|
description = "Rust dev shell for Hertog's bevy project (YAY!)";
|
|
|
|
|
|
|
|
# Flake inputs
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2305.491812.tar.gz";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix
|
2023-11-21 16:53:04 +00:00
|
|
|
nixgl.url = "github:guibou/nixGL"; # Allows you to run OpenGL and or Vulkan applications in a nix shell
|
2023-11-20 16:36:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Flake outputs
|
2023-11-21 16:53:04 +00:00
|
|
|
outputs = { self, nixpkgs, rust-overlay, nixgl, ... }:
|
2023-11-20 16:36:15 +00:00
|
|
|
let
|
|
|
|
# Overlays enable you to customize the Nixpkgs attribute set
|
|
|
|
overlays = [
|
|
|
|
# Makes a `rust-bin` attribute available in Nixpkgs
|
|
|
|
(import rust-overlay)
|
2023-11-21 16:53:04 +00:00
|
|
|
nixgl.overlay
|
2023-11-20 16:36:15 +00:00
|
|
|
# Provides a `rustToolchain` attribute for Nixpkgs that we can use to
|
|
|
|
# create a Rust environment
|
|
|
|
(self: super: {
|
|
|
|
rustToolchain = super.rust-bin.stable.latest.default;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# Systems supported
|
|
|
|
allSystems = [
|
|
|
|
"x86_64-linux" # 64-bit Intel/AMD Linux
|
|
|
|
"aarch64-linux" # 64-bit ARM Linux
|
|
|
|
"x86_64-darwin" # 64-bit Intel macOS
|
|
|
|
"aarch64-darwin" # 64-bit ARM macOS
|
|
|
|
];
|
|
|
|
|
|
|
|
# Helper to provide system-specific attributes
|
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
|
|
|
|
pkgs = import nixpkgs { inherit overlays system; };
|
|
|
|
});
|
|
|
|
in
|
|
|
|
{
|
|
|
|
# Development environment output
|
|
|
|
devShells = forAllSystems ({ pkgs }: {
|
2024-01-16 12:31:18 +00:00
|
|
|
default = import ./nix/shell.nix { inherit pkgs; };
|
2023-11-20 16:36:15 +00:00
|
|
|
});
|
2024-01-22 13:04:39 +00:00
|
|
|
# Builder
|
|
|
|
packages = forAllSystems ({ pkgs }: {
|
|
|
|
default = import ./nix/default.nix { inherit pkgs; };
|
|
|
|
});
|
2023-11-20 16:36:15 +00:00
|
|
|
};
|
|
|
|
}
|