{ inputs = { flake-parts.url = "github:hercules-ci/flake-parts"; git-hooks.url = "github:cachix/git-hooks.nix"; nixops4.follows = "nixops4-nixos/nixops4"; nixops4-nixos.url = "github:nixops4/nixops4-nixos"; }; outputs = inputs@{ self, flake-parts, ... }: let sources = import ./npins; inherit (import sources.flake-inputs) import-flake; inherit (sources) git-hooks agenix; # XXX(@fricklerhandwerk): this atrocity is required to splice in a foreign Nixpkgs via flake-parts # XXX - this is just importing a flake nixpkgs = import-flake { src = sources.nixpkgs; }; # XXX - this overrides the inputs attached to `self` inputs' = self.inputs // { nixpkgs = nixpkgs; }; self' = self // { inputs = inputs'; }; in # XXX - finally we override the overall set of `inputs` -- we need both: # `flake-parts obtains `nixpkgs` from `self.inputs` and not from `inputs`. flake-parts.lib.mkFlake { inputs = inputs // { inherit nixpkgs; }; self = self'; } ( { inputs, ... }: { systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; imports = [ "${git-hooks}/flake-module.nix" inputs.nixops4.modules.flake.default ./deployment/flake-part.nix ./infra/flake-part.nix ]; perSystem = { pkgs, lib, inputs', ... }: { formatter = pkgs.nixfmt-rfc-style; pre-commit.settings.hooks = let ## Add a directory here if pre-commit hooks shouldn't apply to it. optout = [ "npins" ]; excludes = map (dir: "^${dir}/") optout; addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; }); in addExcludes { nixfmt-rfc-style.enable = true; deadnix.enable = true; trim-trailing-whitespace.enable = true; shellcheck.enable = true; }; devShells.default = pkgs.mkShell { packages = [ pkgs.npins pkgs.nil (pkgs.callPackage "${agenix}/pkgs/agenix.nix" { }) pkgs.openssh pkgs.httpie pkgs.jq # exposing this env var as a hack to pass info in from form (inputs'.nixops4.packages.default.overrideAttrs { impureEnvVars = [ "DEPLOYMENT" ]; }) ]; }; }; } ); }