1
0
Fork 0

Introduce pre-commit-hooks.nix

This commit is contained in:
Daniel Kempkens 2023-07-17 00:17:50 +02:00
parent 1302a7bfdf
commit f1224473a9
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
46 changed files with 218 additions and 82 deletions

1
.pre-commit-config.yaml Symbolic link
View file

@ -0,0 +1 @@
/nix/store/rkdyfyp0x0nwvdq80b7vss4n599davvd-pre-commit-config.json

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, ... }:
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, ... }:
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, ... }:
let let
secret = import ../../secret/container/weewx; secret = import ../../secret/container/weewx;

View file

@ -177,6 +177,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -261,6 +277,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -283,6 +317,27 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_2": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -379,11 +434,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1689281837, "lastModified": 1689516967,
"narHash": "sha256-msgwgot2/hxXzlpYltIZ7boAqBkN8XejNOhBJ07q3FY=", "narHash": "sha256-sFAa33wkQHanmij/uhfGduIDK8z4dJAita/rK6u9pvE=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "c806a73609e77f0c446fdad5d3ea6ca3b7ae6e5f", "rev": "61662a63bfe1726588c1da6b412df86d8ca94d63",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -476,6 +531,46 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1689328505,
"narHash": "sha256-9B3+OeUn1a/CvzE3GW6nWNwS5J7PDHTyHGlpL3wV5oA=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5e28316db471d1ac234beb70031b635437421dd6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
@ -489,6 +584,7 @@
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
} }
}, },
@ -534,6 +630,21 @@
"type": "github" "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"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -15,6 +15,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Overlays # Overlays
disko = { disko = {
@ -115,6 +120,7 @@
imports = [ imports = [
inputs.flake-root.flakeModule inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
]; ];
systems = [ systems = [
@ -135,12 +141,29 @@
}; };
}; };
pre-commit = {
settings = {
excludes = [ "\\.direnv\\/" ];
hooks = {
deadnix.enable = true;
statix.enable = true;
treefmt.enable = true;
};
settings = {
statix.ignore = [ ".direnv/**/*.nix" ];
};
};
};
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "dotfiles"; name = "dotfiles";
inputsFrom = [ inputsFrom = [
config.flake-root.devShell config.flake-root.devShell
config.treefmt.build.devShell config.treefmt.build.devShell
config.pre-commit.devShell
]; ];
}; };
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: { lib, modulesPath, ... }:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: { lib, modulesPath, ... }:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: { lib, modulesPath, ... }:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

View file

@ -27,14 +27,13 @@
(highlight :IlluminatedWordText {:bg mod.colors.selection}) (highlight :IlluminatedWordText {:bg mod.colors.selection})
(highlight :IlluminatedWordRead {:bg mod.colors.selection}) (highlight :IlluminatedWordRead {:bg mod.colors.selection})
(highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true}) (highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true})
;; nvim-ts-rainbow2 ;; rainbow-delimiters
(highlight :TSRainbowRed {:fg mod.colors.red}) (highlight :RainbowDelimiterRed {:fg mod.colors.red})
(highlight :TSRainbowYellow {:fg mod.colors.yellow}) (highlight :RainbowDelimiterYellow {:fg mod.colors.yellow})
(highlight :TSRainbowBlue {:fg mod.colors.purple}) (highlight :RainbowDelimiterBlue {:fg mod.colors.purple})
(highlight :TSRainbowOrange {:fg mod.colors.orange}) (highlight :RainbowDelimiterOrange {:fg mod.colors.orange})
(highlight :TSRainbowGreen {:fg mod.colors.green}) (highlight :RainbowDelimiterGreen {:fg mod.colors.green})
(highlight :TSRainbowViolet {:fg mod.colors.pink}) (highlight :RainbowDelimiterViolet {:fg mod.colors.pink})
(highlight :TSRainbowCyan {:fg mod.colors.cyan})) (highlight :RainbowDelimiterCyan {:fg mod.colors.cyan}))
mod) mod)

View file

@ -0,0 +1,12 @@
(let [rainbow-delimiters (require :rainbow-delimiters)]
(set vim.g.rainbow_delimiters
{:strategy {"" (. rainbow-delimiters :strategy :global)
:vim (. rainbow-delimiters :strategy :local)}
:query {"" :rainbow-delimiters :lua :rainbow-blocks}
:highlight [:RainbowDelimite
:RainbowDelimiterYellow
:RainbowDelimiterBlue
:RainbowDelimiterOrange
:RainbowDelimiterGreen
:RainbowDelimiterViolet
:RainbowDelimiterCyan]}))

View file

@ -48,17 +48,9 @@
:if "@function.inner" :if "@function.inner"
:ac "@conditional.outer" :ac "@conditional.outer"
:ic "@conditional.inner"}}} :ic "@conditional.inner"}}}
:rainbow {:enable true
:disable (vim.tbl_filter (fn [parser]
(not (vim.tbl_contains rainbow-parsers
parser)))
install-parsers)
:query :rainbow-parens
:strategy (require :ts-rainbow.strategy.global)}
:matchup {:enable true :disable disable-parsers} :matchup {:enable true :disable disable-parsers}
:autopairs {:enable true :disable disable-parsers} :autopairs {:enable true :disable disable-parsers}
:autotag {:enable true :disable disable-parsers} :autotag {:enable true :disable disable-parsers}
:playground {:enable true} :playground {:enable true}
:nifoc_hooks {:enable true :nifoc_hooks {:enable true
:disable disable-parsers}})) :disable disable-parsers}}))

View file

@ -1,4 +1,4 @@
args@{ pkgs, config, lib, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
args@{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
args@{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
args@{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
args@{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
args@{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,5 +1,3 @@
{ pkgs, lib, ... }:
{ {
programs.atuin = { programs.atuin = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }: { pkgs, lib, ... }:
let let
inherit (pkgs) fetchFromGitHub; inherit (pkgs) fetchFromGitHub;

View file

@ -1,5 +1,3 @@
{ pkgs, ... }:
{ {
programs.fzf = { programs.fzf = {
enable = true; enable = true;

View file

@ -1,5 +1,3 @@
{ pkgs, ... }:
{ {
programs.gpg = { programs.gpg = {
enable = true; enable = true;

View file

@ -106,7 +106,7 @@ in
let let
customPlugins = import ./plugins.nix { inherit pkgs; }; customPlugins = import ./plugins.nix { inherit pkgs; };
in in
(with customPlugins; [ with customPlugins; [
# Utils # Utils
popup-nvim popup-nvim
plenary-nvim plenary-nvim
@ -162,7 +162,12 @@ in
type = "fennel"; type = "fennel";
} }
nvim-ts-rainbow2 {
plugin = rainbow-delimiters-nvim;
config = builtins.readFile ../../config/nvim/plugins/rainbow-delimiters.fnl;
type = "fennel";
}
playground playground
# Telescope # Telescope
@ -338,7 +343,7 @@ in
config = builtins.readFile ../../config/nvim/plugins/noice.fnl; config = builtins.readFile ../../config/nvim/plugins/noice.fnl;
type = "fennel"; type = "fennel";
} }
]); ];
}; };
xdg.configFile."nvim" = { xdg.configFile."nvim" = {

View file

@ -107,12 +107,12 @@ in
}; };
dracula-nvim = buildVimPluginFrom2Nix { dracula-nvim = buildVimPluginFrom2Nix {
pname = "dracula.nvim"; pname = "dracula.nvim";
version = "2023-07-13"; version = "2023-07-16";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "Mofiqul"; owner = "Mofiqul";
repo = "dracula.nvim"; repo = "dracula.nvim";
rev = "9db13329e205aaee089e25be8113bd1faeca674e"; rev = "948d237241b91389c8c2f109885b91cd2574b8bb";
sha256 = "1f79jazw5kp0ica4hdxpjry79qii8q6a0shg2rqkhpd0a8ydb8rg"; sha256 = "09cgyskfmqnp0gl1qbwfij8a6r6c0frgbj39zjx15frbhraygpdb";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -127,14 +127,14 @@ in
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
nvim-ts-rainbow2 = buildVimPluginFrom2Nix { rainbow-delimiters-nvim = buildVimPluginFrom2Nix {
pname = "nvim-ts-rainbow2"; pname = "rainbow-delimiters.nvim";
version = "2023-07-12"; version = "2023-07-16";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "HiPhish"; owner = "HiPhish";
repo = "nvim-ts-rainbow2"; repo = "rainbow-delimiters.nvim";
rev = "b3120cd5ae9ca524af9cb602f41e12e301fa985f"; rev = "a9f2bb9777a4b2a5178df09fcb7c30e5664949bc";
sha256 = "0mjg0pkd8wv8cfar30lkyywdrd3g5lz36bbsfb7lrqi7kbksyzxv"; sha256 = "0l542mlncq6c3p8d866zlzx12g3wil39xy4bq99nxlsjsmyhin7g";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -286,12 +286,12 @@ in
}; };
nvim-lint = buildVimPluginFrom2Nix { nvim-lint = buildVimPluginFrom2Nix {
pname = "nvim-lint"; pname = "nvim-lint";
version = "2023-07-13"; version = "2023-07-16";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mfussenegger"; owner = "mfussenegger";
repo = "nvim-lint"; repo = "nvim-lint";
rev = "808e8fdbee02ed2c6efc17e70c7453fccf5d5a1d"; rev = "a9d46f7f8173250567854d81ef2ead1256789b0e";
sha256 = "1q0ryrsmiil2l2dfhlxnkgahxw5jnfbiv1b48ly2iscqldrsm9sb"; sha256 = "1z53rlm4p8s90clr4biqaxnpfsr87889lxwp4wnazl4137hi4b9c";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -583,12 +583,12 @@ in
}; };
noice-nvim = buildVimPluginFrom2Nix { noice-nvim = buildVimPluginFrom2Nix {
pname = "noice.nvim"; pname = "noice.nvim";
version = "2023-07-01"; version = "2023-07-16";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "folke"; owner = "folke";
repo = "noice.nvim"; repo = "noice.nvim";
rev = "6c87c1d11c38180fb72bf8f45518a0a3e081afc1"; rev = "26394ed09d47160a493d4e9e754f5f78d4556a6b";
sha256 = "0y0fwll3a421r0px9x2d8mq2nj00w6ahilwmrvmhvnazjgqd074j"; sha256 = "08b2yn27ljy3jf88qj3gi86rvy4ijrip3hha2dbnzhdsziq897k4";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };

View file

@ -13,7 +13,7 @@
- src: Mofiqul/dracula.nvim - src: Mofiqul/dracula.nvim
# Syntax # Syntax
- src: nvim-treesitter/nvim-treesitter - src: nvim-treesitter/nvim-treesitter
- src: HiPhish/nvim-ts-rainbow2 - src: HiPhish/rainbow-delimiters.nvim
- src: nvim-treesitter/playground - src: nvim-treesitter/playground
# Telescope # Telescope
- src: nvim-telescope/telescope.nvim - src: nvim-telescope/telescope.nvim

View file

@ -1,5 +1,3 @@
{ pkgs, ... }:
{ {
programs.texlive = { programs.texlive = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
args@{ pkgs, lib, ... }: { pkgs, ... }:
let let
secret = import ../../secret/hosts/adsb-antenna.nix; secret = import ../../secret/hosts/adsb-antenna.nix;
@ -93,7 +93,7 @@ in
}; };
daniel = { daniel = {
hashedPassword = secret.users.daniel.hashedPassword; inherit (secret.users.daniel) hashedPassword;
isNormalUser = true; isNormalUser = true;
home = "/home/daniel"; home = "/home/daniel";
description = "Daniel"; description = "Daniel";

View file

@ -1,4 +1,4 @@
args@{ pkgs, config, lib, ... }: args@{ pkgs, config, ... }:
let let
secret = import ../../secret/hosts/mediaserver.nix; secret = import ../../secret/hosts/mediaserver.nix;
@ -133,6 +133,9 @@ in
doc.enable = false; doc.enable = false;
}; };
fonts.fontconfig.enable = false;
sound.enable = false;
programs.fish.enable = true; programs.fish.enable = true;
programs.htop.enable = true; programs.htop.enable = true;

View file

@ -1,4 +1,4 @@
args@{ pkgs, config, lib, ... }: { pkgs, config, ... }:
let let
ssh-keys = import ../shared/ssh-keys.nix; ssh-keys = import ../shared/ssh-keys.nix;

View file

@ -18,7 +18,7 @@
debug_pprof = false; debug_pprof = false;
dns = { dns = {
bind_hosts = secret.adguardhome.bind_hosts; inherit (secret.adguardhome) bind_hosts;
port = 53; port = 53;
bootstrap_dns = [ bootstrap_dns = [
@ -40,7 +40,7 @@
networking.firewall.interfaces = networking.firewall.interfaces =
let let
interfaces = lib.mapAttrsToList (_: value: lib.attrsets.attrByPath [ "matchConfig" "Name" ] null value) config.systemd.network.networks; interfaces = lib.mapAttrsToList (_: lib.attrsets.attrByPath [ "matchConfig" "Name" ] null) config.systemd.network.networks;
in in
builtins.listToAttrs builtins.listToAttrs
(builtins.map (builtins.map

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { pkgs, config, ... }:
let let
ariaDir = "/mnt/downloads/Aria2"; ariaDir = "/mnt/downloads/Aria2";

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, secret, ... }: { pkgs, config, secret, ... }:
let let
fqdn = "attic.cache.daniel.sx"; fqdn = "attic.cache.daniel.sx";

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [

View file

@ -1,5 +1,3 @@
{ pkgs, ... }:
{ {
services.elasticsearch = { services.elasticsearch = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
virtualisation.oci-containers.containers.flaresolverr = { virtualisation.oci-containers.containers.flaresolverr = {

View file

@ -1,4 +1,4 @@
{ pkgs, config, secret, ... }: { secret, ... }:
{ {
services.nginx.streamConfig = '' services.nginx.streamConfig = ''

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
services.jellyfin = { services.jellyfin = {

View file

@ -1,4 +1,4 @@
{ config, secret, ... }: { secret, ... }:
{ {
services.libreddit = { services.libreddit = {

View file

@ -28,7 +28,7 @@
networking.firewall.interfaces = networking.firewall.interfaces =
let let
interfaces = lib.mapAttrsToList (_: value: lib.attrsets.attrByPath [ "matchConfig" "Name" ] null value) config.systemd.network.networks ++ [ "tailscale0" ]; interfaces = lib.mapAttrsToList (_: lib.attrsets.attrByPath [ "matchConfig" "Name" ] null) config.systemd.network.networks ++ [ "tailscale0" ];
in in
builtins.listToAttrs builtins.listToAttrs
(builtins.map (builtins.map

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
virtualisation.oci-containers.containers.prowlarr = { virtualisation.oci-containers.containers.prowlarr = {

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
virtualisation.oci-containers.containers.radarr = { virtualisation.oci-containers.containers.radarr = {

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }: { pkgs, ... }:
let let
rimgo-pkg = pkgs.rimgo; rimgo-pkg = pkgs.rimgo;

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { lib, ... }:
{ {
virtualisation.oci-containers.containers.sonarr = { virtualisation.oci-containers.containers.sonarr = {

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, secret, ... }: { pkgs, config, secret, ... }:
{ {
environment.systemPackages = with pkgs; [ ldns tcpdump wireguard-tools ]; environment.systemPackages = with pkgs; [ ldns tcpdump wireguard-tools ];