Switch to nixfmt-rfc-style formatter
In anticipation of [RFC 166](https://github.com/NixOS/rfcs/pull/166)
This commit is contained in:
parent
3c0d05a6d3
commit
d2f4471b42
1 changed files with 105 additions and 86 deletions
191
flake.nix
191
flake.nix
|
@ -133,51 +133,53 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ self
|
{
|
||||||
, sops
|
self,
|
||||||
, flake-parts
|
sops,
|
||||||
, ...
|
flake-parts,
|
||||||
} @ inputs:
|
...
|
||||||
with inputs; let
|
}@inputs:
|
||||||
machines = import ./machines inputs;
|
with inputs;
|
||||||
in
|
let
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
machines = import ./machines inputs;
|
||||||
|
in
|
||||||
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
|
|
||||||
systems = [
|
systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
imports = [
|
imports = [ inputs.pre-commit-hooks.flakeModule ];
|
||||||
inputs.pre-commit-hooks.flakeModule
|
|
||||||
];
|
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
lib = import ./lib inputs;
|
lib = import ./lib inputs;
|
||||||
|
|
||||||
overlays.default = import ./overlays;
|
overlays.default = import ./overlays;
|
||||||
|
|
||||||
nixosModules = builtins.listToAttrs (map
|
nixosModules = builtins.listToAttrs (
|
||||||
|
map
|
||||||
(x: {
|
(x: {
|
||||||
name = x;
|
name = x;
|
||||||
value = import (./modules + "/${x}");
|
value = import (./modules + "/${x}");
|
||||||
})
|
})
|
||||||
(builtins.attrNames (builtins.readDir ./modules)));
|
(builtins.attrNames (builtins.readDir ./modules))
|
||||||
|
);
|
||||||
|
|
||||||
nixosConfigurations = builtins.listToAttrs (map
|
nixosConfigurations = builtins.listToAttrs (
|
||||||
|
map
|
||||||
(machine: {
|
(machine: {
|
||||||
name = machine;
|
name = machine;
|
||||||
value = self.lib.defSystem (machines.${machine}.system or "x86_64-linux")
|
value =
|
||||||
{
|
self.lib.defSystem (machines.${machine}.system or "x86_64-linux")
|
||||||
imports = [
|
{ imports = [ machines.${machine}.config ]; }
|
||||||
machines.${machine}.config
|
(machines.${machine}.deploy or null);
|
||||||
];
|
|
||||||
}
|
|
||||||
(machines.${machine}.deploy or null);
|
|
||||||
})
|
})
|
||||||
(builtins.attrNames machines));
|
(builtins.attrNames machines)
|
||||||
|
);
|
||||||
|
|
||||||
colmena = {
|
colmena =
|
||||||
|
{
|
||||||
meta = {
|
meta = {
|
||||||
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
|
|
||||||
|
@ -185,29 +187,41 @@
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // builtins.listToAttrs (map
|
}
|
||||||
(machine: {
|
// builtins.listToAttrs (
|
||||||
name = machine;
|
map
|
||||||
value = {
|
(machine: {
|
||||||
deployment = {
|
name = machine;
|
||||||
targetHost = machines.${machine}.deploy.host;
|
value = {
|
||||||
targetUser = "root"; # machines.${machine}.deploy.sshUser;
|
deployment = {
|
||||||
# targetUser = machines.${machine}.deploy.sshUser;
|
targetHost = machines.${machine}.deploy.host;
|
||||||
tags = machines.${machine}.deploy.tags or [ ];
|
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 =
|
||||||
|
{
|
||||||
perSystem = { inputs', pkgs, config, ... }: {
|
inputs',
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
pre-commit = {
|
pre-commit = {
|
||||||
settings = {
|
settings = {
|
||||||
hooks = {
|
hooks = {
|
||||||
nixpkgs-fmt.enable = true;
|
nixfmt.enable = true;
|
||||||
deadnix.enable = true;
|
deadnix.enable = true;
|
||||||
black.enable = true;
|
black.enable = true;
|
||||||
shellcheck = {
|
shellcheck = {
|
||||||
|
@ -216,6 +230,9 @@
|
||||||
};
|
};
|
||||||
shfmt.enable = true;
|
shfmt.enable = true;
|
||||||
};
|
};
|
||||||
|
tools = {
|
||||||
|
nixfmt = lib.mkForce pkgs.nixfmt-rfc-style;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -224,47 +241,49 @@
|
||||||
openfga = pkgs.callPackage ./pkgs/openfga { };
|
openfga = pkgs.callPackage ./pkgs/openfga { };
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = with pkgs; mkShell {
|
devShells.default =
|
||||||
name = "dotfiles";
|
with pkgs;
|
||||||
packages = [
|
mkShell {
|
||||||
age
|
name = "dotfiles";
|
||||||
colmena
|
packages = [
|
||||||
just
|
age
|
||||||
nodejs
|
colmena
|
||||||
nodePackages.typescript-language-server
|
just
|
||||||
nodePackages.yaml-language-server
|
nodejs
|
||||||
nodePackages.vscode-css-languageserver-bin
|
nodePackages.typescript-language-server
|
||||||
nodePackages.prettier
|
nodePackages.yaml-language-server
|
||||||
multimarkdown
|
nodePackages.vscode-css-languageserver-bin
|
||||||
nix-diff
|
nodePackages.prettier
|
||||||
nixfmt
|
multimarkdown
|
||||||
nix-prefetch
|
nix-diff
|
||||||
nix-prefetch-docker
|
nixfmt-rfc-style
|
||||||
nix-prefetch-github
|
nix-prefetch
|
||||||
nix-prefetch-scripts
|
nix-prefetch-docker
|
||||||
nix-tree
|
nix-prefetch-github
|
||||||
nix-top
|
nix-prefetch-scripts
|
||||||
pciutils
|
nix-tree
|
||||||
pkgs.sops
|
nix-top
|
||||||
ssh-to-age
|
pciutils
|
||||||
taplo
|
pkgs.sops
|
||||||
|
ssh-to-age
|
||||||
|
taplo
|
||||||
|
|
||||||
inputs'.disko.packages.disko
|
inputs'.disko.packages.disko
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${config.pre-commit.installationScript}
|
${config.pre-commit.installationScript}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.install = with pkgs; mkShell {
|
devShells.install =
|
||||||
name = "install";
|
with pkgs;
|
||||||
packages = [
|
mkShell {
|
||||||
inputs'.disko.packages.disko
|
name = "install";
|
||||||
];
|
packages = [ inputs'.disko.packages.disko ];
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue