{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; pre-commit-hooks.url = "github:cachix/git-hooks.nix"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = inputs @ { self, nixpkgs, flake-parts, pre-commit-hooks, rust-overlay, ... }: flake-parts.lib.mkFlake {inherit inputs;} ({withSystem, ...}: { flake.nixosModules.default = {pkgs, ...}: { imports = [./nix/module.nix]; services.canwa.package = withSystem pkgs.stdenv.hostPlatform.system ( {config, ...}: config.packages.default ); }; systems = ["x86_64-linux"]; perSystem = { lib, pkgs, system, ... }: let toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; libs = []; in { _module.args.pkgs = import nixpkgs { inherit system; overlays = [rust-overlay.overlays.default]; }; packages.default = pkgs.callPackage ./nix {}; checks.pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { # Nix formatting alejandra.enable = true; # Toml formatting taplo.enable = true; # Rust formatting and linting rustfmt = { enable = true; packageOverrides = { cargo = toolchain; rustfmt = toolchain; }; }; clippy = { enable = true; packageOverrides = { cargo = toolchain; clippy = toolchain; }; settings = { denyWarnings = true; }; }; # Spell checking typos.enable = true; }; }; devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ # build clang mold # tools just ] ++ libs ++ [ toolchain self.checks.${system}.pre-commit-check.enabledPackages ]; LD_LIBRARY_PATH = lib.makeLibraryPath libs; shellHook = '' ${self.checks.${system}.pre-commit-check.shellHook} ''; }; }; }); }