-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathflake.nix
More file actions
74 lines (65 loc) · 1.96 KB
/
flake.nix
File metadata and controls
74 lines (65 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
description = "Nvim Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs@{
self,
nixpkgs,
neovim-nightly-overlay,
...
}:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
flake = {
overlays = {
nightly = neovim-nightly-overlay.overlays.default;
};
homeModules.nvim = import ./nix/home.nix inputs;
};
imports = [
# Add treefmt flake module to automatically configure and add formatter to this flake
inputs.treefmt-nix.flakeModule
];
perSystem =
{ system, inputs', ... }:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
neovim-nightly-overlay.overlays.default
];
};
in
{
# Override the default "pkgs" attribute in per-system config.
_module.args.pkgs = pkgs;
# Although the pkgs attribute is already override, but I am afraid
# that the magical evaluation of "pkgs" is confusing, and will lead
# to debug hell. So here we use the "pkgs" in "let-in binding" to
# explicitly told every user we are using an overlayed version of
# nixpkgs.
legacyPackages = pkgs;
packages = rec {
neovim = pkgs.callPackage ./nix/mkNeovim.nix { };
default = neovim;
};
treefmt = {
projectRootFile = "flake.nix";
settings.on-unmatched = "debug";
programs = {
nixfmt.enable = true;
stylua.enable = true;
};
};
};
};
}