diff --git a/flake.nix b/flake.nix index 8ed9fbc..99d42da 100644 --- a/flake.nix +++ b/flake.nix @@ -133,51 +133,53 @@ }; outputs = - { self - , sops - , flake-parts - , ... - } @ inputs: - with inputs; let - machines = import ./machines inputs; - in - flake-parts.lib.mkFlake { inherit inputs; } { + { + self, + sops, + flake-parts, + ... + }@inputs: + with inputs; + let + machines = import ./machines inputs; + in + flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; - imports = [ - inputs.pre-commit-hooks.flakeModule - ]; + imports = [ inputs.pre-commit-hooks.flakeModule ]; - flake = { - lib = import ./lib inputs; + flake = { + lib = import ./lib inputs; - overlays.default = import ./overlays; + overlays.default = import ./overlays; - nixosModules = builtins.listToAttrs (map + nixosModules = builtins.listToAttrs ( + map (x: { name = x; value = import (./modules + "/${x}"); }) - (builtins.attrNames (builtins.readDir ./modules))); + (builtins.attrNames (builtins.readDir ./modules)) + ); - nixosConfigurations = builtins.listToAttrs (map + nixosConfigurations = builtins.listToAttrs ( + map (machine: { name = machine; - value = self.lib.defSystem (machines.${machine}.system or "x86_64-linux") - { - imports = [ - machines.${machine}.config - ]; - } - (machines.${machine}.deploy or null); + value = + self.lib.defSystem (machines.${machine}.system or "x86_64-linux") + { imports = [ machines.${machine}.config ]; } + (machines.${machine}.deploy or null); }) - (builtins.attrNames machines)); + (builtins.attrNames machines) + ); - colmena = { + colmena = + { meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; @@ -185,29 +187,41 @@ inherit nixpkgs; }; }; - } // builtins.listToAttrs (map - (machine: { - name = machine; - value = { - deployment = { - targetHost = machines.${machine}.deploy.host; - targetUser = "root"; # machines.${machine}.deploy.sshUser; - # targetUser = machines.${machine}.deploy.sshUser; - tags = machines.${machine}.deploy.tags or [ ]; + } + // builtins.listToAttrs ( + map + (machine: { + name = machine; + value = { + deployment = { + targetHost = machines.${machine}.deploy.host; + targetUser = "root"; # machines.${machine}.deploy.sshUser; + # targetUser = machines.${machine}.deploy.sshUser; + tags = machines.${machine}.deploy.tags or [ ]; + }; + imports = + self.lib.systemModules (machines.${machine}.system or "x86_64-linux") + machines.${machine}.config; }; - imports = self.lib.systemModules (machines.${machine}.system or "x86_64-linux") machines.${machine}.config; - }; - }) - (builtins.filter (machine: machines.${machine} ? deploy) (builtins.attrNames machines))); + }) + (builtins.filter (machine: machines.${machine} ? deploy) (builtins.attrNames machines)) + ); + }; - }; - - perSystem = { inputs', pkgs, config, ... }: { + perSystem = + { + inputs', + pkgs, + config, + lib, + ... + }: + { pre-commit = { settings = { hooks = { - nixpkgs-fmt.enable = true; + nixfmt.enable = true; deadnix.enable = true; black.enable = true; shellcheck = { @@ -216,6 +230,9 @@ }; shfmt.enable = true; }; + tools = { + nixfmt = lib.mkForce pkgs.nixfmt-rfc-style; + }; }; }; @@ -224,47 +241,49 @@ openfga = pkgs.callPackage ./pkgs/openfga { }; }; - devShells.default = with pkgs; mkShell { - name = "dotfiles"; - packages = [ - age - colmena - just - nodejs - nodePackages.typescript-language-server - nodePackages.yaml-language-server - nodePackages.vscode-css-languageserver-bin - nodePackages.prettier - multimarkdown - nix-diff - nixfmt - nix-prefetch - nix-prefetch-docker - nix-prefetch-github - nix-prefetch-scripts - nix-tree - nix-top - pciutils - pkgs.sops - ssh-to-age - taplo + devShells.default = + with pkgs; + mkShell { + name = "dotfiles"; + packages = [ + age + colmena + just + nodejs + nodePackages.typescript-language-server + nodePackages.yaml-language-server + nodePackages.vscode-css-languageserver-bin + nodePackages.prettier + multimarkdown + nix-diff + nixfmt-rfc-style + nix-prefetch + nix-prefetch-docker + nix-prefetch-github + nix-prefetch-scripts + nix-tree + nix-top + pciutils + pkgs.sops + ssh-to-age + taplo - inputs'.disko.packages.disko - ]; + inputs'.disko.packages.disko + ]; - shellHook = '' - ${config.pre-commit.installationScript} - ''; - }; + shellHook = '' + ${config.pre-commit.installationScript} + ''; + }; - devShells.install = with pkgs; mkShell { - name = "install"; - packages = [ - inputs'.disko.packages.disko - ]; - }; + devShells.install = + with pkgs; + mkShell { + name = "install"; + packages = [ inputs'.disko.packages.disko ]; + }; - formatter = pkgs.nixpkgs-fmt; + formatter = pkgs.nixfmt-rfc-style; }; - }; + }; }