Switch to nixfmt-rfc-style formatter

In anticipation of [RFC 166](https://github.com/NixOS/rfcs/pull/166)
This commit is contained in:
Erwin Boskma 2024-02-05 11:10:13 +01:00
parent 3c0d05a6d3
commit d2f4471b42
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk

View file

@ -133,12 +133,14 @@
};
outputs =
{ self
, sops
, flake-parts
, ...
{
self,
sops,
flake-parts,
...
}@inputs:
with inputs; let
with inputs;
let
machines = import ./machines inputs;
in
flake-parts.lib.mkFlake { inherit inputs; } {
@ -148,36 +150,36 @@
"aarch64-linux"
];
imports = [
inputs.pre-commit-hooks.flakeModule
];
imports = [ inputs.pre-commit-hooks.flakeModule ];
flake = {
lib = import ./lib inputs;
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
];
}
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,7 +187,9 @@
inherit nixpkgs;
};
};
} // builtins.listToAttrs (map
}
// builtins.listToAttrs (
map
(machine: {
name = machine;
value = {
@ -195,19 +199,29 @@
# 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,7 +241,9 @@
openfga = pkgs.callPackage ./pkgs/openfga { };
};
devShells.default = with pkgs; mkShell {
devShells.default =
with pkgs;
mkShell {
name = "dotfiles";
packages = [
age
@ -237,7 +256,7 @@
nodePackages.prettier
multimarkdown
nix-diff
nixfmt
nixfmt-rfc-style
nix-prefetch
nix-prefetch-docker
nix-prefetch-github
@ -257,14 +276,14 @@
'';
};
devShells.install = with pkgs; mkShell {
devShells.install =
with pkgs;
mkShell {
name = "install";
packages = [
inputs'.disko.packages.disko
];
packages = [ inputs'.disko.packages.disko ];
};
formatter = pkgs.nixpkgs-fmt;
formatter = pkgs.nixfmt-rfc-style;
};
};
}