a bare-bones limbo server in rust (mirror of https://github.com/xoogware/crawlspace)
at master 3.0 kB view raw
1# Copyright (c) 2024 Andrew Brower. 2# This file is part of Crawlspace. 3# 4# Crawlspace is free software: you can redistribute it and/or 5# modify it under the terms of the GNU Affero General Public 6# License as published by the Free Software Foundation, either 7# version 3 of the License, or (at your option) any later version. 8# 9# Crawlspace is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# Affero General Public License for more details. 13# 14# You should have received a copy of the GNU Affero General Public 15# License along with Crawlspace. If not, see 16# <https://www.gnu.org/licenses/>. 17{ 18 description = "Description for the project"; 19 20 inputs = { 21 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 22 flake-parts.url = "github:hercules-ci/flake-parts"; 23 rust-overlay.url = "github:oxalica/rust-overlay"; 24 rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; 25 }; 26 27 outputs = inputs @ { 28 flake-parts, 29 rust-overlay, 30 ... 31 }: 32 flake-parts.lib.mkFlake {inherit inputs;} { 33 systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; 34 perSystem = { 35 config, 36 self', 37 inputs', 38 pkgs, 39 system, 40 ... 41 }: let 42 version = "0.0.1"; 43 rust-bin = pkgs.pkgsBuildHost.rust-bin; 44 rustToolchain = rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; 45 rustPlatform = pkgs.makeRustPlatform { 46 cargo = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain); 47 rustc = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain); 48 clippy = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain); 49 }; 50 in { 51 _module.args.pkgs = import inputs.nixpkgs { 52 inherit system; 53 overlays = [ 54 rust-overlay.overlays.default 55 ]; 56 }; 57 58 devShells.default = pkgs.mkShell { 59 inputsFrom = [ 60 self'.packages.default 61 ]; 62 63 packages = with pkgs; 64 [ 65 rust-analyzer 66 ] 67 ++ lib.optionals (system == "x86_64-linux" || system == "aarch64-linux") [ 68 valgrind 69 ]; 70 }; 71 72 packages = let 73 mkCrawlspace = buildType: 74 rustPlatform.buildRustPackage { 75 pname = "crawlspace"; 76 inherit version; 77 src = ./.; 78 cargoLock.lockFile = ./Cargo.lock; 79 cargoLock.outputHashes."fastanvil-0.31.0" = "E4WI6SZgkjqUOtbfXfKGfpFH7btEh5V0KpMXSIsuh08="; 80 cargoLock.outputHashes."fastnbt-2.5.0" = "E4WI6SZgkjqUOtbfXfKGfpFH7btEh5V0KpMXSIsuh08="; 81 inherit buildType; 82 dontStrip = buildType == "debug"; 83 buildInputs = with pkgs; [pkg-config openssl]; 84 }; 85 in { 86 default = mkCrawlspace "debug"; 87 release = mkCrawlspace "release"; 88 }; 89 }; 90 }; 91}