Commit graph

46 commits

Author SHA1 Message Date
Matt Sturgeon
00586f8f1b
modules/output: move symlinkJoin to build.package 2025-01-20 14:49:59 +00:00
Matt Sturgeon
8938e09db1
modules/output: add manDocsPackage 2024-12-23 12:18:06 +00:00
Matt Sturgeon
bef9feb446
lib/modules: pass inputs.nixpkgs into evalNixvim
Expose our locked nixpkgs as the `nixpkgs.source` module options.

This only happens when `evalNixvim` is part of a lib that was provided
`flake` as an argument.

Stubbed the `nixpkgs.source` option for now. Eventually, this will be
used to construct `pkgs` internally. For now, it's purely informational.
2024-12-15 18:41:23 +00:00
Austin Horstman
95361fda3c
treewide: apply deadnix suggestions 2024-12-14 11:34:26 -06:00
Matt Sturgeon
e1c0b52487
wrappers: move programs.nixvim declaration to _shared.nix 2024-10-11 00:29:42 +01:00
Matt Sturgeon
4b7a41276a
modules/nixpkgs: initial pkgs option, drop defaultPkgs specialArg
This minimal implementation allows `nixpkgs.pkgs` to be defined, but
does not implement evaluating an instance from a pkgsPath when _not_
defined.

The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs`
being defined. If it's not defined, an assertion is thrown.

In the future, a nixpkgs source path can be supplied, defaulting to the
flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this
will allow a `pkgs` instance to be evaluated within the module eval.
2024-09-27 09:30:12 +01:00
Matt Sturgeon
cb2b76c1a9
docs/home-manager: eval options without checking config definitions
By default `lib.evalModules` will check all config definitions match
a declared option (or a freeform type), leading to errors like:

    error: The option `wrapRc' does not exist.

Setting `_module.freeformType` or `_module.check` will disable this,
allowing us to evaluate the option declaration without checking the
config definitions.
2024-09-27 02:56:28 +01:00
Matt Sturgeon
6a1bf6bdc3
modules/output: check warnings+assertions on build.package
Add a `build.packageUnchecked` option for use instead of the old `check`
evalNixvim argument.
2024-09-26 18:04:36 +01:00
Matt Sturgeon
692e39311e
modules/{output,files,test}: move outputs to build scope
Move the following output options into `build`:
- finalPackage -> package
- printInitPackage
- initPath -> initFile
- filesPlugin -> extraFiles
- test.derivation -> test
2024-09-26 06:31:57 +01:00
Matt Sturgeon
11924e1593
modules/output: add impureRtp option
Instead of assuming `wrapRc` implies we don't want impurities, configure
this separately.
2024-09-25 18:43:32 +01:00
Matt Sturgeon
fb7cda2868
modules/output: refactor wrapRc default
Set default to `true`, with a low priority. Home-manager's wrapper sets
its own default using `mkOptionDefault`.

Clarify using `defaultText`.
2024-09-25 18:43:10 +01:00
Matt Sturgeon
a8f678da24
wrappers: explicitly set _file for wrapper modules
This won't be detected automatically, since the modules are all returned
from function calls instead of being path references.
2024-09-25 16:22:25 +01:00
Matt Sturgeon
5b55858fe3
wrappers: use (evalModules {}).type for nixvim submodule 2024-09-24 19:17:44 +01:00
Matt Sturgeon
87509bac1f
wrappers: move assertion propagation to _shared.nix 2024-09-24 14:59:41 +01:00
Matt Sturgeon
4e5bd1d79b
lib: segregate and deprecate functions that need pkgs
Splits everything that depends on a `pkgs` instance into an optional
attrs, allowing `helpers.nix` to be bootstrapped without `pkgs`.

This required some refactoring:
- `modules.specialArgs` is only available when `pkgs` is used
- `modules.specialArgsWith` now requires `defaultPkgs` be provided
- `builders.*` now have `*With` variants that take `pkgs` as an argument
  and a `withPkgs` function that returns the old interface
- Had to define the fixed part of `builders` outside the attrs for now,
  to avoid infinite recursion.
- The old `builders` are now deprecated, and print a warning when
  evaluated
- `withOptoinalFns` was introduced to merge the optional attrs into the
  final lib.
2024-09-13 19:05:26 +01:00
Matt Sturgeon
27c4c9c210
lib/modules: init with specialArgs helpers 2024-08-02 14:38:38 +01:00
Matt Sturgeon
491ca5cf51
lib: provide an "extended lib" to our modules
lib/extend-lib.nix returns a nixpkg's lib extended with our own
helpers.

This is exposed as `helpers.extendedLib`, but when evaluating our
modules it should be assigned to `specialArgs.lib`.

Outside of our modules you must still access our helpers via
`config.lib.nixvim` or `config.lib.nixvim.extendedLib`.

Within helpers' sub-sections, `lib` is the extended lib.
2024-08-02 14:33:59 +01:00
Matt Sturgeon
faff876ee6
wrappers: use lib.nixvim option
Update internal usage from the deprecated `nixvim.helpers` option to the
new `lib.nixvim` option name.
2024-07-25 17:10:54 +01:00
Matt Sturgeon
1b7efacdf4
wrappers: bootstrap "helpers" directly
We don't need to pass a `getHelpers` function in, since we can just
import `../lib/helpers.nix`.
2024-07-08 16:24:06 +01:00
Matt Sturgeon
cfa44bbb66
wrappers: make _shared.nix return a module 2024-07-08 16:24:06 +01:00
traxys
367380bd84 modules/output: Remove the initContent option
This (internal) option introduces IFD, and can be substituted internally
with the `initPath` option easily.
If the content is required somewhere users can use readFile on the
initPath, though it will result in an IFD in their project.
2024-07-05 22:08:25 +02:00
Matt Sturgeon
2deb61f6a5
modules/top-level: move out of wrappers/modules 2024-07-05 17:20:28 +01:00
Matt Sturgeon
d2afb176ff
modules: refactor module bootstrapping
Let's simplify things by defining all modules in `./plugins`, `./modules`
and `./wrappers/modules`.

Instead of currying `pkgs` into a bootstrapping module, we can require
`defaultPkgs` be provided as a special arg.

This refactor allows us to completely remove `flake-modules/modules.nix`!
2024-07-02 19:58:30 +01:00
Matt Sturgeon
3d96960348 wrappers: simplify modules 2024-07-02 14:15:51 +00:00
Sandro Jäckel
662a0e1bdb wrappers: use system from stdenv.hostPlatform
`pgs.system` is a flaky alias and it is more reliable to directly use
`pkgs.stdenv.hostPlatform.system`
2024-06-30 09:54:24 +02:00
Gaetan Lepage
514413f631 wrappers/hm: add vimdiffAlias option 2024-06-03 00:29:52 +02:00
traxys
62f32bfc71 treewide: Reformat with nixfmt 2024-05-05 22:00:40 +02:00
traxys
6d1ef5864b
docs: Add a section on module specific options (#1355)
This commit only adds Home-Manager specific options, we should add
sections for the different kind of modules too.

This is _not_ added to the man docs, as it is more complex. If need
arises we could look into how to do it.
2024-03-30 14:52:32 +01:00
Gabriel Arazas
d6a66851fe
wrappers: add env-specific config as part of NixVim module (#1075)
* wrappers: add env-specific config as part of NixVim module

* docs: add section for env-specific module arguments
2024-02-22 08:24:13 +01:00
traxys
6d7e429537
tests: Introduce a way to disable options when running in tests (#1095)
In our basic template we used to provide a check based on
`mkTestDerivationFromNvim`. The issue with this check (that is handled
correctly internally) is that some plugins _can't_ be used in the test
environment, for example image.nvim like in #1085.

This commit introduces a new function to generate such checks,
`mkTestDerivationFromNixvimModule`, that wraps a nixvim configuration
instead of a built nvim instance.

Then a configuration can rely on the newly added
`helpers.enableExceptInTests` attribute to disable parts of the
configuration depending if it is evaluated in tests or in a real final
configuration.

Resolves #1085
2024-02-15 14:27:45 +01:00
Gaetan Lepage
e32d155007 Revert "wrappers: remove shorthandOnlyDefinesConfig"
This reverts commit 8549bbeb0c.
2024-02-09 21:13:49 +01:00
Gaetan Lepage
8549bbeb0c wrappers: remove shorthandOnlyDefinesConfig 2024-02-09 16:18:53 +01:00
Gaetan Lepage
5d3ed3a09e misc: refactor helpers propagation
Co-authored-by: Robert Hensing <robert@roberthensing.nl>
2024-02-09 14:20:25 +01:00
Gaetan Lepage
45d788bdd9 wrappers: add nixvim-print-init package 2023-12-07 14:38:21 +01:00
traxys
541b694873
docs: Allow to install man pages (#687) 2023-11-06 16:26:23 +01:00
municorn
3fd743fe80 docs: fix grammar, spelling, and text for enable options 2023-10-09 15:04:57 +02:00
Gaetan Lepage
59232f22b5 misc: fix defaultEditor option for HM and NixOS modules 2023-09-19 10:41:57 +02:00
mrtnvgr
bfd1c5bace
feat(options): add defaultEditor option (#589) 2023-09-18 16:38:58 +02:00
Tanish2002
efdcbe225f perform some statix linting and fixes 2023-05-22 23:00:53 +02:00
Luc Chabassier
a6eec507cc
Enable creation of other config files than init.lua (#246) 2023-04-20 22:41:37 +02:00
Alexander Nortung
ecfa870c7a
bugfix: Set default for programs.nixvim. (#234)
fixes #224
2023-03-09 14:03:50 +01:00
Gaétan Lepage
264de8cefb
added formatter + reformat existing codebase (#175) 2023-02-20 10:42:13 +00:00
Alexander Nortung
63c256dc3d
core: show warnings for deprecated or changed options (#129)
* moved helpers to lib folder

* Created proxy file for helpers.nix

* wrappers: removed code duplication

* null-ls: fix wrong name of variable

* added warnings module

* Added assertions

* bufferline: deprecated option

* nvim-tree: renamed options

* Fixed mkRenamedOption

* Bufferline: added new options

* Fixed deprecated option

Co-authored-by: Pedro Alves <pta2002@pta2002.com>
2023-01-24 01:28:01 +00:00
dfangx
3849a1de9a
Use init.lua instead of init.vim (#64)
* Use init.lua instead of init.vim

* fix standalone generation

Co-authored-by: cyrusng <cyrus.ng@protonmail.com>
Co-authored-by: Pedro Alves <pta2002@pta2002.com>
2022-11-07 15:59:10 +00:00
LightQuantum
1fa86d1699
helpers: expose to config.nixvim.helpers (#59) 2022-11-07 15:12:40 +00:00
Luc Chabassier
f2a103da30
Allow using global config with hm and nixos (#48)
* remove useless nixvim file

* reorganize flake outputs

* use global config file with home-manager and nixos
2022-10-17 14:08:17 +01:00