mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
Move rebuild aliases to the system level
This commit is contained in:
parent
2a71c29fd5
commit
ee6393aa18
7 changed files with 23 additions and 33 deletions
|
|
@ -29,6 +29,7 @@
|
|||
sops.enable = true;
|
||||
printing.enable = true;
|
||||
syncthing.enable = true;
|
||||
nix-helper.enable = true;
|
||||
};
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@
|
|||
sops.enable = true;
|
||||
printing.enable = true;
|
||||
syncthing.enable = true;
|
||||
nix-helper.enable = true;
|
||||
};
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
programs.nh.enable = true;
|
||||
programs.steam.enable = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ in {
|
|||
./starship.nix
|
||||
./direnv.nix
|
||||
./enhancement.nix
|
||||
./nixAliases.nix
|
||||
];
|
||||
|
||||
options.myConfig.shell = {
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: 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";
|
||||
};
|
||||
}
|
||||
|
|
@ -14,5 +14,6 @@
|
|||
./boot-loader.nix
|
||||
./printing.nix
|
||||
./syncthing.nix
|
||||
./nix-helper.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
20
modules/system/nix-helper.nix
Normal file
20
modules/system/nix-helper.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.myConfig.nix-helper.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.myConfig.nix-helper.enable {
|
||||
programs.nh.enable = true;
|
||||
|
||||
environment.shellAliases = let
|
||||
rebuild = "sudo -v && nh os";
|
||||
in {
|
||||
nrs = "${rebuild} switch";
|
||||
nrt = "${rebuild} test";
|
||||
nrb = "${rebuild} boot";
|
||||
nrrb = "nrb && reboot";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -16,10 +16,6 @@
|
|||
shell = {
|
||||
bash.enable = true;
|
||||
starship.enable = true;
|
||||
nixAliases = {
|
||||
enable = true;
|
||||
nh.enable = osConfig.programs.nh.enable;
|
||||
};
|
||||
enhancement.enable = true;
|
||||
direnv.enable = true;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue