Use pre-commit to format before commit
This commit is contained in:
parent
52a81ddb21
commit
6c663d59f5
3 changed files with 211 additions and 63 deletions
92
flake.nix
92
flake.nix
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
inputs = {
|
||||
disko.url = "github:nix-community/disko";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
hardware.url = "github:nixos/nixos-hardware";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
|
||||
|
|
@ -10,54 +11,75 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nix-custom.url = "git+https://forgejo.invariantspace.com/macronova/nix-custom";
|
||||
plasma-manager.url = "github:pjones/plasma-manager";
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
nix-custom,
|
||||
pre-commit-hooks,
|
||||
...
|
||||
}: let
|
||||
linuxCfgDir = ./linux;
|
||||
templateDir = ./template;
|
||||
in {
|
||||
nixosConfigurations =
|
||||
builtins.mapAttrs
|
||||
(instance: _:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
# Import config from folder
|
||||
(linuxCfgDir + "/${instance}")
|
||||
# Setup Nix
|
||||
({pkgs, ...}: {
|
||||
networking.hostName = instance;
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 30d";
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
builtins.mapAttrs
|
||||
(instance: _:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
# Import config from folder
|
||||
(linuxCfgDir + "/${instance}")
|
||||
# Setup Nix
|
||||
({pkgs, ...}: {
|
||||
networking.hostName = instance;
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
trusted-substituters = ["https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"];
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
trusted-substituters = ["https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"];
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = [nix-custom.overlays.default];
|
||||
};
|
||||
};
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = [nix-custom.overlays.default];
|
||||
};
|
||||
})
|
||||
];
|
||||
specialArgs = {inherit inputs;};
|
||||
})
|
||||
];
|
||||
specialArgs = {inherit inputs;};
|
||||
})
|
||||
(builtins.readDir linuxCfgDir);
|
||||
templates =
|
||||
builtins.mapAttrs
|
||||
(template: _: {
|
||||
path = templateDir + "/${template}";
|
||||
description = "Template flake setup: ${template}";
|
||||
})
|
||||
(builtins.readDir linuxCfgDir);
|
||||
templates =
|
||||
builtins.mapAttrs
|
||||
(template: _: {
|
||||
path = templateDir + "/${template}";
|
||||
description = "Template flake setup: ${template}";
|
||||
(builtins.readDir templateDir);
|
||||
}
|
||||
// (
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks.alejandra.enable = true;
|
||||
};
|
||||
devShells.default = let
|
||||
pre-commit = self.checks.${system}.pre-commit-check;
|
||||
in
|
||||
pkgs.mkShell {
|
||||
inherit (pre-commit) shellHook;
|
||||
buildInputs = pre-commit.enabledPackages;
|
||||
};
|
||||
})
|
||||
(builtins.readDir templateDir);
|
||||
};
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue