mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Use the nix-helper for the nix aliases
This commit is contained in:
parent
30faa1f2bf
commit
9a4b64345d
2 changed files with 25 additions and 11 deletions
|
|
@ -2,15 +2,26 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.myConfig.shell.nixAliases.enable = lib.mkEnableOption "";
|
||||
|
||||
config.home.shellAliases = lib.mkIf config.myConfig.shell.nixAliases.enable {
|
||||
nr = "sudo -v && nixos-rebuild --flake $FLAKE --use-remote-sudo";
|
||||
nrs = "nr switch";
|
||||
nrt = "nr test";
|
||||
nrb = "nr boot";
|
||||
nrrb = "nrb && reboot";
|
||||
nu = "nix flake update";
|
||||
}: let
|
||||
cfg = config.myConfig.shell.nixAliases;
|
||||
in {
|
||||
options.myConfig.shell.nixAliases = {
|
||||
enable = lib.mkEnableOption "";
|
||||
nh.enable = lib.mkEnableOption "";
|
||||
};
|
||||
|
||||
config.home.shellAliases = let
|
||||
rebuild =
|
||||
if cfg.nh.enable
|
||||
then "nh os"
|
||||
else "nixos-rebuild --flake $FLAKE --use-remote-sudo";
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
nr = "sudo -v && ${rebuild}";
|
||||
nrs = "nr switch";
|
||||
nrt = "nr test";
|
||||
nrb = "nr boot";
|
||||
nrrb = "nrb && reboot";
|
||||
nu = "nix flake update";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@
|
|||
shell = {
|
||||
bash.enable = true;
|
||||
starship.enable = true;
|
||||
nixAliases.enable = true;
|
||||
nixAliases = {
|
||||
enable = true;
|
||||
nh.enable = osConfig.nh.enable;
|
||||
};
|
||||
enhancedCommands.enable = true;
|
||||
direnv.enable = true;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue