Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
Lander Van den Bulcke 2025-10-10 14:02:21 +02:00
parent ff2c59724a
commit 55860985f8
Signed by: lander
GPG key ID: 0142722B4B0C536F
9 changed files with 252 additions and 109 deletions

125
flake.lock generated
View file

@ -73,10 +73,30 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1759523803,
"narHash": "sha256-PTod9NG+i3XbbnBKMl/e5uHDBYpwIWivQ3gOWSEuIEM=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cfc9f7bb163ad8542029d303e599c0f7eee09835",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"git-hooks",
"nixpkgs"
]
},
@ -124,16 +144,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "nixos",
"lastModified": 1759070547,
"narHash": "sha256-JVZl8NaVRYb0+381nl7LvPE+A774/dRpif01FKLrYFQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"rev": "647e5c14cbd5067f44ac86b74f014962df460840",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -153,7 +173,39 @@
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1759735786,
"narHash": "sha256-a0+h02lyP2KwSNrZz4wLJTu9ikujNsTWIC874Bv7IJ0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "20c4598c84a671783f741e02bf05cbfaf4907cff",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1758763312,
"narHash": "sha256-puBMviZhYlqOdUUgEmMVJpXqC/ToEqSvkyZ30qQ09xM=",
@ -169,26 +221,10 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1758029226,
"narHash": "sha256-TjqVmbpoCqWywY9xIZLTf6ANFvDCXdctCjoYuYPYdMI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "08b8f92ac6354983f5382124fef6006cade4a1c1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_2"
},
@ -229,32 +265,14 @@
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1758108966,
"narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable",
"nixvim": "nixvim",
"pre-commit-hooks": "pre-commit-hooks"
"systems": "systems_3"
}
},
"systems": {
@ -286,6 +304,21 @@
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -1,75 +1,25 @@
{
description = "deCort.tech NeoVim configuration";
description = "EscapeAngle NeoVim configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05";
flake-parts.url = "github:hercules-ci/flake-parts";
nixvim = {
url = "github:nix-community/nixvim";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
};
nixvim.url = "github:nix-community/nixvim";
systems.url = "github:nix-systems/default";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.flake = false;
};
outputs =
{
nixpkgs,
nixvim,
flake-parts,
pre-commit-hooks,
...
}@inputs:
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
systems = import inputs.systems;
_module.args = { inherit inputs; };
imports = [
./modules/flake
./overlays
./plugins
];
perSystem =
{
pkgs,
system,
self',
lib,
...
}:
let
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
module = import ./config; # import the module directly
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {
# inherit (inputs) foo;
};
};
nvim = nixvim'.makeNixvimWithModule nixvimModule;
in
{
checks = {
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
statix.enable = true;
nixfmt-rfc-style.enable = true;
};
};
};
formatter = pkgs.nixfmt-rfc-style;
packages = {
default = nvim;
};
devShells = {
default = with pkgs; mkShell { inherit (self'.checks.pre-commit-check) shellHook; };
};
};
};
}

23
modules/flake/default.nix Normal file
View file

@ -0,0 +1,23 @@
{ inputs, self, ... }:
{
debug = true;
imports = [ ./devshell.nix ];
perSystem =
{ lib, system, ... }:
{
_module.args = {
flake = { inherit inputs self; };
pkgs = import inputs.nixpkgs {
inherit system;
overlays = lib.attrValues self.overlays;
config.allowUnfree = true;
};
};
imports = [
(self + /packages)
];
};
}

View file

@ -0,0 +1,32 @@
{ inputs, ... }:
{
imports = [
(inputs.git-hooks + /flake-module.nix)
];
perSystem =
{ config, pkgs, ... }:
{
devShells.default = pkgs.mkShell rec {
name = "nixvim";
meta.description = "Dev environment for nixvim configuration";
inputsFrom = [ config.pre-commit.devShell ];
packages = with pkgs; [
nil
nix-output-monitor
nixfmt-rfc-style
];
shellHook = ''
echo 1>&2 "🐼: $(id -un) | 🧬: $(nix eval --raw --impure --expr 'builtins.currentSystem') | 🐧: $(uname -r) "
echo 1>&2 "Ready to work on ${name}!"
'';
};
pre-commit.settings = {
hooks.nixfmt-rfc-style.enable = true;
};
};
}

12
overlays/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ inputs, self, ... }:
{
flake.overlays.default = (
final: prev: {
stable = import inputs.nixpkgs-stable {
allowUnfree = true;
inherit (prev) system;
overlays = prev.lib.attrValues self.overlays;
};
}
);
}

22
packages/default.nix Normal file
View file

@ -0,0 +1,22 @@
{
flake,
inputs',
self',
...
}:
let
mkNixVim =
module:
inputs'.nixvim.legacyPackages.makeNixvimWithModule {
extraSpecialArgs = { inherit inputs self; };
inherit module;
};
inherit (flake) inputs self;
bareModules = import ../config;
in
{
packages = {
default = self'.packages.core;
bare = mkNixVim bareModules;
};
}

View file

@ -0,0 +1,12 @@
{ lib, ... }:
{
imports =
with builtins;
with lib;
map (fn: ./${fn}) (
filter (fn: (fn != "default.nix" && hasSuffix ".nix" "${fn}")) (attrNames (readDir ./.))
);
luaLoader.enable = false;
}

View file

@ -0,0 +1,26 @@
{ lib, ... }:
with lib;
{
options.nixvim = {
leader = mkOption {
description = "The leader key for nvim.";
type = types.str;
default = " ";
};
border = mkOption {
description = "The border style for nvim.";
type = types.enum [
"single"
"double"
"rounded"
"solid"
"shadow"
"curved"
"bold"
"none"
];
default = "rounded";
};
};
}

33
plugins/default.nix Normal file
View file

@ -0,0 +1,33 @@
{ lib, ... }:
let
mapAttrsMaybe =
f: attrs:
lib.pipe attrs [
(lib.mapAttrsToList f)
(builtins.filter (x: x != null))
builtins.listToAtts
];
forAllNixFiles =
dir: f:
if builtins.pathExists dir then
lib.pipe dir [
builtins.readDir
(mapAttrsMaybe (
fn: type:
if type == "regular" then
let
name = lib.removeSuffix ".nix" fn;
in
lib.nameValuePair name (f "${dir}/${fn}")
else if type == "directory" && builtins.pathExists "${dir}/${fn}/default.nix" then
lib.nameValuePair fn (f "${dir}/${fn}")
else
null
))
]
else
{ };
in
{
flake.nixvimPlugins = forAllNixFiles ./. (fn: fn);
}