Skip to content

Commit

Permalink
flake: add public nixvimConfigurations flake-module
Browse files Browse the repository at this point in the history
Can be used by end-users to define `perSystem.nixvimConfigurations`
using flake-parts.
  • Loading branch information
MattSturgeon committed Jan 18, 2025
1 parent 6487caa commit 46cca53
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
7 changes: 7 additions & 0 deletions flake-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
{
imports = [
./dev
./public
./lib.nix
./legacy-packages.nix
./nixvim-configurations.nix
./overlays.nix
./packages.nix
./templates.nix
./tests.nix
./wrappers.nix
inputs.flake-parts.flakeModules.flakeModules
];

flake.flakeModules = {
default = ./public;
};

perSystem =
{ system, ... }:
{
Expand Down
8 changes: 2 additions & 6 deletions flake-modules/legacy-packages.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
{ helpers, ... }:
{
perSystem =
{
config,
makeNixvimWithModule,
system,
...
}:
{
legacyPackages = rec {
inherit makeNixvimWithModule;
makeNixvim = module: makeNixvimWithModule { inherit module; };

nixvimConfiguration = helpers.modules.evalNixvim {
inherit system;
};
nixvimConfiguration = config.nixvimConfigurations.default;
};
};
}
14 changes: 14 additions & 0 deletions flake-modules/nixvim-configurations.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ helpers, ... }:
{
flake.flakeModules = {
nixvimConfigurations = ./public/nixvimConfigurations.nix;
};

perSystem =
{ system, ... }:
{
nixvimConfigurations.default = helpers.modules.evalNixvim {
inherit system;
};
};
}
5 changes: 5 additions & 0 deletions flake-modules/public/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
imports = [
./nixvimConfigurations.nix
];
}
22 changes: 22 additions & 0 deletions flake-modules/public/nixvimConfigurations.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ lib, flake-parts-lib, ... }:
let
inherit (lib) types;
configurationType = lib.mkOptionType {
name = "configuration";
description = "configuration";
descriptionClass = "noun";
merge = lib.options.mergeOneOption;
check = x: x._type or null == "configuration";
};
in
flake-parts-lib.mkTransposedPerSystemModule {
name = "nixvimConfigurations";
option = lib.mkOption {
type = types.lazyAttrsOf configurationType;
default = { };
description = ''
An attribute set of Nixvim configurations.
'';
};
file = ./nixvimConfigurations.nix;
}

0 comments on commit 46cca53

Please sign in to comment.