# SPDX-FileCopyrightText: 2026 Alex Bates # # SPDX-License-Identifier: AGPL-3.0-or-later { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; treefmt-nix.url = "github:numtide/treefmt-nix"; font-switzer = { url = "https://api.fontshare.com/v2/fonts/download/switzer"; flake = false; }; parallel-rdp-standalone = { url = "github:gopher64/parallel-rdp-standalone/gopher64"; flake = false; }; }; outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; imports = [ inputs.treefmt-nix.flakeModule ]; perSystem = { config, pkgs, ... }: let font-switzer = pkgs.runCommand "font-switzer" { nativeBuildInputs = [ pkgs.unzip ]; } '' unzip ${inputs.font-switzer} -d $out ''; in { checks.reuse = pkgs.runCommand "reuse-lint" { nativeBuildInputs = [ pkgs.reuse ]; } '' cd ${./.} reuse lint touch $out ''; treefmt = { projectRootFile = "flake.nix"; programs.rustfmt.enable = true; programs.nixfmt.enable = true; settings.formatter.reuse-annotate = { command = pkgs.writeShellScriptBin "reuse-annotate" '' name=$(${pkgs.git}/bin/git config user.name) email=$(${pkgs.git}/bin/git config user.email) exec ${pkgs.reuse}/bin/reuse annotate \ --license "AGPL-3.0-or-later" \ --copyright "$name <$email>" \ --skip-existing \ --skip-unrecognised \ "$@" ''; includes = [ "*" ]; excludes = [ "flake.lock" "Cargo.lock" "LICENSE" "NOTICE" "LICENSES/*" ]; }; settings.global.excludes = [ "target/*" ".jj/*" ".git/*" ".direnv/*" ]; }; devShells.default = pkgs.mkShell { packages = [ pkgs.rustc pkgs.cargo pkgs.clippy pkgs.rustfmt pkgs.rust-analyzer pkgs.reuse config.treefmt.build.wrapper pkgs.pkg-config pkgs.dioxus-cli pkgs.just pkgs.clang ]; nativeBuildInputs = [ pkgs.rustPlatform.bindgenHook ]; buildInputs = with pkgs; [ wayland libxkbcommon vulkan-headers vulkan-loader libx11 libxcursor libxrandr libxi ]; SWITZER_FONT_DIR = "${font-switzer}"; PARALLEL_RDP_DIR = "${inputs.parallel-rdp-standalone}"; RUST_BACKTRACE = "1"; # https://github.com/DioxusLabs/dioxus/issues/4962 RUSTFLAGS = if pkgs.stdenv.hostPlatform.isx86_64 then "-Ctarget-cpu=x86-64" else "-Ctarget-cpu=generic"; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.wayland pkgs.libxkbcommon pkgs.vulkan-loader pkgs.libx11 pkgs.libxcursor pkgs.libxrandr pkgs.libxi ]; }; }; }; }