From e3d22e620628d42bd7fb531d6f2eb90550a46c35 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Mon, 23 Sep 2024 19:31:53 +1000 Subject: [PATCH] feature(starship): move to a module --- modules/default.nix | 28 ++++++++++++++++++++++++++++ modules/module-list.nix | 3 +++ modules/profiles/starship.nix | 17 +++++++++++++++++ outputs.nix | 3 +++ profiles/bash.nix | 3 --- profiles/host_common.nix | 1 - profiles/starship.nix | 5 ----- profiles/zsh.nix | 3 --- 8 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 modules/default.nix create mode 100644 modules/module-list.nix create mode 100644 modules/profiles/starship.nix delete mode 100644 profiles/starship.nix diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..6bb4702 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,28 @@ +{ + self, + inputs, + nixpkgs, + ragenix, + ... +}: let + nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem; + customModules = import ./module-list.nix; + baseModules = [ + { + imports = [ + ({pkgs, ...}: { + nix.nixPath = [ + "nixpkgs=${pkgs.path}" + ]; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + documentation.info.enable = false; + }) + ]; + } + ]; + defaultModules = baseModules ++ customModules; +in { + imports = defaultModules; +} diff --git a/modules/module-list.nix b/modules/module-list.nix new file mode 100644 index 0000000..73b2166 --- /dev/null +++ b/modules/module-list.nix @@ -0,0 +1,3 @@ +[ + ./profiles/starship.nix +] diff --git a/modules/profiles/starship.nix b/modules/profiles/starship.nix new file mode 100644 index 0000000..a3d71f5 --- /dev/null +++ b/modules/profiles/starship.nix @@ -0,0 +1,17 @@ +# A minimal, blazing fast, and extremely customizable prompt for any shell +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.profiles.starship; +in { + options.profiles.starship = { + enable = mkEnableOption "to enable the starship prompt."; + }; + config = mkIf (cfg.enable) { + programs.starship.enable = true; + }; +} diff --git a/outputs.nix b/outputs.nix index d78aec7..2d7e27f 100644 --- a/outputs.nix +++ b/outputs.nix @@ -36,7 +36,10 @@ in { }; }; defaults = { + imports = [./modules]; + # make flake inputs accessible in NixOS _module.args.inputs = inputs; + profiles.starship.enable = true; }; # Comment out deployment line when building the SD Image. airgead = { diff --git a/profiles/bash.nix b/profiles/bash.nix index f603b43..0bceace 100644 --- a/profiles/bash.nix +++ b/profiles/bash.nix @@ -6,9 +6,6 @@ export TERM="xterm-256color" test -r ~/.dir_colors && eval $(dircolors ~/.dir_colors) ''; - promptInit = '' - eval "$(starship init bash)" - ''; vteIntegration = true; }; } diff --git a/profiles/host_common.nix b/profiles/host_common.nix index 68c3acb..b005d79 100644 --- a/profiles/host_common.nix +++ b/profiles/host_common.nix @@ -10,7 +10,6 @@ ./chrony.nix ../profiles/neovim.nix ../profiles/logrotate.nix - ../profiles/starship.nix ./tmux.nix ./zsh.nix ]; diff --git a/profiles/starship.nix b/profiles/starship.nix deleted file mode 100644 index 3d49779..0000000 --- a/profiles/starship.nix +++ /dev/null @@ -1,5 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - starship # A minimal, blazing fast, and extremely customizable prompt for any shell - ]; -} diff --git a/profiles/zsh.nix b/profiles/zsh.nix index 0529ed7..e5278c7 100644 --- a/profiles/zsh.nix +++ b/profiles/zsh.nix @@ -25,9 +25,6 @@ enable = true; plugins = ["fzf" "git"]; }; - promptInit = '' - eval "$(starship init zsh)" - ''; vteIntegration = true; };