nix: add NixOS module
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I0d8e0ed21f7b565123312cbdffa8a5e36a6a6964
This commit is contained in:
parent
8e1a6ac312
commit
af25dd46c7
1 changed files with 44 additions and 0 deletions
44
nix/modules/nixos.nix
Normal file
44
nix/modules/nixos.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
self: {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkEnableOption mkPackageOption;
|
||||||
|
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"] {};
|
||||||
|
|
||||||
|
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;};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [cfg.package];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
bash.interactiveShellInit = optionalString cfg.hooks.bash.enable ''
|
||||||
|
# Aliases added by EH
|
||||||
|
alias nr='eh run'
|
||||||
|
alias ns='eh shell'
|
||||||
|
alias nb='eh build'
|
||||||
|
alias nu='eh update'
|
||||||
|
'';
|
||||||
|
|
||||||
|
zsh.interactiveShellInit = optionalString cfg.hooks.zsh.enable ''
|
||||||
|
# Aliases added by EH
|
||||||
|
alias nr='eh run'
|
||||||
|
alias ns='eh shell'
|
||||||
|
alias nb='eh build'
|
||||||
|
alias nu='eh update'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue