feat(devkit): wrap devkit packages so self argument is not necessary

This commit is contained in:
Guz
2025-04-19 10:20:28 -03:00
parent a04870a342
commit 616f461b8b
3 changed files with 43 additions and 20 deletions

8
flake.lock generated
View File

@@ -805,11 +805,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1742219868,
"narHash": "sha256-EW4nbQb+4ss9PAf4PjGAdrBaqtJ/oSsppmaTQoMYpEI=",
"lastModified": 1744832736,
"narHash": "sha256-jpIIfUgRgIWMMXzG3qFCMxoZWB871LLTcOd9ccOFYxk=",
"ref": "refs/heads/main",
"rev": "6ec8fa8e35898bccd79d324d3120aaaa95b95b0d",
"revCount": 114,
"rev": "56d8f75abc4774732082c79de8871c48d9318eb6",
"revCount": 122,
"type": "git",
"url": "https://forge.capytal.company/dot013/nvim"
},

View File

@@ -131,7 +131,37 @@
};
homeManagerModules = {
devkit = ./modules/home-manager/devkit.nix;
devkit = {
lib,
pkgs,
...
}: let
devkitPkgs = self.packages.${pkgs.system}.devkit;
in {
imports = [
./modules/home-manager/devkit.nix
self.homeManagerModules.neovim
];
options._devkit = with lib; let
mkPkgOption = pkg:
mkOption {
type = with types; package;
default = pkg;
readOnly = true;
};
in {
packages = {
ghostty = mkPkgOption devkitPkgs.ghostty;
git = mkPkgOption devkitPkgs.git;
lazygit = mkPkgOption devkitPkgs.lazygit;
starship = mkPkgOption devkitPkgs.starship;
yazi = mkPkgOption devkitPkgs.yazi;
zellij = mkPkgOption devkitPkgs.zellij;
tmux = mkPkgOption devkitPkgs.tmux;
zsh = mkPkgOption devkitPkgs.zsh;
};
};
};
neovim = inputs.neovim.homeManagerModules.default;
eww = ./modules/home-manager/eww.nix;
};

View File

@@ -1,18 +1,11 @@
{
config,
inputs,
lib,
pkgs,
self,
...
}: let
cfg = config.devkit;
devkitPkgs = self.packages.${pkgs.system}.devkit;
in {
imports = [
self.homeManagerModules.neovim
];
options.devkit = with lib; {
enable = mkEnableOption "Enable devkit configuration and packages";
@@ -102,7 +95,7 @@ in {
## Ghostty (Terminal)
programs.ghostty = lib.mkIf cfg.ghostty.enable {
enable = true;
package = devkitPkgs.ghostty;
package = config._devkit.packages.ghostty;
};
## Git
@@ -110,13 +103,13 @@ in {
enable = true;
userEmail = "contact@guz.one";
userName = "Gustavo \"Guz\" L de Mello";
package = devkitPkgs.git;
package = config._devkit.packages.git;
};
## Lazygit (Git TUI)
programs.lazygit = lib.mkIf cfg.lazygit.enable {
enable = true;
package = devkitPkgs.lazygit;
package = config._devkit.packages.lazygit;
# package = pkgs.lazygit;
};
@@ -126,33 +119,33 @@ in {
## Starship (Shell decoration)
programs.starship = lib.mkIf cfg.starship.enable {
enable = true;
package = devkitPkgs.starship;
package = config._devkit.packages.starship;
# package = pkgs.starship;
};
## Yazi (File manager)
programs.yazi = lib.mkIf cfg.yazi.enable {
enable = true;
package = devkitPkgs.yazi;
package = config._devkit.packages.yazi;
# package = pkgs.yazi;
};
# Zellij (Terminal multiplexer)
programs.zellij = lib.mkIf cfg.zellij.enable {
enable = true;
package = devkitPkgs.zellij;
package = config._devkit.packages.zellij;
};
## Tmux (Backup terminal multiplexer)
programs.tmux = lib.mkIf cfg.tmux.enable {
enable = true;
package = devkitPkgs.tmux;
package = config._devkit.packages.tmux;
};
## ZSH (Default shell)
programs.zsh = lib.mkIf cfg.zsh.enable {
enable = true;
package = devkitPkgs.zsh;
package = config._devkit.packages.zsh;
# package = pkgs.zsh;
};
};