Use pre-commit to format before commit

This commit is contained in:
Invariantspace 2024-08-14 12:10:34 -07:00
parent 52a81ddb21
commit 6c663d59f5
No known key found for this signature in database
GPG key ID: EBC4A20067373921
3 changed files with 211 additions and 63 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.pre-commit-config.yaml

181
flake.lock generated
View file

@ -19,11 +19,11 @@
"candy-icons": {
"flake": false,
"locked": {
"lastModified": 1722381303,
"narHash": "sha256-pmw3lflD1Kq/qO6iGDh3myWQF8mm1FABZPFB8/1Ql7Q=",
"lastModified": 1723591882,
"narHash": "sha256-XAB+Ai7r5n/125mmkc/J0J1aPjFgQGeRPT+vc2LP6cE=",
"ref": "refs/heads/master",
"rev": "5918a12632bf9c768cd1ad7a161076e3d72da60d",
"revCount": 1206,
"rev": "eba39aed603a255ed756ed601e87349561217ef0",
"revCount": 1211,
"type": "git",
"url": "https://github.com/EliverLara/candy-icons"
},
@ -66,6 +66,22 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -84,6 +100,45 @@
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hardware": {
"locked": {
"lastModified": 1723310128,
@ -144,11 +199,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1723367191,
"narHash": "sha256-noi5tre7BLtxImN38jEHeVOtOG1Xu37sJFwHKSAPHjo=",
"lastModified": 1723607977,
"narHash": "sha256-ueu9wxOlTYyxhmPEwlRB5uhPOdDXY4n7+rd+hiPBAzU=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "91178062f365b64eece94c5dff93e09b07e87d9d",
"rev": "9b87c1c781af3cd837847f7042723b76f6d7472e",
"type": "github"
},
"original": {
@ -181,7 +236,7 @@
"nix-custom": {
"inputs": {
"candy-icons": "candy-icons",
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_5",
"sweet-ambar-blue": "sweet-ambar-blue",
"sweet-ambar-blue-dark": "sweet-ambar-blue-dark",
@ -193,11 +248,11 @@
"yorha-sound-theme": "yorha-sound-theme"
},
"locked": {
"lastModified": 1723137877,
"narHash": "sha256-KHGoG3N1g8TqluIBXjKE6vmKSTR/htbU5GHEbQqf5eg=",
"lastModified": 1723604710,
"narHash": "sha256-/h5FHkEDl8YCwSUqxeoS29ZAo4FOZWHcRBKZKi+zpiE=",
"ref": "refs/heads/main",
"rev": "f2b3d31ff6110df18f3052c00874882f6902623b",
"revCount": 24,
"rev": "b7bde14d75173b987b6b6be016434c18c2bd09a1",
"revCount": 25,
"type": "git",
"url": "https://forgejo.invariantspace.com/macronova/nix-custom"
},
@ -260,6 +315,22 @@
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1721524707,
"narHash": "sha256-5NctRsoE54N86nWd0psae70YSLfrOek3Kv1e8KoXe/0=",
@ -324,11 +395,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1722813957,
"narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=",
"lastModified": 1723362943,
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa",
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
"type": "github"
},
"original": {
@ -371,6 +442,22 @@
}
},
"nixpkgs_8": {
"locked": {
"lastModified": 1719082008,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1721466660,
"narHash": "sha256-pFSxgSZqZ3h+5Du0KvEL1ccDZBwu4zvOil1zzrPNb3c=",
@ -392,11 +479,11 @@
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1723560829,
"narHash": "sha256-aSPUFNZKc3x6QCP9pgW9tI6UlExcqET9Fa+JhVJYb+A=",
"lastModified": 1723587631,
"narHash": "sha256-FZ27DsgOROvv/4Cvo34UcIqEJLQ6cKIWHcQsM3zLN3I=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "6e817b1c8530e4241ed9cef6edfac5fe281ee01c",
"rev": "76dab4ba280ddd1b6c5aec0bb0aa0ace201c39ae",
"type": "github"
},
"original": {
@ -405,9 +492,31 @@
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_8",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723202784,
"narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "c7012d0c18567c889b948781bc74a501e92275d1",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"flake-utils": "flake-utils",
"hardware": "hardware",
"home-manager": "home-manager",
"jovian": "jovian",
@ -415,13 +524,14 @@
"nix-custom": "nix-custom",
"nixpkgs": "nixpkgs_6",
"plasma-manager": "plasma-manager",
"pre-commit-hooks": "pre-commit-hooks",
"sops-nix": "sops-nix"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_8",
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs": "nixpkgs_9",
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1723501126,
@ -440,11 +550,11 @@
"sweet-ambar-blue": {
"flake": false,
"locked": {
"lastModified": 1722888146,
"narHash": "sha256-F7L5bivxZk1xPXXAmEpcOHuGPvrRO93iLBxn+tn/Y2w=",
"lastModified": 1723587745,
"narHash": "sha256-IdOwZM+r9yiWaNnobVGtMjGLGHjQHH0sf/yCFUxIT+0=",
"ref": "Ambar-Blue",
"rev": "c30e19efe7de4756fc82570150bf8c338a0f3fa9",
"revCount": 293,
"rev": "e133a6b40b0a5d5c8c2163de9b36150b285d15f2",
"revCount": 294,
"type": "git",
"url": "https://github.com/EliverLara/Sweet"
},
@ -457,11 +567,11 @@
"sweet-ambar-blue-dark": {
"flake": false,
"locked": {
"lastModified": 1722886075,
"narHash": "sha256-eQ6FTWUr1ViAKN0dSgz5sl0RCPolUGh6gRtaQbRIFnk=",
"lastModified": 1723587757,
"narHash": "sha256-qrbf1vrFgCxM8p5zAZvYCeoZlG6Mfy9UUbLx9PKUiKM=",
"ref": "Ambar-Blue-Dark",
"rev": "89ed1768bb4f69305643313f3abe2cda167c447c",
"revCount": 377,
"rev": "b96bed2f0a22c4431f944489bb37a45bc16e9300",
"revCount": 378,
"type": "git",
"url": "https://github.com/EliverLara/Sweet"
},
@ -519,6 +629,21 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"wallpaper-engine-plasma5-plugin": {
"flake": false,
"locked": {

View file

@ -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);
};
);
}