Add allHosts script and formatting app
This commit is contained in:
parent
66092ec8e5
commit
31e4a7f56f
1 changed files with 16 additions and 9 deletions
25
flake.nix
25
flake.nix
|
@ -21,6 +21,7 @@
|
||||||
inherit system;
|
inherit system;
|
||||||
config.allowUnfree = true; # For vscode
|
config.allowUnfree = true; # For vscode
|
||||||
};
|
};
|
||||||
|
hosts = [ "speer" "hummelberg" ];
|
||||||
in {
|
in {
|
||||||
checks.${system}.formatCheck = let pkgs = pkgsUnstable;
|
checks.${system}.formatCheck = let pkgs = pkgsUnstable;
|
||||||
in pkgs.runCommand "nixfmt-check" { } ''
|
in pkgs.runCommand "nixfmt-check" { } ''
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
# Build with `nixos-rebuild --flake .#<hostname>` or
|
# Build with `nixos-rebuild --flake .#<hostname>` or
|
||||||
# `nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
# `nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
hosts = [ "speer" "hummelberg" ];
|
|
||||||
home-manager-config = {
|
home-manager-config = {
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
|
@ -80,14 +80,21 @@
|
||||||
};
|
};
|
||||||
devShell.${system} = import ./shell.nix { pkgs = pkgsUnstable; };
|
devShell.${system} = import ./shell.nix { pkgs = pkgsUnstable; };
|
||||||
|
|
||||||
apps.${system}.format = let
|
packages.${system}.defaultPackage.${system} = let
|
||||||
pkgs = pkgsUnstable;
|
configs = map (host: self.nixosConfigurations.${host}.config.system.build.toplevel) hosts;
|
||||||
formatter = pkgsUnstable.writeShellScriptBin "formatter" ''
|
in pkgsUnstable.linkFarmFromDrvs "allHosts" configs;
|
||||||
${pkgs.findutils}/bin/find . -type f -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt {} +
|
|
||||||
'';
|
|
||||||
in {
|
apps.${system} = {
|
||||||
type = "app";
|
format = let
|
||||||
program = "${formatter}/bin/formatter";
|
pkgs = pkgsUnstable;
|
||||||
|
formatter = pkgsUnstable.writeShellScriptBin "formatter" ''
|
||||||
|
${pkgs.findutils}/bin/find . -type f -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt {} +
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
type = "app";
|
||||||
|
program = "${formatter}/bin/formatter";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue