flake/modules: add finalPackage akin to nixos' neovim module

This commit is contained in:
raf 2024-04-14 17:13:57 +03:00
parent 8c4f32645b
commit c53c8311fc
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
2 changed files with 14 additions and 10 deletions

View file

@ -13,7 +13,7 @@ packages: inputs: {
cfg = config.programs.neovim-flake;
inherit (import ../../configuration.nix inputs) neovimConfiguration;
builtPackage = neovimConfiguration {
neovimConfigured = neovimConfiguration {
inherit pkgs;
modules = [cfg.settings];
};
@ -23,10 +23,10 @@ in {
options.programs.neovim-flake = {
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
builtPackage = mkOption {
finalPackage = mkOption {
type = anything;
default = builtPackage;
internal = true;
visible = false;
readOnly = true;
description = ''
The built neovim-flake package, wrapped with the user's configuration.
'';
@ -57,6 +57,8 @@ in {
};
config = mkIf cfg.enable {
home.packages = [builtPackage];
home.packages = [cfg.finalPackage];
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
};
}

View file

@ -13,7 +13,7 @@ packages: inputs: {
cfg = config.programs.neovim-flake;
inherit (import ../../configuration.nix inputs) neovimConfiguration;
builtPackage = neovimConfiguration {
neovimConfigured = neovimConfiguration {
inherit pkgs;
modules = [cfg.settings];
};
@ -23,10 +23,10 @@ in {
options.programs.neovim-flake = {
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
builtPackage = mkOption {
finalPackage = mkOption {
type = anything;
default = builtPackage;
internal = true;
visible = false;
readOnly = true;
description = ''
The built neovim-flake package, wrapped with the user's configuration.
'';
@ -57,6 +57,8 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [builtPackage];
environment.systemPackages = [cfg.finalPackage];
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
};
}