modue stuff

This commit is contained in:
Alexander Khodyrev 2025-08-26 21:44:21 +03:00
parent 1f8cd90ee4
commit 48c4ac4f59

View file

@ -15,37 +15,40 @@
home-manager, home-manager,
... ...
}@inputs: }@inputs:
let (
inherit (lib) mkEnableOption mkPackageOption mkIf;
lib = nixpkgs.lib;
in
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = nixpkgs.legacyPackages.${system}; inherit (lib) mkEnableOption mkPackageOption mkIf;
lib = nixpkgs.lib;
in in
{ flake-utils.lib.eachDefaultSystem (
packages.default = pkgs.buildGoModule { system:
pname = "llm-shell-hint"; let
version = "0.1.0"; pkgs = nixpkgs.legacyPackages.${system};
src = ./.; in
vendorHash = "sha256-7sFDSzjqA6TbWpTbiyxdIGAZ4UB3MoHP/OPUQw6rdz8="; {
}; packages.default = pkgs.buildGoModule {
pname = "llm-shell-hint";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-7sFDSzjqA6TbWpTbiyxdIGAZ4UB3MoHP/OPUQw6rdz8=";
};
apps.default = { apps.default = {
type = "app"; type = "app";
program = "${self.packages.${system}.default}/bin/llm-shell-hint"; program = "${self.packages.${system}.default}/bin/llm-shell-hint";
}; };
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
nixfmt
gopls
gotools
];
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
nixfmt
gopls
gotools
];
};
}
)
// {
homeManagerModules.default = homeManagerModules.default =
{ {
config, config,
@ -95,19 +98,25 @@
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
configFile = tomlFormat.generate "llm-shell-hint-config" cfg.settings; configFile = tomlFormat.generate "llm-shell-hint-config" cfg.settings;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
home.packages = [ self.packages."${system}".llm-shell-hint ]; home.packages = [ self.packages."${system}".llm-shell-hint ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration '' programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
${lib.getExe self.packages."${system}".llm-shell-hint} init bash --config-file "${configFile}" | source ${
lib.getExe self.packages."${system}".llm-shell-hint
} init bash --config-file "${configFile}" | source
''; '';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
${lib.getExe self.packages."${system}".llm-shell-hint} init zsh --config-file "${configFile}" | source ${
lib.getExe self.packages."${system}".llm-shell-hint
} init zsh --config-file "${configFile}" | source
''; '';
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
${lib.getExe self.packages."${system}".llm-shell-hint} init fish --config-file "${configFile}" | source ${
lib.getExe self.packages."${system}".llm-shell-hint
} init fish --config-file "${configFile}" | source
''; '';
}; };
}; };