Skip to content

Commit efdac84

Browse files
committed
flake.nix: switch from flake-utils to flake-parts
1 parent c914912 commit efdac84

File tree

2 files changed

+86
-47
lines changed

2 files changed

+86
-47
lines changed

flake.lock

Lines changed: 25 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
description = "A neovim configuration system for NixOS";
33

44
inputs = {
5-
flake-utils.url = "github:numtide/flake-utils";
65
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
77

88
pre-commit-hooks = {
99
url = "github:cachix/pre-commit-hooks.nix";
@@ -14,7 +14,7 @@
1414
outputs = {
1515
self,
1616
nixpkgs,
17-
flake-utils,
17+
flake-parts,
1818
pre-commit-hooks,
1919
...
2020
} @ inputs:
@@ -38,21 +38,31 @@
3838
};
3939
};
4040
}
41-
42-
# ./plugins/default.nix
4341
];
4442

4543
wrapperArgs = {
4644
inherit modules;
4745
inherit self;
4846
};
47+
in
48+
flake-parts.lib.mkFlake {inherit inputs;} ({
49+
withSystem,
50+
config,
51+
lib,
52+
...
53+
}: {
54+
systems = [
55+
"x86_64-linux"
56+
"aarch64-linux"
57+
"x86_64-darwin"
58+
"aarch64-darwin"
59+
];
4960

50-
flakeOutput =
51-
flake-utils.lib.eachDefaultSystem
52-
(system: let
53-
pkgs = import nixpkgs {inherit system;};
54-
# Some nixvim supported plugins require the use of unfree packages.
55-
# This unfree-friendly pkgs is used for documentation and testing only.
61+
perSystem = {
62+
pkgs,
63+
system,
64+
...
65+
}: let
5666
pkgs-unfree = import nixpkgs {
5767
inherit system;
5868
config.allowUnfree = true;
@@ -111,6 +121,7 @@
111121
pkgs = pkgs-unfree;
112122
modules = modules pkgs;
113123
});
124+
114125
legacyPackages = rec {
115126
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs wrapperArgs;
116127
makeNixvim = configuration:
@@ -120,40 +131,51 @@
120131
};
121132
};
122133
};
134+
123135
formatter = pkgs.alejandra;
124-
lib = import ./lib {
125-
inherit pkgs;
126-
inherit (pkgs) lib;
127-
inherit (self.legacyPackages."${system}") makeNixvim;
128-
};
129-
});
130-
in
131-
flakeOutput
132-
// {
133-
nixosModules.nixvim = import ./wrappers/nixos.nix wrapperArgs;
134-
homeManagerModules.nixvim = import ./wrappers/hm.nix wrapperArgs;
135-
nixDarwinModules.nixvim = import ./wrappers/darwin.nix wrapperArgs;
136-
rawModules.nixvim = nixvimModules;
136+
};
137137

138-
overlays.default = final: prev: {
139-
nixvim = rec {
140-
makeNixvimWithModule = import ./wrappers/standalone.nix prev wrapperArgs;
141-
makeNixvim = configuration:
142-
makeNixvimWithModule {
143-
module = {
144-
config = configuration;
138+
flake = {
139+
nixosModules.nixvim = import ./wrappers/nixos.nix wrapperArgs;
140+
homeManagerModules.nixvim = import ./wrappers/hm.nix wrapperArgs;
141+
nixDarwinModules.nixvim = import ./wrappers/darwin.nix wrapperArgs;
142+
rawModules.nixvim = nixvimModules;
143+
144+
overlays.default = final: prev: {
145+
nixvim = rec {
146+
makeNixvimWithModule = import ./wrappers/standalone.nix prev wrapperArgs;
147+
makeNixvim = configuration:
148+
makeNixvimWithModule {
149+
module = {
150+
config = configuration;
151+
};
145152
};
146-
};
153+
};
147154
};
148-
};
149155

150-
templates = let
151-
simple = {
152-
path = ./templates/simple;
153-
description = "A simple nix flake template for getting started with nixvim";
156+
lib = lib.genAttrs config.systems (
157+
lib.flip withSystem (
158+
{
159+
pkgs,
160+
system,
161+
...
162+
}:
163+
import ./lib {
164+
inherit pkgs;
165+
inherit (pkgs) lib;
166+
inherit (self.legacyPackages."${system}") makeNixvim;
167+
}
168+
)
169+
);
170+
171+
templates = let
172+
simple = {
173+
path = ./templates/simple;
174+
description = "A simple nix flake template for getting started with nixvim";
175+
};
176+
in {
177+
default = simple;
154178
};
155-
in {
156-
default = simple;
157179
};
158-
};
180+
});
159181
}

0 commit comments

Comments
 (0)