Compare commits

...

4 commits

Author SHA1 Message Date
10f8586a59
feat(home): nh 2024-11-18 21:17:19 -08:00
a5bbca6c24
feat(home): Bundle i3 dependancies 2024-11-18 20:37:50 -08:00
60b871bce0
feat(home): Polybar 2024-11-18 20:34:43 -08:00
11f596b1ae
fix(home): Starship git status fixes
Need to escape the escapes
2024-11-17 20:50:45 -08:00
7 changed files with 464 additions and 15 deletions

View file

@ -4,7 +4,7 @@ default:
alias dh := deployhome alias dh := deployhome
[group('home')] [group('home')]
deployhome user=env_var('USER'): deployhome user=env_var('USER'):
home-manager switch -b bak --flake .#marley@nyx nh home switch -c marley@nyx -b bak
[group('home')] [group('home')]
refreshhome: refreshhome:
@ -19,4 +19,4 @@ updatejust this:
alias gc := collectgarbage alias gc := collectgarbage
collectgarbage: collectgarbage:
nix-collect-garbage -d nh clean all

View file

@ -9,6 +9,7 @@ in
{ {
home.keyboard.options = [ "apple:alupckeys" ]; home.keyboard.options = [ "apple:alupckeys" ];
# FIXME: Remove once we are on NixOS
targets.genericLinux = enabled; targets.genericLinux = enabled;
# FIXME: Remove this once nvim is set up # FIXME: Remove this once nvim is set up
@ -51,9 +52,9 @@ in
man = enabled; man = enabled;
ncmpcpp = enabled; ncmpcpp = enabled;
neo = enabled; neo = enabled;
nh = enabled;
rbw = enabled; rbw = enabled;
ripgrep = enabled; ripgrep = enabled;
rofi = enabled;
ssh = enabled; ssh = enabled;
starship = enabled; starship = enabled;
systemctl = enabled; systemctl = enabled;
@ -65,12 +66,11 @@ in
}; };
services = { services = {
clipboard = enabled; clipboard = enabled;
# TODO: bundle this with the WM under xorg
dunst = enabled;
syncthing = enabled; syncthing = enabled;
}; };
xorg = { xorg = {
xsession = enabled; xsession = enabled;
i3 = enabled;
}; };
}; };

View file

@ -0,0 +1,23 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf mkDefault;
cfg = config.marleyos.programs.nh;
home = config.home.homeDirectory;
in
{
options.marleyos.programs.nh.enable = mkEnableOption "nh";
config = mkIf cfg.enable {
home.packages = with pkgs; [
nh
];
home.sessionVariables.FLAKE = mkDefault "${home}/marleyos";
};
}

View file

@ -107,17 +107,17 @@ in
git_status = { git_status = {
disabled = mkDefault false; disabled = mkDefault false;
style = mkDefault "bg:overlay fg:love"; style = mkDefault "bg:overlay fg:love";
format = mkDefault (mkFormat "$all_status$ahead_behind"); format = mkDefault (mkFormat " $all_status$ahead_behind");
up_to_date = mkDefault "[ ](bg:overlay fg:iris)"; up_to_date = mkDefault "[ ](bg:overlay fg:iris)";
untracked = mkDefault "[?\($count\)](bg:overlay fg:gold)"; untracked = mkDefault "[?\\($count\\)](bg:overlay fg:gold)";
stashed = mkDefault "[$](bg:overlay fg:iris)"; stashed = mkDefault "[\\$](bg:overlay fg:iris)";
modified = mkDefault "[!\($count\)](bg:overlay fg:gold)"; modified = mkDefault "[!\\($count\\)](bg:overlay fg:gold)";
renamed = mkDefault "[»\($count\)](bg:overlay fg:iris)"; renamed = mkDefault "[»\\($count\\)](bg:overlay fg:iris)";
deleted = mkDefault "[\($count\)](style)"; deleted = mkDefault "[\\($count\\)](style)";
staged = mkDefault "[++\($count\)](bg:overlay fg:gold)"; staged = mkDefault "[++\\($count\\)](bg:overlay fg:gold)";
ahead = mkDefault "[\(\${count}\)](bg:overlay fg:foam)"; ahead = mkDefault "[\\(\${count}\\)](bg:overlay fg:foam)";
diverged = mkDefault "[\[](bg:overlay fg:iris)[\(\${ahead_count}\)](bg:overlay fg:foam)[\(\${behind_count}\)](bg:overlay fg:rose)[\]](bg:overlay fg:iris)"; diverged = mkDefault "[\\[](bg:overlay fg:iris)[\\(\${ahead_count}\\)](bg:overlay fg:foam)[\\(\${behind_count}\\)](bg:overlay fg:rose)[\\]](bg:overlay fg:iris)";
behind = mkDefault "[\(\${count}\)](bg:overlay fg:rose)"; behind = mkDefault "[\\(\${count}\\)](bg:overlay fg:rose)";
}; };
fill = { fill = {

View file

@ -0,0 +1,398 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.services.polybar;
hasXorg = config.xsession.enable;
in
{
options.marleyos.services.polybar.enable = mkEnableOption "polybar";
config = mkIf (cfg.enable && hasXorg) {
home.packages = with pkgs; [
xorg.xrandr
];
services.polybar = {
enable = true;
script = # bash
''
if type "xrandr" &/dev/null; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
bar="main"
if [[ "$m" == "DP-0" ]]; then
bar="tray"
fi
MONITOR="$m" polybar -q "$bar" &
done
else
polybar -q main &
fi
'';
# colorblock theme from
# https://github.com/adi1090x/polybar-themes
settings =
let
color = rec {
background = "#26232f";
foreground = background;
foreground-alt = "#c8c8cb";
alpha = "#00000000";
shade1 = "#d6adb5";
shade2 = "#d7bdc3";
dark = "#0a0a0a";
};
fmt = {
prefix.font = 2;
padding = 2;
};
pref = {
font = 2;
padding = 2;
};
hasRofi = config.marleyos.programs.rofi.enable;
cfgHome = config.xdg.configHome;
in
{
### Global Settings ###
"settings" = {
screenchange.reload = true;
compositing = {
background = "source";
foreground = "over";
overline = "over";
underline = "over";
border = "over";
};
pseudo.transparency = false;
};
"global/wm" = {
margin.bottom = 0;
};
### Bars ###
"bar/main" = {
monitor.text = "\${env:MONITOR:}";
monitor.strict = false;
override.redirect = true;
bottom = false;
fixed.center = true;
width = "99%";
height = 40;
offset.x = "0.5%";
offset.y = "1%";
background = color.alpha;
inherit (color) foreground;
radius.top = 0.0;
radius.bottom = 0.0;
underline.size = 2;
underline.color = color.foreground;
border.size = 0;
border.color = color.background;
padding = 0;
module.margin.left = 0;
module.margin.right = 0;
font =
let
mkFt = s: "Maple Mono NF:pixelsize=${toString s};4";
in
[
(mkFt 10)
(mkFt 15)
];
modules.left = "launcher sep workspaces sep title sep mpd";
modules.right = "filesystem sep cpu memory pulseaudio network date sep sysmenu";
dim.value = 1.0;
wm.restack = "i3";
enable.ipc = true;
scroll.up = "i3-msg workspace next_on_output";
scroll.down = "i3-msg workspace prev_on_output";
};
"bar/tray" = {
"inherit" = "bar/main";
modules.right = "color-switch tray sep updates sep cpu memory pulseaudio network date sep sysmenu";
};
### Modules ###
"module/sep" = {
type = "custom/text";
format = " ";
content.background = color.alpha;
content-foreground = color.alpha;
};
"module/launcher" = {
type = "custom/text";
content = {
text = "";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/launchers/type-1/launcher.sh &";
click.right = mkIf hasRofi "${cfgHome}/rofi/applets/bin/screenshot.sh &";
};
"module/workspaces" = {
type = "internal/xworkspaces";
pin.workspaces = true;
enable.click = true;
enable.scroll = true;
icon.text = [
"1;1"
"2;2"
"3;3"
"4;4"
"5;5"
];
icon.default = 0;
format = {
text = "<label-state>";
inherit (color) background;
inherit (color) foreground;
};
label = {
monitor = "%name%";
active = {
text = "%icon%";
background = color.shade2;
foreground = color.dark;
padding = 2;
};
occupied = {
text = "%icon%";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
urgent = {
text = "%icon%";
inherit (color) background;
foreground = "#cc6666";
padding = 2;
};
empty = {
text = "%icon%";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
};
};
"module/title" = {
type = "internal/xwindow";
format.text = "<label>";
format.prefix = pref // {
text = "";
background = color.shade2;
foreground = color.dark;
};
label = {
text = "%title%";
maxlen = 30;
inherit (color) background;
foreground = "${color.foreground-alt}";
padding = 2;
empty = {
text = "Desktop";
inherit (color) background;
foreground = "${color.foreground-alt}";
padding = 2;
};
};
};
"module/mpd" = {
type = "internal/mpd";
interval = 1;
format.online = "<icon-prev><toggle><icon-next><label-song>";
format.offline = {
text = "<label-offline>";
prefix = pref // {
text = "";
background = color.shade1;
inherit (color) foreground;
};
};
label = {
song = {
text = "%artist% - %title%";
maxlen = 25;
ellipsis = true;
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
time = "%elapsed / %total%";
offline = {
text = "Offline";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
};
icon =
let
mkIcon =
i:
pref
// {
text = i;
foreground = color.dark;
background = color.shade1;
};
in
{
play = mkIcon "";
pause = mkIcon "";
stop = "";
prev = mkIcon " ";
next = mkIcon " ";
seekb = "";
seekf = "";
random = "";
repeat = "";
repeatone = "";
single = "";
consume = "";
};
toggle = {
on.foreground = color.foreground;
off.foreground = color.background;
};
};
"module/filesystem" = {
type = "internal/fs";
mount = [
"/"
"/mnt/babeshare/marley"
"/mnt/babeshare/babez"
];
interval = 30;
fixed.values = true;
format = {
mounted = fmt // {
text = "<label-mounted>";
prefix.text = "";
background = color.shade2;
};
unmounted = fmt // {
text = "<label-unmounted>";
prefix.text = "";
background = color.shade2;
};
};
label = {
mounted = " %free%";
unmounted = " %mountpoint: not mounted";
};
};
"module/cpu" = {
type = "internal/cpu";
interval = 1;
format = fmt // {
text = "<label>";
prefix.text = "";
background = color.shade2;
inherit (color) foreground;
};
label = " %percentage%%";
};
"module/memory" = {
type = "internal/memory";
interval = 1;
format = fmt // {
text = "<label>";
prefix.text = "";
background = color.shade1;
};
label = " %mb_used%";
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
sink = "alsa_output.pci-0000_03_00.6.analog-stereo";
use.ui.max = false;
interval = 5;
format = {
volume = {
text = "<ramp-volume> <label-volume>";
background = color.shade2;
padding = 2;
};
muted = fmt // {
text = "<label-muted>";
prefix.text = "";
background = color.shade2;
};
};
};
"module/network" = {
type = "internal/network";
interface = "enp4s0";
interval = 1.0;
accumulate.stats = true;
unknown.as.up = true;
format = {
connected = fmt // {
text = "<label-connected>";
prefix.text = "";
background = color.shade2;
};
disconnected = fmt // {
text = "<label-disconnected>";
prefix.text = "";
background = color.shade2;
};
};
label = {
connected = "%{A1:networkmanager_dmenu &:} %netspeed%%{A}";
disconnected = "%{A1:networkmanager_dmenu &:} Offline%{A}";
};
};
"module/date" = {
type = "internal/date";
interval = 1.0;
time.text = " %I:%M %p";
time.alt = " %a, %d %b %Y";
format = fmt // {
text = "<label>";
prefix.text = "";
background = color.shade1;
inherit (color) foreground;
};
label = "%time%";
};
"module/sysmenu" = {
type = "custom/text";
format = {
text = "";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/powermenu/type-1/powermenu.sh &";
};
};
};
};
}

View file

@ -0,0 +1,22 @@
{
lib,
config,
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib.marleyos) enabled;
cfg = config.marleyos.xorg.i3;
in
{
options.marleyos.xorg.i3.enable = mkEnableOption "i3";
config = mkIf cfg.enable {
marleyos = {
programs.rofi = enabled;
services.polybar = enabled;
services.dunst = enabled;
};
};
}

View file

@ -0,0 +1,6 @@
_: final: prev: {
polybar = prev.polybar.override {
mpdSupport = true;
pulseSupport = true;
};
}