nixvim: add nix-darwin wrapper

This commit is contained in:
Pedro Alves 2022-12-30 21:12:07 +01:00
parent de9a5913d2
commit 7807c51ccf
4 changed files with 48 additions and 48 deletions

View file

@ -40,9 +40,12 @@ let
in
{
imports = [
# For home-manager
nixvim.homeManagerModules.nixvim
# Or, if you're not using home-manager:
# For NixOS
nixvim.nixosModules.nixvim
# For nix-darwin
nixvim.nixDarwinModules.nixvim
];
programs.nixvim.enable = true;
@ -75,14 +78,14 @@ flakes, just add the nixvim input:
```
You can now access the module using `inputs.nixvim.homeManagerModules.nixvim`,
for a home-manager instalation, and `inputs.nixvim.nixosModules.nixvim`, if
you're not using it.
for a home-manager instalation, `inputs.nixvim.nixosModules.nixvim`, for NixOS,
and `inputs.nixvim.nixDarwinModules.nixvim` for nix-darwin.
## Usage
NixVim can be used in three ways: through the home-manager and NixOS modules,
NixVim can be used in four ways: through the home-manager, nix-darwin, and NixOS modules,
and through the `makeNixvim` function. To use the modules, just import the
`nixvim.homeManagerModules.${system}.nixvim` and
`nixvim.nixosModules.${system}.nixvim` modules, depending on which system
`nixvim.homeManagerModules.nixvim`, `nixvim.nixDarwinModules.nixvim`, and
`nixvim.nixosModules.nixvim` modules, depending on which system
you're using.
If you want to use it standalone, you can use the `makeNixvim` function:

View file

@ -53,5 +53,6 @@
flakeOutput // {
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
};
}

50
tests/flake.lock generated
View file

@ -203,17 +203,16 @@
"inputs": {
"beautysh": "beautysh",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3",
"nmdSrc": "nmdSrc"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 0,
"narHash": "sha256-x6+KGgpSlPfBvI8YG3hf3lN5FKhJdeLyXDmQdLk34cE=",
"path": "/nix/store/l49ggcslcfsav82lgfb5dzw4a2qajfnp-source",
"narHash": "sha256-008LHsZ1x6jTE46J4+E2jOQTAyexpf7M9fNqSsjQOds=",
"path": "/nix/store/nj5i7q1lcsw9fzch5kha51li3c8w12h6-source",
"type": "path"
},
"original": {
"path": "/nix/store/l49ggcslcfsav82lgfb5dzw4a2qajfnp-source",
"path": "/nix/store/nj5i7q1lcsw9fzch5kha51li3c8w12h6-source",
"type": "path"
}
},
@ -223,52 +222,19 @@
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs-stable"
],
"nmdSrc": "nmdSrc_2"
]
},
"locked": {
"lastModified": 0,
"narHash": "sha256-x6+KGgpSlPfBvI8YG3hf3lN5FKhJdeLyXDmQdLk34cE=",
"path": "/nix/store/l49ggcslcfsav82lgfb5dzw4a2qajfnp-source",
"narHash": "sha256-008LHsZ1x6jTE46J4+E2jOQTAyexpf7M9fNqSsjQOds=",
"path": "/nix/store/nj5i7q1lcsw9fzch5kha51li3c8w12h6-source",
"type": "path"
},
"original": {
"path": "/nix/store/l49ggcslcfsav82lgfb5dzw4a2qajfnp-source",
"path": "/nix/store/nj5i7q1lcsw9fzch5kha51li3c8w12h6-source",
"type": "path"
}
},
"nmdSrc": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmdSrc_2": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": [

30
wrappers/darwin.nix Normal file
View file

@ -0,0 +1,30 @@
modules:
{ pkgs, config, lib, ... }:
let
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
cfg = config.programs.nixvim;
in
{
options = {
programs.nixvim = mkOption {
type = types.submodule ((modules pkgs) ++ [{
options.enable = mkEnableOption "nixvim";
config.wrapRc = mkForce true;
}]);
};
nixvim.helpers = mkOption {
type = mkOptionType {
name = "helpers";
description = "Helpers that can be used when writing nixvim configs";
check = builtins.isAttrs;
};
description = "Use this option to access the helpers";
default = import ../plugins/helpers.nix { inherit (pkgs) lib; };
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.finalPackage ];
};
}