add some initial stuff

This commit is contained in:
Lucy Hochkamp 2025-03-15 15:45:30 +01:00
commit 62df62c3aa
No known key found for this signature in database
23 changed files with 2101 additions and 0 deletions

33
modules/cli/fish.nix Normal file
View file

@ -0,0 +1,33 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.cli.fish;
in
{
options.xyno.cli.fish.enable = lib.mkEnableOption "enable the fish shell with xynos config";
config = lib.mkIf cfg.enable {
programs.bash = {
# auto spawn fish if interactive
interactiveShellInit = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
environment.systemPackages = with pkgs; [
fishPlugins.grc
grc
];
programs.direnv.enableFishIntegration = true;
programs.fish.interactiveShellInit = ''
set -g fish_key_bindings fish_vi_key_bindings
'';
programs.fish.enable = true;
};
}

252
modules/cli/starship.nix Normal file
View file

@ -0,0 +1,252 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.cli.starship;
in
{
options.xyno.cli.starship.enable =
lib.mkEnableOption "enable the starship shell prompt with xynos config";
config = lib.mkIf cfg.enable {
programs.starship.enable = true;
programs.starship.settings = {
enable = true;
settings = {
"add_newline" = false;
# "format" = "($direnv$nix_shell$container$fill$git_metrics\n)$cmd_duration$hostname$localip$shlvl$shell$env_var$jobs$username$directory ";
"format" = "$cmd_duration$status$hostname$localip$shlvl$shell$env_var$jobs$username$directory";
"right_format" =
"$nix_shell$git_branch$git_commit$git_state$git_status$package$custom$os$battery$time";
aws.disabled = true;
status.disabled = false;
battery.disabled = true;
"buf" = {
"format" = " [buf](italic) [$symbol $version $buf_version]($style)";
# "symbol" = "■ ";
};
"c" = {
"format" = " [$symbol($version(-$name))]($style)";
# "symbol" = " ";
};
"character" = {
"error_symbol" = "[:](italic purple)";
"format" = "$symbol ";
"success_symbol" = "[:](bold italic bright-yellow)";
"vimcmd_replace_one_symbol" = "r";
"vimcmd_replace_symbol" = "R";
"vimcmd_symbol" = "[>](italic dimmed green)";
"vimcmd_visual_symbol" = "SEL";
};
"cmd_duration" = {
"format" = "[$duration](italic white) ";
};
"conda" = {
"format" = " conda [$symbol$environment]($style)";
# "symbol" = "◯ ";
};
"continuation_prompt" = "[ ](dimmed white)";
"dart" = {
"format" = " dart [$symbol($version )]($style)";
# "symbol" = "◁◅ ";
};
"deno" = {
"format" = " [deno](italic) [ $version](green bold)";
"version_format" = "\${raw}";
};
"directory" = {
"format" = "[$path]($style)[$read_only]($read_only_style)";
"home_symbol" = "~";
"read_only" = " (ro) ";
"repo_root_format" =
"[$before_root_path]($before_repo_root_style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style)";
"repo_root_style" = "bold blue";
"style" = "italic blue";
"truncation_length" = 50;
"truncation_symbol" = "";
"use_os_path_sep" = true;
};
"docker_context" = {
"format" = " docker [$symbol$context]($style)";
# "symbol" = "◧ ";
};
direnv = {
disabled = false;
};
"elixir" = {
"format" = " exs [$symbol $version OTP $otp_version ]($style)";
# "symbol" = "△ ";
};
"elm" = {
"format" = " elm [$symbol($version )]($style)";
# "symbol" = "◩ ";
};
"env_var" = {
"VIMSHELL" = {
"format" = "[$env_value]($style)";
"style" = "green italic";
};
};
"fill" = {
"symbol" = " ";
};
"git_branch" = {
"format" = " [$branch(:$remote_branch)]($style)";
"ignore_branches" = [
"main"
"master"
];
"only_attached" = true;
"style" = "italic bright-blue";
"symbol" = "(bold italic bright-blue)";
# "symbol" = "[△](bold italic bright-blue)";
"truncation_length" = 13;
"truncation_symbol" = "";
};
"git_metrics" = {
"added_style" = "italic dimmed green";
"deleted_style" = "italic dimmed red";
"disabled" = false;
"format" = "([$added]($added_style))([$deleted]($deleted_style))";
"ignore_submodules" = true;
};
"git_status" = {
"ahead" = "[[\${count}](bold white)](italic green)";
"behind" = "[[\${count}](bold white)](italic red)";
"conflicted" = "[](italic bright-magenta)";
"deleted" = "[](italic red)";
"diverged" =
"[ [\${ahead_count}](regular white)[\${behind_count}](regular white)](italic bright-magenta)";
"format" =
"([$ahead_behind$staged$modified$untracked$renamed$deleted$conflicted$stashed]($style))";
"modified" = "[](italic yellow)";
"renamed" = "[](italic bright-blue)";
"staged" = "[[$count](bold white)](italic bright-cyan)";
"stashed" = "[](italic white)";
"style" = "bold italic bright-blue";
"untracked" = "[](italic bright-yellow)";
};
"golang" = {
"format" = " go [$symbol($version )]($style)";
# "symbol" = "∩ ";
};
"haskell" = {
"format" = " hs [$symbol($version )]($style)";
# "symbol" = "❯λ ";
};
"java" = {
"format" = " java [\${symbol}(\${version} )]($style)";
# "symbol" = " ";
};
"jobs" = {
"format" = "[$symbol$number]($style) ";
"style" = "white";
"symbol" = "[](blue italic)";
};
"julia" = {
"format" = " jl [$symbol($version )]($style)";
"symbol" = " ";
};
"localip" = {
"disabled" = false;
"format" = " [$localipv4](bold magenta)";
"ssh_only" = true;
};
"lua" = {
"format" = " [lua](italic) [\${symbol}\${version}]($style)";
"style" = "bold bright-yellow";
"symbol" = " ";
"version_format" = "\${raw}";
};
"memory_usage" = {
"format" = " mem [\${ram}( \${swap})]($style)";
"symbol" = " ";
};
"nim" = {
"format" = " nim [$symbol($version )]($style)";
"symbol" = " ";
};
"nix_shell" = {
"format" = "[$symbol]($style) [$name](italic dimmed white)";
"impure_msg" = "[impure](bold dimmed red)";
"pure_msg" = "[pure](bold dimmed green)";
"style" = "bold italic dimmed blue";
"symbol" = "󱄅";
"unknown_msg" = "[unknown](bold dimmed ellow)";
};
"nodejs" = {
"detect_extensions" = [
];
"detect_files" = [
"package-lock.json"
"yarn.lock"
"pnpm-lock.yaml"
];
"detect_folders" = [
"node_modules"
];
"format" = " [node](italic) [($version)](bold bright-green)";
"version_format" = "\${raw}";
};
"package" = {
"format" = " [pkg](italic dimmed) [$symbol$version]($style)";
"style" = "dimmed yellow italic bold";
# "symbol" = "◨ ";
"version_format" = "\${raw}";
};
"python" = {
"format" = " [py](italic) [\${symbol}\${version}]($style)";
"style" = "bold bright-yellow";
# "symbol" = "[⌉](bold bright-blue)⌊ ";
"version_format" = "\${raw}";
};
"ruby" = {
disabled = true;
"format" = " [rb](italic) [\${symbol}\${version}]($style)";
"style" = "bold red";
# "symbol" = "◆ ";
"version_format" = "\${raw}";
};
"rust" = {
"format" = " [rs](italic) [$symbol$version]($style)";
"style" = "bold red";
# "symbol" = "⊃ ";
"version_format" = "\${raw}";
};
"spack" = {
"format" = " spack [$symbol$environment]($style)";
# "symbol" = "◇ ";
};
"sudo" = {
"disabled" = true;
"format" = "[$symbol]($style)";
"style" = "bold italic bright-purple";
"symbol" = "sudo";
};
"swift" = {
"format" = " [sw](italic) [\${symbol}\${version}]($style)";
"style" = "bold bright-red";
# "symbol" = "◁ ";
"version_format" = "\${raw}";
};
"time" = {
"disabled" = true;
"format" = "[ $time]($style)";
"style" = "italic dimmed white";
"time_format" = "%R";
"utc_time_offset" = "local";
};
"username" = {
"disabled" = false;
"format" = "[$user]($style) ";
"show_always" = false;
"style_root" = "purple bold italic";
"style_user" = "bright-yellow bold italic";
};
};
};
};
}

33
modules/cli/tmux.nix Normal file
View file

@ -0,0 +1,33 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.cli.tmux;
in
{
options.xyno.cli.tmux.enable = lib.mkEnableOption "enable tmux with xynos config";
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
keyMode = "vi";
clock24 = true;
historyLimit = 10000;
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
];
extraConfig = ''
set -sg escape-time 0 # makes vim esc usable
new-session -s main
bind-key -n C-e send-prefix
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# set-option -g default-terminal "tmux-256color"
# set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
'';
};
};
}

34
modules/desktop/mako.nix Normal file
View file

@ -0,0 +1,34 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.mako;
makoConf = pkgs.writeText "mako.conf" ''
font=Source Sans Pro Nerd Font 11
background-color=#1d2021ff
border-color=#3c3836FF
text-color=#ebdbb2ff
progress-color=over #928374FF
'';
in
{
options.xyno.desktop.mako.enable = lib.mkEnableOption "enable mako notification daemon";
options.xyno.desktop.mako.wantedBy = lib.mkOption {
type = lib.types.str;
default = "niri.service";
};
options.xyno.desktop.mako.package = lib.mkOption {
type = lib.types.package;
default = pkgs.mako;
};
config = lib.mkIf cfg.enable {
systemd.user.services.mako = {
wantedBy = [ cfg.wantedBy ];
script = "${cfg.package}/bin/mako -c ${makoConf}";
restartTrigers = makoConf;
};
};
}

49
modules/desktop/niri.nix Normal file
View file

@ -0,0 +1,49 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.niri;
floatingAppids = [
"floating-alacritty"
"org.pulseaudio.pavucontrol"
"KeePassXC"
"org.gnome.NautilusPreviewer"
];
matchFloat = lib.concatStringSep "\n" (
map (x: ''
window-rule {
match app-id="${x}"
open-floating true
open-focused true
}
'') floatingAppids
);
in
{
options.xyno.desktop.niri.enable = lib.mkEnableOption "enable the niri desktop with xynos config";
config = lib.mkIf cfg.enable {
xyno.desktop = {
waybar.enable = lib.mkDefault true;
mako.enable = lib.mkDefault true;
};
programs.niri.enable = true;
environment.etc."niri/config.kdl".text = ''
// xwayland
spawn-at-startup "${pkgs.xwayland-sattelite}/bin/xwayland-sattelite"
screenshot-path "~/Pictures/screenshots/screenshot-%Y-%m-%d %H-%M-%S.png"
input {
workspace-auto-back-and-forth
focus-follows-mouse max-scroll-amount="10%"
touchpad {
tap
}
}
// autogenerated from here on
${matchFloat}
'';
};
}

420
modules/desktop/waybar.nix Normal file
View file

@ -0,0 +1,420 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.waybar;
in
{
options.xyno.desktop.waybar.enable = lib.mkEnableOption "enable mako notification daemon";
options.xyno.desktop.waybar.wantedBy = lib.mkOption {
type = lib.types.str;
default = "niri.service";
};
options.xyno.desktop.waybar.package = lib.mkOption {
type = lib.types.package;
default = pkgs.waybar;
};
options.xyno.desktop.waybar.mode = lib.mkOption {
type = lib.types.str;
default = "niri";
};
config = lib.mkIf cfg.enable {
programs.waybar.enable = true;
environment.etc."xdg/waybar/config".text = builtins.toJSON {
mainBar = {
layer = "top";
position = "top";
height = 15;
modules-left =
(lib.mkIf (cfg.mode == "river") [
"river/tags"
"river/layout"
"river/window"
])
++ (lib.mkIf (cfg.mode == "niri") [
"niri/workspaces"
"niri/window"
]);
modules-right = [
"tray"
"power_profiles_daemon"
"idle_inhibitor"
"wireplumber"
"battery"
"backlight"
"cpu"
"temperature"
"memory"
"disk"
"custom/tailscale"
"network"
"clock"
];
"river/window" = {
max-length = 40;
};
wireplumber = {
"format" = "{icon} {volume}%";
"format-muted" = " MUTE";
# "on-click" = "${pkgs.pwvucontrol}/bin/pwvucontrol";
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
"on-click-right" = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"format-icons" = [
""
""
""
];
};
"backlight" = {
"device" = "amdgpu_bl1";
"format" = "{icon} {percent}%";
"format-icons" = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
"on-scroll-up" = "${pkgs.brightnessctl}/bin/brightnessctl s +10";
"on-scroll-down" = "${pkgs.brightnessctl}/bin/brightnessctl s 10-";
};
"idle_inhibitor" = {
format = "{icon} ";
format-icons = {
"activated" = "󰅶";
"deactivated" = "󰾪";
};
};
battery = {
"states" = {
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
"tooltip-format" = "Capacity: {capacity}%\nPower Draw: {power:0.2f}W\n{timeTo}\nCycles: {cycles}";
"max-length" = 25;
};
"cpu" = {
"interval" = 10;
"format" = " {:0.0f}%";
"max-length" = 10;
};
"temperature" = {
"format" = " {temperatureC}°C";
};
memory = {
interval = 30;
format = " {used:0.0f}/{total:0.0f}GB";
};
clock = {
interval = 1;
format = "{:%Y-%m-%dT%H:%M:%S%z}";
"tooltip-format" = "<tt><small>{calendar}</small></tt>";
"calendar" = {
"mode" = "year";
"mode-mon-col" = 3;
"weeks-pos" = "right";
"on-scroll" = 1;
"format" = {
"months" = "<span color='#ffead3'><b>{}</b></span>";
"days" = "<span color='#ecc6d9'><b>{}</b></span>";
"weeks" = "<span color='#99ffdd'><b>W{}</b></span>";
"weekdays" = "<span color='#ffcc66'><b>{}</b></span>";
"today" = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
"actions" = {
"on-click-right" = "mode";
"on-scroll-up" = "shift_up";
"on-scroll-down" = "shift_down";
};
};
disk = {
format = "󰋊 {specific_used:0.0f}/{specific_total:0.0f}GB";
unit = "GB";
path = "/persistent";
};
"network" = {
"on-click" =
"${pkgs.alacritty}/bin/alacritty --class floating-alacritty -e ${pkgs.impala}/bin/impala";
"format" = "{ifname}";
"format-wifi" = "󰖩 {essid}";
"format-ethernet" = "󰈀 {ifname}";
"format-disconnected" = "󰖪";
"tooltip-format" = "{ifname} via {gwaddr}\n{ipaddr}/{cidr}";
"tooltip-format-wifi" = "{essid} ({signaldBm} dBm) {frequency} GHz\n{ipaddr}/{cidr}";
"tooltip-format-ethernet" = "{ifname}\n{ipaddr}/{cidr}";
"tooltip-format-disconnected" = "Disconnected";
"max-length" = 50;
};
};
};
environment.etc."xdg/waybar/style.css".text = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: "Source Sans Pro Nerd Font";
font-size: 12px;
}
window#waybar {
/* background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);*/
color: #a89984;
background-color: #1d2021;
/* transition-property: background-color;
transition-duration: .5s;*/
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
/*window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}*/
#tags button {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each workspace name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#tags button:hover {
background: rgba(0, 0, 0, 0.2);
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
}
#tags button.focused {
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
color: #ebdbb2;
}
#tags button.occupied {
color: #d3869b;
}
#tags button.urgent {
background-color: #cc241d;
color: #ebdbb2;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #fbf1c7;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#custom-poweroff,
#custom-suspend,
#mpd {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
}
#window,
#workspaces,
#tags {
margin: 0 2px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#battery {
color: #d3869b;
}
#battery.charging, #battery.plugged {
color: #98971a;
}
@keyframes blink {
to {
background-color: #fbf1c7;
color: #df3f71;
}
}
#battery.critical:not(.charging) {
background-color: #1d2021;
color: #d3869b;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#backlight {
color: #458588;
}
#temperature {
color: #fabd2f;
}
#temperature.critical {
background-color: #fbf1c7;
color: #b57614;
}
#memory {
color: #FCF434; /* enby yellow */
}
#disk {
color: #FFFFFF; /* enby white */
}
#network {
color: #b8bb26; /* enby green */
}
#clock {
color: #9C59D1; /* enby purple */
/*color: #2C2C2C; enby black */
}
#network.disconnected {
background-color: #fbf1c7;
color: #9d0006;
}
#wireplumber {
color: #fe8019;
}
#tray {
}
#tray > .needs-attention {
background-color: #fbf1c7;
color: #3c3836;
}
#idle_inhibitor {
background-color: #1d2021;
color: #ebdbb2;
}
#idle_inhibitor.activated {
background-color: #fbf1c7;
color: #3c3836;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
'';
};
}

8
modules/module-list.nix Normal file
View file

@ -0,0 +1,8 @@
[
./desktop/niri.nix
./desktop/waybar.nix
./desktop/mako.nix
./cli/fish.nix
./cli/starship.nix
]

47
modules/presets/cli.nix Normal file
View file

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.xyno.presets.cli;
in
{
options.xyno.presets.cli.enable =
lib.mkEnableOption "enables xynos cli config with fish and helix and stuff";
config = lib.mkIf cfg.enable {
xyno.cli.fish.enable = true;
xyno.cli.starship.enable = true;
environment.systemPackages = with pkgs; [
jq
bottom
htop
curl
aria2
file
git
neofetch
ripgrep
pv
yt-dlp
helix
];
environment.variables.EDITOR = "hx";
environment.variables.VISUAL = "hx";
environment.shellAliases = {
l = "ls -al";
gc = "git commit -v";
gpl = "git pull";
gd = "git diff";
ga = "git add";
gp = "git push";
gpf = "git push --force-with-lease";
gs = "git status -v";
gl = "git log --graph";
p = "cd ~/proj";
ytl = ''yt-dlp -f "bv*+mergeall[vcodec=none]" --audio-multistreams'';
};
};
}

22
modules/presets/gui.nix Normal file
View file

@ -0,0 +1,22 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.presets.gui;
in
{
options.xyno.presets.gui.enable = lib.mkEnableOption "enables xynos gui config";
config = cfg.enable {
xyno.desktop.niri.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
services.displayManager.defaultSession = "niri";
services.displayManager.sddm = {
settings.General.DisplayServer = "wayland";
enable = true;
wayland.enable = true;
};
};
}