nix: expose NixOS module in default flake outputs; cleanup
Some checks failed
Rust / build (push) Has been cancelled

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7457515ee7a96e11c9301e5b077afb446a6a6964
This commit is contained in:
raf 2026-05-09 20:16:33 +03:00
commit 63a81bb9d2
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 29 additions and 5 deletions

View file

@ -9,6 +9,11 @@
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
nixosModules = {
eh = import ./nix/modules/nixos.nix self;
default = self.nixosModules.eh;
};
packages = forEachSystem (system: {
eh = pkgsForEach.${system}.callPackage ./nix/package.nix {};
default = self.packages.${system}.eh;

View file

@ -5,39 +5,58 @@ self: {
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkPackageOption;
inherit (lib.options) mkEnableOption mkPackageOption literalExpression;
inherit (lib.strings) optionalString;
cfg = config.programs.eh;
in {
options.programs.eh = {
enable = mkEnableOption "eh - Ergonomic Nix CLI helper";
package = mkPackageOption self.packages.${pkgs.hostPlatform.system} ["eh"] {};
package = mkPackageOption self.packages.${pkgs.hostPlatform.system} ["eh"] {
pkgsText = literalExpression "self.packages.$${pkgs.hostPlatform.system}";
};
hooks = {
bash.enable = mkEnableOption "Bash shell hook for EH" // {default = config.programs.bash.enable;};
zsh.enable = mkEnableOption "ZSH shell hook for EH" // {default = config.programs.zsh.enable;};
fish.enable = mkEnableOption "Fish shell hook for EH" // {default = config.programs.fish.enable;};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [cfg.package];
programs = {
bash.interactiveShellInit = optionalString cfg.hooks.bash.enable ''
# Aliases added by EH
# EH multicall aliases
alias nr='eh run'
alias ns='eh shell'
alias nb='eh build'
alias nd='eh develop'
alias ni='eh info'
alias nu='eh update'
# End of EH aliases
'';
zsh.interactiveShellInit = optionalString cfg.hooks.zsh.enable ''
# Aliases added by EH
# EH multicall aliases
alias nr='eh run'
alias ns='eh shell'
alias nb='eh build'
alias nd='eh develop'
alias ni='eh info'
alias nu='eh update'
# End of EH aliases
'';
fish.interactiveShellInit = optionalString cfg.hooks.fish.enable ''
# EH multicall aliases
alias nr='eh run'
alias ns='eh shell'
alias nb='eh build'
alias nd='eh develop'
alias ni='eh info'
alias nu='eh update'
# End of EH aliases
'';
};
};