nix: expose NixOS module in default flake outputs; cleanup
Some checks failed
Rust / build (push) Has been cancelled
Some checks failed
Rust / build (push) Has been cancelled
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I7457515ee7a96e11c9301e5b077afb446a6a6964
This commit is contained in:
parent
86d457b389
commit
63a81bb9d2
2 changed files with 29 additions and 5 deletions
|
|
@ -9,6 +9,11 @@
|
||||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||||
pkgsForEach = nixpkgs.legacyPackages;
|
pkgsForEach = nixpkgs.legacyPackages;
|
||||||
in {
|
in {
|
||||||
|
nixosModules = {
|
||||||
|
eh = import ./nix/modules/nixos.nix self;
|
||||||
|
default = self.nixosModules.eh;
|
||||||
|
};
|
||||||
|
|
||||||
packages = forEachSystem (system: {
|
packages = forEachSystem (system: {
|
||||||
eh = pkgsForEach.${system}.callPackage ./nix/package.nix {};
|
eh = pkgsForEach.${system}.callPackage ./nix/package.nix {};
|
||||||
default = self.packages.${system}.eh;
|
default = self.packages.${system}.eh;
|
||||||
|
|
|
||||||
|
|
@ -5,39 +5,58 @@ self: {
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.options) mkEnableOption mkPackageOption;
|
inherit (lib.options) mkEnableOption mkPackageOption literalExpression;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
|
||||||
cfg = config.programs.eh;
|
cfg = config.programs.eh;
|
||||||
in {
|
in {
|
||||||
options.programs.eh = {
|
options.programs.eh = {
|
||||||
enable = mkEnableOption "eh - Ergonomic Nix CLI helper";
|
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 = {
|
hooks = {
|
||||||
bash.enable = mkEnableOption "Bash shell hook for EH" // {default = config.programs.bash.enable;};
|
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;};
|
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 {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [cfg.package];
|
environment.systemPackages = [cfg.package];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
bash.interactiveShellInit = optionalString cfg.hooks.bash.enable ''
|
bash.interactiveShellInit = optionalString cfg.hooks.bash.enable ''
|
||||||
# Aliases added by EH
|
# EH multicall aliases
|
||||||
alias nr='eh run'
|
alias nr='eh run'
|
||||||
alias ns='eh shell'
|
alias ns='eh shell'
|
||||||
alias nb='eh build'
|
alias nb='eh build'
|
||||||
|
alias nd='eh develop'
|
||||||
|
alias ni='eh info'
|
||||||
alias nu='eh update'
|
alias nu='eh update'
|
||||||
|
# End of EH aliases
|
||||||
'';
|
'';
|
||||||
|
|
||||||
zsh.interactiveShellInit = optionalString cfg.hooks.zsh.enable ''
|
zsh.interactiveShellInit = optionalString cfg.hooks.zsh.enable ''
|
||||||
# Aliases added by EH
|
# EH multicall aliases
|
||||||
alias nr='eh run'
|
alias nr='eh run'
|
||||||
alias ns='eh shell'
|
alias ns='eh shell'
|
||||||
alias nb='eh build'
|
alias nb='eh build'
|
||||||
|
alias nd='eh develop'
|
||||||
|
alias ni='eh info'
|
||||||
alias nu='eh update'
|
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
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue