forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake.nix: refactoring using flake-parts
- Loading branch information
1 parent
1f1065d
commit 31284dd
Showing
13 changed files
with
320 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
perSystem = { | ||
pkgs, | ||
makeNixvimWithModuleUnfree, | ||
makeNixvimWithModule, | ||
... | ||
}: { | ||
checks = { | ||
tests = import ../tests { | ||
inherit pkgs; | ||
inherit (pkgs) lib; | ||
makeNixvim = configuration: | ||
makeNixvimWithModuleUnfree { | ||
module = { | ||
config = configuration; | ||
}; | ||
}; | ||
}; | ||
|
||
extra-args-tests = import ../tests/extra-args.nix { | ||
inherit pkgs; | ||
inherit makeNixvimWithModule; | ||
}; | ||
|
||
lib-tests = import ../tests/lib-tests.nix { | ||
inherit pkgs; | ||
inherit (pkgs) lib; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
./checks.nix | ||
./dev.nix | ||
./lib.nix | ||
./legacy-packages.nix | ||
./modules.nix | ||
./overlays.nix | ||
./packages.nix | ||
./templates.nix | ||
./wrappers.nix | ||
]; | ||
|
||
perSystem = { | ||
pkgs, | ||
system, | ||
... | ||
}: { | ||
_module.args = { | ||
pkgsUnfree = import inputs.nixpkgs { | ||
inherit system; | ||
config.allowUnfree = true; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
inputs.pre-commit-hooks.flakeModule | ||
]; | ||
|
||
perSystem = { | ||
pkgs, | ||
config, | ||
... | ||
}: { | ||
devShells.default = pkgs.mkShellNoCC { | ||
shellHook = config.pre-commit.installationScript; | ||
}; | ||
|
||
formatter = pkgs.alejandra; | ||
|
||
pre-commit = { | ||
settings.hooks = { | ||
alejandra.enable = true; | ||
statix = { | ||
enable = true; | ||
excludes = [ | ||
"plugins/lsp/language-servers/rust-analyzer-config.nix" | ||
]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
perSystem = { | ||
pkgs, | ||
config, | ||
makeNixvimWithModule, | ||
... | ||
}: { | ||
legacyPackages = rec { | ||
inherit makeNixvimWithModule; | ||
makeNixvim = configuration: | ||
makeNixvimWithModule { | ||
module = { | ||
config = configuration; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
config, | ||
lib, | ||
withSystem, | ||
... | ||
}: { | ||
flake.lib = lib.genAttrs config.systems ( | ||
lib.flip withSystem ( | ||
{ | ||
pkgs, | ||
config, | ||
... | ||
}: | ||
import ../lib { | ||
inherit pkgs lib; | ||
inherit (config.legacyPackages) makeNixvim; | ||
} | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
modules, | ||
inputs, | ||
... | ||
}: { | ||
_module.args = let | ||
nixvimModules = with builtins; | ||
map | ||
(f: ../modules + "/${f}") | ||
( | ||
attrNames (readDir ../modules) | ||
); | ||
in { | ||
modules = pkgs: let | ||
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix"; | ||
|
||
nixvimExtraArgsModule = rec { | ||
_file = ./flake.nix; | ||
key = _file; | ||
config = { | ||
_module.args = { | ||
pkgs = pkgs.lib.mkForce pkgs; | ||
inherit (pkgs) lib; | ||
helpers = import ../lib/helpers.nix {inherit (pkgs) lib;}; | ||
# TODO: Not sure why the modules need to access the whole flake inputs... | ||
inherit inputs; | ||
}; | ||
}; | ||
}; | ||
in | ||
nixvimModules | ||
++ [ | ||
nixpkgsMaintainersList | ||
nixvimExtraArgsModule | ||
]; | ||
}; | ||
|
||
perSystem = { | ||
pkgs, | ||
config, | ||
... | ||
}: { | ||
_module.args = { | ||
modules = modules pkgs; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
inputs.flake-parts.flakeModules.easyOverlay | ||
]; | ||
perSystem = { | ||
config, | ||
pkgs, | ||
final, | ||
... | ||
}: { | ||
overlayAttrs = { | ||
nixvim = { | ||
inherit | ||
(config.legacyPackages) | ||
makeNixvim | ||
makeNixvimWithModule | ||
; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
perSystem = { | ||
pkgs, | ||
pkgsUnfree, | ||
config, | ||
modules, | ||
... | ||
}: { | ||
packages = let | ||
docs = { | ||
docs = pkgsUnfree.callPackage (import ../docs) { | ||
inherit modules; | ||
}; | ||
}; | ||
|
||
man-docs = import ../man-docs { | ||
pkgs = pkgsUnfree; | ||
inherit modules; | ||
}; | ||
|
||
# TODO: deprecate (unused) | ||
helpers = import ../helpers pkgs; | ||
in | ||
docs | ||
// man-docs | ||
// helpers; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
flake.templates = { | ||
default = { | ||
path = ../templates/simple; | ||
description = "A simple nix flake template for getting started with nixvim"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
modules, | ||
self, | ||
... | ||
}: let | ||
wrapperArgs = { | ||
inherit modules; | ||
inherit self; | ||
}; | ||
in { | ||
perSystem = { | ||
pkgs, | ||
pkgsUnfree, | ||
config, | ||
... | ||
}: { | ||
_module.args = { | ||
makeNixvimWithModule = | ||
import ../wrappers/standalone.nix | ||
pkgs | ||
wrapperArgs; | ||
|
||
makeNixvimWithModuleUnfree = | ||
import ../wrappers/standalone.nix | ||
pkgsUnfree | ||
wrapperArgs; | ||
}; | ||
}; | ||
|
||
flake = { | ||
nixosModules.nixvim = import ./nixos.nix wrapperArgs; | ||
homeManagerModules.nixvim = import ./wrappers/hm.nix wrapperArgs; | ||
nixDarwinModules.nixvim = import ./wrappers/darwin.nix wrapperArgs; | ||
}; | ||
} |
Oops, something went wrong.