{ description = "Ray's Nix Config"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; zen-browser.url = "github:0xc000022070/zen-browser-flake"; zen-browser.inputs.nixpkgs.follows = "nixpkgs"; ghostty.url = "github:ghostty-org/ghostty"; nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; git-hooks.url = "github:cachix/git-hooks.nix"; git-hooks.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self, nixpkgs, home-manager, treefmt-nix, ... } @ inputs: let inherit (self) outputs; system = "x86_64-linux"; dots = "/home/rayandrew/dotfiles"; user = "rayandrew"; pkgs = import inputs.nixpkgs { inherit system; config.allowUnfree = true; }; lib = nixpkgs.lib; createCommonArgs = system: { inherit self inputs nixpkgs lib pkgs system dots ; specialArgs = { inherit self inputs; }; }; commonArgs = createCommonArgs system; # call with forAllSystems (commonArgs: function body) forAllSystems = fn: lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: fn (createCommonArgs system)); treefmtEval = forAllSystems ( { pkgs, ... }: treefmt-nix.lib.evalModule pkgs { projectRootFile = "flake.nix"; programs.nixfmt-rfc-style.enable = true; settings.global.excludes = [ "flake.lock" ]; } ); in (import ./hosts commonArgs) // { checks = forAllSystems ( { pkgs, system, ... }: { formatting = treefmtEval.${system}.config.build.check self; pre-commit-check = inputs.git-hooks.lib.${system}.run { src = ./.; excludes = [ "flake.lock" ]; hooks = { treefmt = { enable = true; package = lib.mkForce treefmtEval.${system}.config.build.wrapper; args = [ # "--config-file ${treefmtEval.${system}.config.build.configFile}" ]; }; }; }; } ); devShells = forAllSystems ( { pkgs, system, ... }: { default = pkgs.mkShell { inherit (self.checks.${system}.pre-commit-check) shellHook; name = "dotfiles"; buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; nativeBuildInputs = [ treefmtEval.${system}.config.build.wrapper ]; packages = with pkgs; [ sops age ssh-to-age nixfmt-rfc-style ]; DIRENV_LOG_FORMAT = ""; }; } ); formatter = forAllSystems ({ system, ... }: treefmtEval.${system}.config.build.wrapper); }; }