{ description = "oneko"; inputs = { flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { self, nixpkgs, flake-utils, rust-overlay, }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [rust-overlay.overlays.default]; }; package = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package; toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; rustPlatform = pkgs.makeRustPlatform { cargo = toolchain; rustc = toolchain; }; in { packages = flake-utils.lib.flattenTree rec { default = oneko; oneko = rustPlatform.buildRustPackage { pname = package.name; inherit (package) version; # uncomment this and let the build fail, then get the current hash # very scuffed but endorsed! #cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; cargoHash = "sha256-aBvcI4iAlIGi60+tN/fes6/2MeNFwj21W7rV3pV88EY="; nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ libxkbcommon ]; src = ./.; meta.mainProgram = package.name; }; }; devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ libxkbcommon ]; packages = with pkgs; [ toolchain rust-analyzer-unwrapped ]; RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library"; }; } ); }