Editor for papermario-dx mods
at main 133 lines 3.7 kB view raw
1# SPDX-FileCopyrightText: 2026 Alex Bates <alex@bates64.com> 2# 3# SPDX-License-Identifier: AGPL-3.0-or-later 4 5{ 6 inputs = { 7 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 8 flake-parts.url = "github:hercules-ci/flake-parts"; 9 treefmt-nix.url = "github:numtide/treefmt-nix"; 10 font-switzer = { 11 url = "https://api.fontshare.com/v2/fonts/download/switzer"; 12 flake = false; 13 }; 14 parallel-rdp-standalone = { 15 url = "github:gopher64/parallel-rdp-standalone/gopher64"; 16 flake = false; 17 }; 18 }; 19 20 outputs = 21 inputs@{ flake-parts, ... }: 22 flake-parts.lib.mkFlake { inherit inputs; } { 23 systems = [ 24 "x86_64-linux" 25 "aarch64-linux" 26 "x86_64-darwin" 27 "aarch64-darwin" 28 ]; 29 30 imports = [ 31 inputs.treefmt-nix.flakeModule 32 ]; 33 34 perSystem = 35 { config, pkgs, ... }: 36 let 37 font-switzer = pkgs.runCommand "font-switzer" { nativeBuildInputs = [ pkgs.unzip ]; } '' 38 unzip ${inputs.font-switzer} -d $out 39 ''; 40 in 41 { 42 checks.reuse = pkgs.runCommand "reuse-lint" { nativeBuildInputs = [ pkgs.reuse ]; } '' 43 cd ${./.} 44 reuse lint 45 touch $out 46 ''; 47 48 treefmt = { 49 projectRootFile = "flake.nix"; 50 51 programs.rustfmt.enable = true; 52 programs.nixfmt.enable = true; 53 54 settings.formatter.reuse-annotate = { 55 command = pkgs.writeShellScriptBin "reuse-annotate" '' 56 name=$(${pkgs.git}/bin/git config user.name) 57 email=$(${pkgs.git}/bin/git config user.email) 58 exec ${pkgs.reuse}/bin/reuse annotate \ 59 --license "AGPL-3.0-or-later" \ 60 --copyright "$name <$email>" \ 61 --skip-existing \ 62 --skip-unrecognised \ 63 "$@" 64 ''; 65 includes = [ "*" ]; 66 excludes = [ 67 "flake.lock" 68 "Cargo.lock" 69 "LICENSE" 70 "NOTICE" 71 "LICENSES/*" 72 ]; 73 }; 74 75 settings.global.excludes = [ 76 "target/*" 77 ".jj/*" 78 ".git/*" 79 ".direnv/*" 80 ]; 81 }; 82 83 devShells.default = pkgs.mkShell { 84 packages = [ 85 pkgs.rustc 86 pkgs.cargo 87 pkgs.clippy 88 pkgs.rustfmt 89 pkgs.rust-analyzer 90 pkgs.reuse 91 config.treefmt.build.wrapper 92 pkgs.pkg-config 93 pkgs.dioxus-cli 94 pkgs.just 95 pkgs.clang 96 ]; 97 98 nativeBuildInputs = [ 99 pkgs.rustPlatform.bindgenHook 100 ]; 101 102 buildInputs = with pkgs; [ 103 wayland 104 libxkbcommon 105 vulkan-headers 106 vulkan-loader 107 libx11 108 libxcursor 109 libxrandr 110 libxi 111 ]; 112 113 SWITZER_FONT_DIR = "${font-switzer}"; 114 PARALLEL_RDP_DIR = "${inputs.parallel-rdp-standalone}"; 115 RUST_BACKTRACE = "1"; 116 117 # https://github.com/DioxusLabs/dioxus/issues/4962 118 RUSTFLAGS = 119 if pkgs.stdenv.hostPlatform.isx86_64 then "-Ctarget-cpu=x86-64" else "-Ctarget-cpu=generic"; 120 121 LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ 122 pkgs.wayland 123 pkgs.libxkbcommon 124 pkgs.vulkan-loader 125 pkgs.libx11 126 pkgs.libxcursor 127 pkgs.libxrandr 128 pkgs.libxi 129 ]; 130 }; 131 }; 132 }; 133}