diff options
Diffstat (limited to 'users')
| -rw-r--r-- | users/seth/default.nix | 36 | ||||
| -rw-r--r-- | users/seth/programs/bash.nix | 47 | ||||
| -rw-r--r-- | users/seth/programs/default.nix | 4 | ||||
| -rw-r--r-- | users/seth/programs/fish.nix | 68 | ||||
| -rw-r--r-- | users/seth/programs/nu.nix (renamed from users/seth/shell/nu.nix) | 4 | ||||
| -rw-r--r-- | users/seth/programs/zsh.nix (renamed from users/seth/shell/zsh.nix) | 4 | ||||
| -rw-r--r-- | users/seth/shell/bash.nix | 38 | ||||
| -rw-r--r-- | users/seth/shell/default.nix | 45 | ||||
| -rw-r--r-- | users/seth/shell/fish.nix | 60 |
9 files changed, 158 insertions, 148 deletions
diff --git a/users/seth/default.nix b/users/seth/default.nix index ad36c4a..c71dab9 100644 --- a/users/seth/default.nix +++ b/users/seth/default.nix @@ -1,10 +1,44 @@ +{ config, lib, ... }: +let + cfg = config.seth; +in { + options.seth = { + shellAliases.enable = lib.mkEnableOption "shell aliases" // { + default = config.seth.enable; + defaultText = lib.literalExpression "config.seth.enable"; + }; + + shellVariables.enable = lib.mkEnableOption "shell variables" // { + default = config.seth.enable; + defaultText = lib.literalExpression "config.seth.enable"; + }; + }; + imports = [ ./base ./desktop ./programs ./services - ./shell ./tweaks ]; + + config = lib.mkMerge [ + (lib.mkIf cfg.shellAliases.enable { + home.shellAliases = { + diff = "diff --color=auto"; + g = "git"; + gs = "g status"; + }; + }) + + (lib.mkIf cfg.shellVariables.enable { + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = config.home.sessionVariables.EDITOR; + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + LESSHISTFILE = "${config.xdg.stateHome}/less/history"; + }; + }) + ]; } diff --git a/users/seth/programs/bash.nix b/users/seth/programs/bash.nix new file mode 100644 index 0000000..692ec58 --- /dev/null +++ b/users/seth/programs/bash.nix @@ -0,0 +1,47 @@ +{ config, lib, ... }: +let + cfg = config.seth.programs.bash; +in +{ + options.seth.programs.bash = { + enable = lib.mkEnableOption "Bash configuration" // { + default = config.seth.enable; + defaultText = lib.literalExpression "config.seth.enable"; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + programs.bash = { + enable = true; + + historyFile = "${config.xdg.stateHome}/bash/history"; + historyFileSize = 1000; + historySize = 100; + + shellOptions = [ + "cdspell" + "checkjobs" + "checkwinsize" + "dirspell" + "globstar" + "histappend" + "no_empty_cmd_completion" + ]; + }; + } + + # TODO: find out if i need this anymore with standalone HM + (lib.mkIf config.seth.standalone.enable { + programs.bash = { + + bashrcExtra = '' + nixfile=${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.sh + [ -e "$nixfile" ] && source "$nixfile" + ''; + }; + }) + ] + ); +} diff --git a/users/seth/programs/default.nix b/users/seth/programs/default.nix index 686d309..fc6ae12 100644 --- a/users/seth/programs/default.nix +++ b/users/seth/programs/default.nix @@ -19,20 +19,24 @@ in catppuccin.homeManagerModules.catppuccin nix-index-database.hmModules.nix-index + ./bash.nix ./chromium.nix ./firefox + ./fish.nix ./git.nix ./gpg.nix ./mangohud.nix ./moar.nix ./ncspot.nix ./neovim.nix + ./nu.nix ./ssh.nix ./starship ./vim.nix ./vscode.nix ./yazi.nix ./zellij.nix + ./zsh.nix ]; config = lib.mkIf cfg.basePrograms.enable { diff --git a/users/seth/programs/fish.nix b/users/seth/programs/fish.nix new file mode 100644 index 0000000..b1f792a --- /dev/null +++ b/users/seth/programs/fish.nix @@ -0,0 +1,68 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.seth.programs.fish; +in +{ + options.seth.programs.fish = { + enable = lib.mkEnableOption "Fish configuration"; + withPlugins = lib.mkEnableOption "Fish plugins" // { + default = true; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + programs.fish = { + enable = true; + + interactiveShellInit = '' + ${lib.getExe pkgs.nix-your-shell} fish | source + ''; + + functions = { + last_history_item.body = "echo $history[1]"; + }; + + shellAbbrs = { + nixgc = "sudo nix-collect-garbage -d && nix-collect-garbage -d"; + "!!" = { + position = "anywhere"; + function = "last_history_item"; + }; + }; + }; + } + + # TODO: do i still need this weird sourcing? + (lib.mkIf config.seth.standalone.enable { + programs.fish = { + interactiveShellInit = '' + set -l nixfile ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish + if test -e $nixfile + source $nixfile + end + ''; + }; + }) + + (lib.mkIf cfg.withPlugins { + programs.fish = { + plugins = + let + useFishPlugins = map (plugin: { + name = plugin; + inherit (pkgs.fishPlugins.${plugin}) src; + }); + in + useFishPlugins [ "autopair" ]; + }; + }) + ] + ); +} diff --git a/users/seth/shell/nu.nix b/users/seth/programs/nu.nix index f52f049..89a6803 100644 --- a/users/seth/shell/nu.nix +++ b/users/seth/programs/nu.nix @@ -5,11 +5,11 @@ ... }: let - cfg = config.seth.shell.nushell; + cfg = config.seth.programs.nushell; theme = "catppuccin-${config.catppuccin.flavor}"; in { - options.seth.shell.nushell = { + options.seth.programs.nushell = { enable = lib.mkEnableOption "Nushell configuration"; }; diff --git a/users/seth/shell/zsh.nix b/users/seth/programs/zsh.nix index 5c0bc69..f4c30bd 100644 --- a/users/seth/shell/zsh.nix +++ b/users/seth/programs/zsh.nix @@ -5,10 +5,10 @@ ... }: let - cfg = config.seth.shell.zsh; + cfg = config.seth.programs.zsh; in { - options.seth.shell.zsh = { + options.seth.programs.zsh = { enable = lib.mkEnableOption "Zsh configuration"; withPlugins = lib.mkEnableOption "Zsh plugins" // { default = true; diff --git a/users/seth/shell/bash.nix b/users/seth/shell/bash.nix deleted file mode 100644 index bf5b377..0000000 --- a/users/seth/shell/bash.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.seth.shell.bash; -in -{ - options.seth.shell.bash = { - enable = lib.mkEnableOption "Bash configuration" // { - default = config.seth.enable; - defaultText = lib.literalExpression "config.seth.enable"; - }; - }; - - config = lib.mkIf cfg.enable { - programs.bash = { - enable = true; - - # TODO: find out if i need this anymore with standalone HM - bashrcExtra = '' - nixfile=${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.sh - [ -e "$nixfile" ] && source "$nixfile" - ''; - - historyFile = "${config.xdg.stateHome}/bash/history"; - historyFileSize = 1000; - historySize = 100; - - shellOptions = [ - "cdspell" - "checkjobs" - "checkwinsize" - "dirspell" - "globstar" - "histappend" - "no_empty_cmd_completion" - ]; - }; - }; -} diff --git a/users/seth/shell/default.nix b/users/seth/shell/default.nix deleted file mode 100644 index 34b1a98..0000000 --- a/users/seth/shell/default.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.seth.shell; -in -{ - options.seth.shell = { - aliases.enable = lib.mkEnableOption "shell aliases" // { - default = config.seth.enable; - defaultText = lib.literalExpression "config.seth.enable"; - }; - - variables.enable = lib.mkEnableOption "shell variables" // { - default = config.seth.enable; - defaultText = lib.literalExpression "config.seth.enable"; - }; - }; - - imports = [ - ./bash.nix - ./fish.nix - ./nu.nix - ./zsh.nix - ]; - - config = { - home = lib.mkMerge [ - (lib.mkIf cfg.variables.enable { - sessionVariables = rec { - EDITOR = "nvim"; - VISUAL = EDITOR; - CARGO_HOME = "${config.xdg.dataHome}/cargo"; - LESSHISTFILE = "${config.xdg.stateHome}/less/history"; - }; - }) - - (lib.mkIf cfg.aliases.enable { - shellAliases = { - diff = "diff --color=auto"; - g = "git"; - gs = "g status"; - }; - }) - ]; - }; -} diff --git a/users/seth/shell/fish.nix b/users/seth/shell/fish.nix deleted file mode 100644 index 0f101cd..0000000 --- a/users/seth/shell/fish.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.seth.shell.fish; -in -{ - options.seth.shell.fish = { - enable = lib.mkEnableOption "Fish configuration"; - withPlugins = lib.mkEnableOption "Fish plugins" // { - default = true; - }; - }; - - config = lib.mkIf cfg.enable { - programs.fish = lib.mkMerge [ - { - enable = true; - - interactiveShellInit = - '' - ${lib.getExe pkgs.nix-your-shell} fish | source - '' - # TODO: do i still need this weird sourcing? - + lib.optionalString config.seth.standalone.enable '' - set -l nixfile ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish - if test -e $nixfile - source $nixfile - end - ''; - - functions = { - last_history_item.body = "echo $history[1]"; - }; - - shellAbbrs = { - nixgc = "sudo nix-collect-garbage -d && nix-collect-garbage -d"; - "!!" = { - position = "anywhere"; - function = "last_history_item"; - }; - }; - } - - (lib.mkIf cfg.withPlugins { - plugins = - let - mkFishPlugins = map (plugin: { - name = plugin; - inherit (pkgs.fishPlugins.${plugin}) src; - }); - in - mkFishPlugins [ "autopair" ]; - }) - ]; - }; -} |
