# github.com/brianmcgee has lots of great ideas for going above and beyond for this { description = "Greg's homepage"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; devshell.url = "github:numtide/devshell"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-root.url = "github:srid/flake-root"; hooks.url = "github:cachix/git-hooks.nix"; naersk.url = "github:nix-community/naersk"; }; outputs = { flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ inputs.devshell.flakeModule inputs.flake-root.flakeModule #inputs.process-compose.flakeModule ]; flake = { # Universal things # final: prev: overlays.default = _: _: { }; }; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; perSystem = { pkgs, ... }@inputs': let naersk-lib = pkgs.callPackage inputs.naersk { }; in { _module.args.pkgs = import inputs.nixpkgs { inherit (inputs') system; overlays = [ ]; }; # https://numtide.github.io/devshell/intro.html devshells.default = rec { # These commands will be shown in the motd that users read # upon entering the shell packages = with pkgs; [ expat fontconfig freetype freetype.dev libGL pkg-config xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr wayland libxkbcommon ]; env = [ { name = "LD_LIBRARY_PATH"; value = builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" packages; } ]; commands = [ { package = pkgs.cargo; category = "tools"; help = "Rust build and package tool"; } { package = pkgs.rustc; category = "languages"; help = "Rust compiler"; } { package = pkgs.rustfmt; category = "tools"; help = "Standard Rust formatting tool"; } { package = pkgs.clippy; category = "tools"; help = "Rust linter"; } { package = pkgs.stdenv.cc; category = "languages"; help = "C compiler to help with building native code"; } { package = pkgs.pre-commit; category = "tools"; help = "Tool to help enforce commits make sense"; } ]; }; checks = { pre-commit-check = inputs.hooks.lib.${inputs'.system}.run { src = ./.; hooks = { check-added-large-files.enable = true; check-case-conflicts.enable = true; check-merge-conflicts.enable = true; check-symlinks.enable = true; deadnix.enable = true; end-of-file-fixer.enable = true; fix-byte-order-marker.enable = true; mixed-line-endings.enable = true; nixfmt-rfc-style.enable = true; trim-trailing-whitespace.enable = true; # Rust hooks cargo-check.enable = true; clippy.enable = true; rustfmt.enable = true; }; }; }; # This is not special, this is just flakes packages = { rustpkg = naersk-lib.buildPackage ./.; }; }; }; }