mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 22:11:33 +01:00
Modularize the shell config
This commit is contained in:
parent
cbebff390c
commit
30faa1f2bf
10 changed files with 104 additions and 74 deletions
|
|
@ -34,5 +34,6 @@
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
|
services.auto-cpufreq.enable = true;
|
||||||
hardware.brillo.enable = true;
|
hardware.brillo.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,4 @@
|
||||||
boot.kernelModules = ["kvm-amd"];
|
boot.kernelModules = ["kvm-amd"];
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
hardware.cpu.amd.updateMicrocode = true;
|
hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
|
||||||
services.auto-cpufreq.enable = true;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./de
|
./de
|
||||||
./vscode.nix
|
./vscode.nix
|
||||||
./shell.nix
|
./shell
|
||||||
./ssh-client.nix
|
./ssh-client.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.myConfig.shell;
|
|
||||||
in {
|
|
||||||
options.myConfig.shell = {
|
|
||||||
bash.enable = lib.mkEnableOption "";
|
|
||||||
zsh.enable = lib.mkEnableOption "";
|
|
||||||
starship.enable = lib.mkEnableOption "";
|
|
||||||
nixAliases.enable = lib.mkEnableOption "";
|
|
||||||
improvedCommands.enable = lib.mkEnableOption "";
|
|
||||||
direnv.enable = lib.mkEnableOption "";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
{
|
|
||||||
programs.bash.enable = cfg.bash.enable;
|
|
||||||
|
|
||||||
programs.zsh.enable = cfg.zsh.enable;
|
|
||||||
|
|
||||||
programs.starship = lib.mkIf cfg.starship.enable {
|
|
||||||
enable = true;
|
|
||||||
enableBashIntegration = cfg.bash.enable;
|
|
||||||
enableZshIntegration = cfg.zsh.enable;
|
|
||||||
settings = {
|
|
||||||
cmd_duration.disabled = true;
|
|
||||||
directory = {
|
|
||||||
truncation_length = 0;
|
|
||||||
truncation_symbol = "…/";
|
|
||||||
truncate_to_repo = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.direnv = lib.mkIf cfg.direnv.enable {
|
|
||||||
enable = true;
|
|
||||||
nix-direnv.enable = true;
|
|
||||||
config.global.hide_env_diff = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.shellAliases = lib.mkIf cfg.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";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
(lib.mkIf cfg.improvedCommands.enable {
|
|
||||||
programs.lsd = {
|
|
||||||
enable = true;
|
|
||||||
enableAliases = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.bat.enable = true;
|
|
||||||
home.shellAliases.cat = "bat -p";
|
|
||||||
|
|
||||||
programs.fzf.enable = true;
|
|
||||||
|
|
||||||
programs.zoxide = {
|
|
||||||
enable = true;
|
|
||||||
options = ["--cmd cd"];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
25
modules/home/shell/default.nix
Normal file
25
modules/home/shell/default.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.myConfig.shell;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
./starship.nix
|
||||||
|
./direnv.nix
|
||||||
|
./enhancedCommands.nix
|
||||||
|
./nixAliases.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
options.myConfig.shell = {
|
||||||
|
bash.enable = lib.mkEnableOption "";
|
||||||
|
zsh.enable = lib.mkEnableOption "";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
programs.bash.enable = cfg.bash.enable;
|
||||||
|
|
||||||
|
programs.zsh.enable = cfg.zsh.enable;
|
||||||
|
};
|
||||||
|
}
|
||||||
13
modules/home/shell/direnv.nix
Normal file
13
modules/home/shell/direnv.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.myConfig.shell.direnv.enable = lib.mkEnableOption "";
|
||||||
|
|
||||||
|
config.programs.direnv = lib.mkIf config.myConfig.shell.direnv.enable {
|
||||||
|
enable = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
config.global.hide_env_diff = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
24
modules/home/shell/enhancedCommands.nix
Normal file
24
modules/home/shell/enhancedCommands.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.myConfig.shell.enhancedCommands.enable = lib.mkEnableOption "";
|
||||||
|
|
||||||
|
config = lib.mkIf config.myConfig.shell.enhancedCommands.enable {
|
||||||
|
programs.lsd = {
|
||||||
|
enable = true;
|
||||||
|
enableAliases = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bat.enable = true;
|
||||||
|
home.shellAliases.cat = "bat -p";
|
||||||
|
|
||||||
|
programs.fzf.enable = true;
|
||||||
|
|
||||||
|
programs.zoxide = {
|
||||||
|
enable = true;
|
||||||
|
options = ["--cmd cd"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
16
modules/home/shell/nixAliases.nix
Normal file
16
modules/home/shell/nixAliases.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
}
|
||||||
23
modules/home/shell/starship.nix
Normal file
23
modules/home/shell/starship.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.myConfig.shell.starship.enable = lib.mkEnableOption "";
|
||||||
|
|
||||||
|
config.programs.starship = lib.mkIf config.myConfig.shell.starship.enable {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
enableBashIntegration = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
cmd_duration.disabled = true;
|
||||||
|
directory = {
|
||||||
|
truncation_length = 0;
|
||||||
|
truncation_symbol = "…/";
|
||||||
|
truncate_to_repo = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
bash.enable = true;
|
bash.enable = true;
|
||||||
starship.enable = true;
|
starship.enable = true;
|
||||||
nixAliases.enable = true;
|
nixAliases.enable = true;
|
||||||
improvedCommands.enable = true;
|
enhancedCommands.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue