feat(vars): add different color schemes for starship prompt
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
f8b89f8fcf
commit
ae55d93ace
9 changed files with 106 additions and 26 deletions
|
@ -9,7 +9,7 @@
|
||||||
...
|
...
|
||||||
} @ inputs: {
|
} @ inputs: {
|
||||||
imports = [
|
imports = [
|
||||||
./vars.nix
|
./vars
|
||||||
|
|
||||||
./modules
|
./modules
|
||||||
./pkgs
|
./pkgs
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
default = {
|
default = {
|
||||||
imports = [
|
imports = [
|
||||||
# Make the vars be the same on Nix and HM
|
# Make the vars be the same on Nix and HM
|
||||||
./vars.nix
|
./vars
|
||||||
{vars = config.vars;}
|
{vars = config.vars;}
|
||||||
|
|
||||||
nur.hmModules.nur
|
nur.hmModules.nur
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib) fileContents;
|
config,
|
||||||
|
lib,
|
||||||
# TODO: have different colors depending on host
|
...
|
||||||
textColor = "#e3e5e5";
|
}: let
|
||||||
firstColor = "#bd93f9";
|
inherit (lib) concatStrings fileContents;
|
||||||
secondColor = "#715895";
|
inherit (config.vars) promptColors;
|
||||||
thirdColor = "#382c4a";
|
|
||||||
fourthColor = "#120e18";
|
|
||||||
in {
|
in {
|
||||||
imports = [./programs.nix];
|
imports = [./programs.nix];
|
||||||
|
|
||||||
|
@ -14,36 +12,37 @@ in {
|
||||||
starship = {
|
starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
format = lib.concatStrings [
|
format = concatStrings [
|
||||||
"╭╴"
|
"╭╴"
|
||||||
"[](fg:${firstColor})"
|
"[](fg:${promptColors.firstColor})"
|
||||||
"[ ](bg:${firstColor} fg:#090c0c)"
|
"[ ](bg:${promptColors.firstColor} fg:#090c0c)"
|
||||||
"[](bg:${secondColor} fg:${firstColor})"
|
"[](bg:${promptColors.secondColor} fg:${promptColors.firstColor})"
|
||||||
"$username$hostname"
|
"$username$hostname"
|
||||||
"[](fg:${secondColor} bg:${thirdColor})"
|
"[](fg:${promptColors.secondColor} bg:${promptColors.thirdColor})"
|
||||||
"$directory"
|
"$directory"
|
||||||
"[](fg:${thirdColor} bg:${fourthColor})"
|
"[](fg:${promptColors.thirdColor} bg:${promptColors.fourthColor})"
|
||||||
"$git_branch"
|
"$git_branch"
|
||||||
"[](fg:${fourthColor})"
|
"[](fg:${promptColors.fourthColor})"
|
||||||
"\n╰╴$shlvl$nix_shell$character"
|
"\n╰╴$shlvl$nix_shell$character"
|
||||||
];
|
];
|
||||||
|
|
||||||
username = {
|
username = {
|
||||||
show_always = true;
|
show_always = true;
|
||||||
style_user = "fg:${textColor} bg:${secondColor}";
|
style_user = "fg:${promptColors.textColor} bg:${promptColors.secondColor}";
|
||||||
style_root = "fg:red bg:${secondColor} blink";
|
style_root = "fg:red bg:${promptColors.secondColor} blink";
|
||||||
format = "[ $user]($style)";
|
format = "[ $user]($style)";
|
||||||
};
|
};
|
||||||
|
|
||||||
hostname = {
|
hostname = {
|
||||||
ssh_only = false;
|
ssh_only = false;
|
||||||
style = "fg:${textColor} bg:${secondColor}";
|
style = "fg:${promptColors.textColor} bg:${promptColors.secondColor}";
|
||||||
format = "[@$hostname ]($style)";
|
format = "[@$hostname ]($style)";
|
||||||
};
|
};
|
||||||
|
|
||||||
directory = {
|
directory = {
|
||||||
style = "fg:${firstColor} bg:${thirdColor}";
|
style = "fg:${promptColors.firstColor} bg:${promptColors.thirdColor}";
|
||||||
format = "[ $path ]($style)";
|
format = "[ $path ]($style)";
|
||||||
truncate_to_repo = false;
|
truncate_to_repo = false;
|
||||||
truncation_length = 0;
|
truncation_length = 0;
|
||||||
|
@ -57,7 +56,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
git_branch = {
|
git_branch = {
|
||||||
style = "fg:${secondColor} bg:${fourthColor}";
|
style = "fg:${promptColors.secondColor} bg:${promptColors.fourthColor}";
|
||||||
symbol = "";
|
symbol = "";
|
||||||
format = "[ $symbol $branch ]($style)";
|
format = "[ $symbol $branch ]($style)";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
./vars.nix
|
./vars
|
||||||
./pkgs
|
./pkgs
|
||||||
./modules/global.nix
|
./modules/global.nix
|
||||||
nur.nixosModules.nur
|
nur.nixosModules.nur
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
home-manager.config = {
|
home-manager.config = {
|
||||||
imports = [
|
imports = [
|
||||||
# Make the vars be the same on Nix and HM
|
# Make the vars be the same on Nix and HM
|
||||||
./vars.nix
|
./vars
|
||||||
{vars = config.vars;}
|
{vars = config.vars;}
|
||||||
|
|
||||||
nur.hmModules.nur
|
nur.hmModules.nur
|
||||||
|
|
|
@ -21,6 +21,32 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
promptMainColor = mkOption {
|
||||||
|
type = types.enum ["red" "green" "blue" "purple"];
|
||||||
|
default = "purple";
|
||||||
|
};
|
||||||
|
|
||||||
|
promptColors = mkOption {
|
||||||
|
description = ''
|
||||||
|
Colors used in starship prompt
|
||||||
|
'';
|
||||||
|
|
||||||
|
default = import ./prompt-schemes.nix cfg.promptMainColor;
|
||||||
|
|
||||||
|
# FIXME: doesn't work when passing vars to home-manager
|
||||||
|
# readOnly = true;
|
||||||
|
type = with types;
|
||||||
|
submodule {
|
||||||
|
options = {
|
||||||
|
textColor = mkOption {type = str;};
|
||||||
|
firstColor = mkOption {type = str;};
|
||||||
|
secondColor = mkOption {type = str;};
|
||||||
|
thirdColor = mkOption {type = str;};
|
||||||
|
fourthColor = mkOption {type = str;};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
configDir = mkOption {
|
configDir = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "/home/${cfg.mainUser}/.nix/devices/${cfg.hostName}/config";
|
default = "/home/${cfg.mainUser}/.nix/devices/${cfg.hostName}/config";
|
||||||
|
@ -35,11 +61,12 @@
|
||||||
The name of the main monitor used for Hyprland
|
The name of the main monitor used for Hyprland
|
||||||
and Regreet which also uses Hyprland
|
and Regreet which also uses Hyprland
|
||||||
'';
|
'';
|
||||||
|
# This is to allow a bash script to know wether this value exists
|
||||||
default = "null";
|
default = "null";
|
||||||
};
|
};
|
||||||
|
|
||||||
greetdDupe = mkOption {
|
greetdDupe = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
If we should duplicate regreet on all monitors
|
If we should duplicate regreet on all monitors
|
||||||
'';
|
'';
|
45
common/vars/prompt-schemes.nix
Normal file
45
common/vars/prompt-schemes.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
color: let
|
||||||
|
schemes = {
|
||||||
|
"purple" = {
|
||||||
|
textColor = "#e3e5e5";
|
||||||
|
firstColor = "#bd93f9";
|
||||||
|
secondColor = "#715895";
|
||||||
|
thirdColor = "#382c4a";
|
||||||
|
fourthColor = "#120e18";
|
||||||
|
};
|
||||||
|
|
||||||
|
"green" = {
|
||||||
|
textColor = "#e3e5e5";
|
||||||
|
firstColor = "#78ae66";
|
||||||
|
secondColor = "#567c49";
|
||||||
|
thirdColor = "#334a2c";
|
||||||
|
fourthColor = "#11180e";
|
||||||
|
};
|
||||||
|
|
||||||
|
"red" = {
|
||||||
|
textColor = "#e3e5e5";
|
||||||
|
firstColor = "#9d0909";
|
||||||
|
secondColor = "#700707";
|
||||||
|
thirdColor = "#430404";
|
||||||
|
fourthColor = "#160101";
|
||||||
|
};
|
||||||
|
|
||||||
|
"blue" = {
|
||||||
|
textColor = "#e3e5e5";
|
||||||
|
firstColor = "#092a9d";
|
||||||
|
secondColor = "#071e70";
|
||||||
|
thirdColor = "#041243";
|
||||||
|
fourthColor = "#010616";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Template
|
||||||
|
"color" = {
|
||||||
|
textColor = "#e3e5e5";
|
||||||
|
firstColor = "";
|
||||||
|
secondColor = "";
|
||||||
|
thirdColor = "";
|
||||||
|
fourthColor = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
schemes.${color}
|
|
@ -21,6 +21,7 @@ in {
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = "binto";
|
hostName = "binto";
|
||||||
|
promptMainColor = "purple";
|
||||||
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
|
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
|
||||||
greetdDupe = false;
|
greetdDupe = false;
|
||||||
fontSize = 12.5;
|
fontSize = 12.5;
|
||||||
|
|
|
@ -16,6 +16,12 @@ in {
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = deviceName;
|
hostName = deviceName;
|
||||||
|
promptMainColor =
|
||||||
|
if deviceName == "thingone"
|
||||||
|
then "green"
|
||||||
|
else if deviceName == "thingtwo"
|
||||||
|
then "red"
|
||||||
|
else "purple";
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.${mainUser} = {
|
users.users.${mainUser} = {
|
||||||
|
|
|
@ -18,6 +18,7 @@ in {
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = "servivi";
|
hostName = "servivi";
|
||||||
|
promptMainColor = "blue";
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users = {
|
users.users = {
|
||||||
|
|
|
@ -19,6 +19,7 @@ in {
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = "wim";
|
hostName = "wim";
|
||||||
|
promptMainColor = "purple";
|
||||||
fontSize = 12.5;
|
fontSize = 12.5;
|
||||||
mainMonitor = "eDP-1";
|
mainMonitor = "eDP-1";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue