refactor!: battleship alive!

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-04-10 13:12:23 -03:00
parent 69c5ca2bd7
commit 5082bdeed4
85 changed files with 744 additions and 4958 deletions

View File

@@ -154,7 +154,7 @@ in {
};
zsh.enable = true;
zsh.enableAutosuggestions = true;
zsh.autosuggestion.enable = true;
zsh.enableCompletion = true;
zsh.initExtra = ''
export GPG_TTY=$(tty)

View File

@@ -1,19 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.davinci;
in {
imports = [];
options.davinci = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
davinci-resolve
];
};
}

View File

@@ -1,115 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.eww;
ewwDir = "${config.xdg.configHome}/eww";
eww-get-active-workspace = pkgs.writeShellScriptBin "eww-get-active-workspace" ''
hyprctl="${pkgs.hyprland}/bin/hyprctl"
jq="${pkgs.jq}/bin/jq"
socat="${pkgs.socat}/bin/socat"
$hyprctl monitors -j |
$jq '.[] | select(.focused) | .activeWorkspace.id'
$socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
'';
eww-volume = pkgs.writeShellScriptBin "eww-volume" ''
pulsemixer="${pkgs.pulsemixer}/bin/pulsemixer"
sink="$(echo $($pulsemixer -l | grep 'Default' | grep 'sink-' | awk '{print $3}') | rev | cut -c 2- | rev)"
function="$1"
value="$2"
if [[ "$function" == "set" ]]; then
$pulsemixer --id "$sink" --set-volume "$value"
echo "0"
elif [[ "$function" == "get" ]]; then
echo "$($pulsemixer --id "$sink" --get-volume | awk '{print $1}')"
elif [[ "$function" == "label" ]]; then
echo "$($pulsemixer --id "$sink" --get-mute | awk '{if($1>0) print "󰖁"; else print "󰕾"}')"
fi
'';
eww-weather = pkgs.writeShellScriptBin "eww-weather" ''
curl="${pkgs.curl}/bin/curl"
jq="${pkgs.jq}/bin/jq"
lat="$(cat /run/secrets/lat)"
lon="$(cat /run/secrets/lon)"
res="$($curl -s "https://api.open-meteo.com/v1/forecast?latitude=$lat&longitude=$lon&current=temperature_2m,precipitation,wind_speed_10m,rain")"
temperature="$(echo $res | $jq .current.temperature_2m)"
wind="$(echo $res | $jq .current.wind_speed_10m)"
precipitation="$(echo $res | $jq .current.precipitation)"
rain="$(echo $res | $jq .current.rain)"
if [[ "$1" == "--temperature" ]]; then
echo $temperature
elif [[ "$1" == "--wind" ]]; then
echo $wind
elif [[ "$1" == "--precipitation" ]]; then
echo $precipitation
elif [[ "$1" == "--rain" ]]; then
echo $rain
fi
'';
in {
imports = [];
options.eww = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
eww-wayland
];
home.file."${ewwDir}/eww.yuck".source = ./eww.yuck;
home.file."${ewwDir}/eww.scss".source = ./eww.scss;
home.file."${ewwDir}/vars.yuck".text = ''
(deflisten active-workspace :initial "1"
"${eww-get-active-workspace}/bin/eww-get-active-workspace")
(defpoll volume :interval "1s"
"${eww-volume}/bin/eww-volume get")
(defpoll volume-label :interval "1s"
"${eww-volume}/bin/eww-volume label")
(defvar volume-set "${eww-volume}/bin/eww-volume set {}")
(defvar volume-toggle "${pkgs.pulsemixer}/bin/pulsemixer --toggle-mute")
(defpoll temperature :interval "15m" :initial "00.0"
"${eww-weather}/bin/eww-weather --temperature")
(defpoll wind :interval "15m" :initial "00.0"
"${eww-weather}/bin/eww-weather --wind")
(defpoll precipitation :interval "15m" :initial "00.0"
"${eww-weather}/bin/eww-weather --precipitation")
(defpoll rain :interval "15m" :initial "00.0"
"${eww-weather}/bin/eww-weather --rain")
'';
home.file."${ewwDir}/vars.scss".text = ''
$color-accent: #${config.theme.accent};
$foreground: rgba(#${config.colorScheme.palette.base03}, 1);
$background: rgba(#${config.colorScheme.palette.base00} , 1);
$shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
$border-radius: 5px;
@mixin box-style {
border-radius: $border-radius;
box-shadow: $shadow;
background-color: $background;
}
'';
};
}

View File

@@ -1,71 +0,0 @@
@import "/home/guz/.config/eww/vars.scss";
* {
background-color: transparent;
all: unset;
}
tooltip {
@include box-style();
background-color: $foreground;
color: $color-accent;
font-weight: bold;
}
.wrapper {
padding: 5px 10px;
}
.bar {
@include box-style();
color: $color-accent;
font-family: 'Fira Code Nerd Font';
font-weight: bold;
background-color: $background;
padding: 5px 10px;
.rightstuff {
// background-color: blue;
}
.middlestuff {
// background-color: green;
font-size: small;
}
.leftstuff {
// background-color: red;
}
}
.temperature, .rain, .season {
margin: 0 4px;
}
.metric {
.label {
font-size: small;
margin: 0;
padding: 0;
color: $color-accent;
margin-right: 5px;
}
margin-right: 5px;
scale trough {
all: unset;
background: $foreground;
border-radius: 50px;
min-height: 5px;
min-width: 50px;
highlight {
all: unset;
background-color: $color-accent;
border-radius: 10px;
}
}
}

View File

@@ -1,151 +0,0 @@
(include "/home/guz/.config/eww/vars.yuck");
(defpoll week-day :interval "1m"
:initial "1"
`date +%w`)
(defpoll quarter :interval "24h"
:initial "1"
`date +%q`)
(defpoll time :interval "10s"
:initial "00:00"
`date +%H:%M`)
(defpoll date :interval "1m"
:initial "00/00"
`date +%d/%m`)
(defwidget empty [] "")
(defwidget day []
(box :orientation "h"
; Sun, Moon, Mars, Mercury, Jupiter, Venus, Saturn
"${[" Sun", " Mon", " Tue", "󰬸 Wed", "󱡓 Thu", " Fri", " Sat"][week-day]} ${date} ${time}"))
(defwidget season []
(box :orientation "h"
"${["", "󰖨 Summer", "󰌪 Autumn", " Winter", "󰉊 Spring"][quarter]}"))
(defwidget metric [label value ?value-text ?onchange ?onclick]
(box :orientation "h"
:tooltip "${value-text != "" ? value-text : value}"
:space-evenly false
:class "metric"
(box :orientation "h"
:class "label"
(eventbox :active {onclick != ""}
:width 15
:cursor "pointer"
:onclick onclick
label))
(scale :min 0
:max 101
:active {onchange != ""}
:onchange onchange
:value value)))
(defwidget system-stats []
(box :class "system-stats"
""))
(defwidget workspaces [workspace]
(box :class "workspace"
:orientation "h"
"${
workspace == 1 ? '' : ''
} ${
workspace == 2 ? '' : ''
} ${
workspace == 3 ? '' : ''
} ${
workspace == 4 ? '' : ''
} ${
workspace == 5 ? '' : ''
}"))
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "20px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
:exclusive true
(box :orientation "h"
:class "wrapper"
(centerbox :orientation "h"
:class "bar"
(box :orientation "h"
:halign "start"
:class "rightstuff"
(workspaces :workspace active-workspace)
(empty)
(empty))
(box :orientation "h"
:halign "center"
:class "middlestuff"
(day))
(box :orientation "h"
:halign "end"
:class "leftstuff"
:space-evenly false
(metric :label volume-label
:value volume
:value-text "${volume-label} Volume ${volume}%"
:onclick volume-toggle
:onchange volume-set)))))
(defwindow bar-2
:monitor 1
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "20px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
:exclusive true
(box :orientation "h"
:class "wrapper"
(centerbox :orientation "h"
:class "bar"
(box :orientation "h"
:halign "start"
:class "rightstuff"
(metric :label ""
:value "${EWW_RAM.used_mem_perc}"
:value-text " Ram ${round(EWW_RAM.used_mem_perc, 2)}%")
(metric :label ""
:value "${EWW_CPU.avg}"
:value-text " CPU ${round(EWW_CPU.avg, 2)}%")
(metric :label "󰨣"
:value "${EWW_DISK["/"].used_perc}"
:value-text "󰨣 Disk ${round(EWW_DISK["/"].used_perc, 2)}%")
(empty)
(empty))
(box :orientation "h"
:halign "center"
:class "middlestuff"
:space-evenly false
(box :class "season"
(season))
(label :tooltip "󱣖 ${temperature}°C -  ${wind}km/h"
:class "temperature"
:text "${round(temperature, 0)}󰔄")
(label :tooltip "󰖗 ${rain}mm - 󰖌 ${precipitation}mm"
:class "rain"
:text "${round(precipitation, 2)}mm"))
(box :orientation "h"
:halign "end"
:class "leftstuff"
(empty)
(workspaces :workspace "${active-workspace - 5}")))))

View File

@@ -1,333 +0,0 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.hyprland;
in {
imports = [];
options.hyprland = with lib;
with lib.types; {
enable = mkEnableOption "";
monitors = mkOption {
default = [];
/*
type = listOf (submodule ({ ... }: {
options = {
id = mkOption {
type = str;
};
name = mkOption {
type = str;
};
resolution = mkOption {
type = str;
};
hz = mkOption {
type = nullOr int;
default = null;
};
offset = mkOption {
type = nullOr str;
default = null;
};
scale = mkOption {
type = nullOr int;
default = null;
};
};
}));
*/
};
exec = mkOption {
default = [];
type = listOf str;
};
env = mkOption {
default = {};
type = attrsOf str;
};
windowRules = mkOption {
default = {};
description = "window = [ \"rule\" ]";
type = attrsOf (listOf str);
};
input = {
keyboard.layout = mkOption {
default = "br";
type = str;
};
keyboard.variant = mkOption {
default = "abnt2";
type = str;
};
mouse.follow = mkOption {
default = true;
type = bool;
};
mouse.sensitivity = mkOption {
default = 0;
type = number;
};
};
general = {
gaps_in = mkOption {
default = 5;
type = number;
};
gaps_out = mkOption {
default = 10;
type = number;
};
border.size = mkOption {
default = 0;
type = number;
};
border.color.active = mkOption {
default = "rgba(ffffff99) rgba(ffffff33) 90deg";
type = str;
};
border.color.inactive = mkOption {
default = "rgba(18181800)";
type = str;
};
layout = mkOption {
default = "dwindle";
type = str;
};
};
decoration = {
rouding = mkOption {
default = 5;
type = number;
};
dim.inactive = mkOption {
default = true;
type = bool;
};
dim.strength = mkOption {
default = 0.2;
type = number;
};
dim.around = mkOption {
default = 0.4;
type = number;
};
};
animations = {
enabled = mkOption {
default = true;
type = bool;
};
};
workspaces = mkOption {
default = [];
/*
type = {
name = str;
monitor = nullOr str;
default = nullOr bool;
extraRules = nullOr str;
};
*/
};
binds = {
mod = mkOption {
default = "SUPER";
type = str;
};
keyboard = mkOption {
default = [];
type = listOf str;
};
mouse = mkOption {
default = [];
type = listOf str;
};
};
};
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.package = inputs.hyprland.packages."${pkgs.system}".hyprland;
wayland.windowManager.hyprland.xwayland.enable = true;
wayland.windowManager.hyprland.systemd.enable = true;
wayland.windowManager.hyprland.settings = lib.mkMerge [
# Sets monitor variables ("$name" = "id") so it can be used in rules later
(
builtins.listToAttrs (map
(m: {
name = "\$${m.name}";
value = "${m.id}";
})
cfg.monitors)
)
{
# Construct the "name,resolution@hz,offset,scale" strings
monitor = (
map
(
m: "${m.name},${m.resolution}@${
toString (
if m ? hz
then m.hz
else 60
)
},${
if m ? offset
then m.offset
else "0x0"
},${
toString (
if m ? scale
then m.scale
else 1
)
}"
)
cfg.monitors
);
exec-once = cfg.exec;
# "Hack" to transform attributes sets to lists (because I didn't know other way to do it)
# Transform { "envName" = "value" } to [ "envName,value" ]
env =
builtins.attrValues
(builtins.mapAttrs (n: v: "${n},${v}") (lib.attrsets.mergeAttrsList [
{
"XCURSOR_SIZE" = "24";
"MOZ_ENABLE_WAYLAND" = "1";
}
cfg.env
]));
windowrulev2 = let
firefoxPipRules = [
"float"
# "nofullscreenrequest"
"size 480 270"
"fakefullscreen"
"nodim"
"noblur"
];
in
builtins.concatLists
(builtins.attrValues (
builtins.mapAttrs
(
w: rs: (map (r: "${r},${w}") rs)
)
(lib.attrsets.mergeAttrsList [
{
"title:^(Picture-in-Picture)$,class:^(firefox)$" = firefoxPipRules;
"title:^(Firefox)$,class:^(firefox)$" = firefoxPipRules;
"title:^(Picture-in-Picture)$" = firefoxPipRules;
"class:^(xwaylandvideobridge)$" = [
"opacity 0.0 override 0.0 override"
"noanim"
"nofocus"
"noinitialfocus"
];
}
cfg.windowRules
])
));
input = {
kb_layout = cfg.input.keyboard.layout;
kb_variant = cfg.input.keyboard.variant;
follow_mouse =
if cfg.input.mouse.follow
then "1"
else "0";
sensitivity = toString cfg.input.mouse.sensitivity;
};
general = {
gaps_in = toString cfg.general.gaps_in;
gaps_out = toString cfg.general.gaps_out;
border_size = toString cfg.general.border.size;
"col.active_border" = toString cfg.general.border.color.active;
"col.inactive_border" = toString cfg.general.border.color.inactive;
layout = cfg.general.layout;
};
decoration = {
rounding = toString cfg.decoration.rouding;
dim_inactive =
if cfg.decoration.dim.inactive
then "true"
else "false";
dim_strength = toString cfg.decoration.dim.strength;
dim_around = toString cfg.decoration.dim.around;
blur = {
enabled = "false";
size = "20";
};
};
animations = {
enabled =
if cfg.animations.enabled
then "yes"
else "no";
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation = [
"windows, 1, 7, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
dwindle = {
pseudotile = "yes";
preserve_split = "yes";
};
master = {
new_is_master = "true";
};
gestures = {
workspace_swipe = "off";
};
workspace = (
map
(w: "${w.name},${
if w ? monitor
then "monitor:${w.monitor},"
else ""
}${
if w ? default && w.default
then "default:true,"
else ""
}${
if w ? extraRules
then "${w.extraRules}"
else ""
}")
cfg.workspaces
);
"$mod" = cfg.binds.mod;
bind = cfg.binds.keyboard;
bindm = cfg.binds.mouse;
}
];
};
}

View File

@@ -1,20 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.krita;
in {
imports = [];
options.krita = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [krita];
home.file."${config.xdg.configHome}/kritarc".source = ./kritarc;
home.file."${config.xdg.configHome}/kritashortcutsrc".source = ./kritashortcutsrc;
};
}

View File

@@ -1,94 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.lf;
in {
imports = [];
options.lf = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = lib.mkIf cfg.enable {
programs.lf = {
enable = true;
settings = {
preview = true;
hidden = true;
drawbox = true;
icons = true;
ignorecase = true;
};
commands = {
delete-trash = '' ''${{
touch "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo"
echo "[Trash Info]" > "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo"
echo "Path=$f" >> "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo"
echo "DeletionDate=$(date +%Y-%m-%dT%H:%M:%S)" >> "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo"
mv $f ${config.xdg.dataHome}/Trash/files
}}'';
dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"'';
editor-open = ''$$EDITOR $f'';
mkfile = '' ''${{
printf "Dirname: "
read DIR
if [[ $DIR = */ ]]; then
mkdir $DIR
else
touch $DIR
fi
}}'';
mkdir = '' ''${{
printf "Dirname: "
read DIR
mkdir $DIR
}}'';
trash = ''cd ${config.xdg.dataHome}/Trash/files'';
trash-recover = '' ''${{
mv $f "$(cat "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo" | sed -n '2 p' | tr "=" "\n" | sed -n '2 p')"
rm -rf "${config.xdg.dataHome}/Trash/info/$(basename $f).trashinfo"
}}'';
};
keybindings = {
"." = "set hidden!";
"<enter>" = "open";
a = "mkfile";
A = "mkdir";
D = "delete";
R = "trash-recover";
ee = "editor-open";
};
extraConfig = let
previewer = pkgs.writeShellScriptBin "pv.sh" ''
file=$1
w=$2
h=$3
x=$4
y=$5
if [[ "$(${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then
${pkgs.kitty}/bin/kitty +kitten icat --silent --stdin no --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty
exit 1
fi
${pkgs.pistol}/bin/pistol "$file"
'';
cleaner = pkgs.writeShellScriptBin "clean.sh" ''
${pkgs.kitty}/bin/kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty
'';
in ''
set cleaner ${cleaner}/bin/clean.sh
set previewer ${previewer}/bin/pv.sh
'';
};
};
}

View File

@@ -1,23 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.obs;
in {
imports = [];
options.obs = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
obs-studio
obs-cli
obs-studio-plugins.wlrobs
obs-studio-plugins.obs-pipewire-audio-capture
obs-studio-plugins.obs-vkcapture
];
};
}

View File

@@ -1,49 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.obsidian;
vaultCmd = pkgs.writeShellScriptBin "vault" ''
command="$1";
if [[ "$command" == "sync" ]]; then
git="${pkgs.git}/bin/git";
date="$(date +%F) $(date +%R)"
cd ${cfg.vaultDir}
$git pull
if [[ "$(echo "$($git diff --shortstat)" | awk '{print $1}')" -ne "" ]]; then
$git commit -m "vault backup: $date" -a
fi
$git push
fi
'';
in {
imports = [];
options.obsidian = with lib;
with lib.types; {
enable = mkEnableOption "";
vaultCmd = mkOption {
type = bool;
default = false;
};
vaultDir = mkOption {
type = str;
default = "${config.home.homeDirectory}/.vault";
};
};
config = lib.mkIf cfg.enable {
services.flatpak.packages = [
"md.obsidian.Obsidian"
];
home.packages = [
(
if cfg.vaultCmd
then vaultCmd
else null
)
];
};
}

View File

@@ -1,21 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.starship;
in {
imports = [];
options.starship = with lib;
with lib.types; {
enable = mkEnableOption "Enable module";
enableZsh = mkEnableOption "Enable Zsh Integration";
enableBash = mkEnableOption "Enable Bash Integration";
};
config = lib.mkIf cfg.enable {
programs.starship.enable = true;
programs.starship.enableZshIntegration = lib.mkIf cfg.enableZsh true;
programs.starship.enableBashIntegration = lib.mkIf cfg.enableBash true;
};
}

View File

@@ -1,85 +0,0 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.tmux;
in {
imports = [];
options.tmux = with lib;
with lib.types; {
enable = mkEnableOption "Enable Tmux module";
baseIndex = mkOption {
type = ints.unsigned;
default = 1;
};
prefix = mkOption {
type = str;
default = "C-Space";
};
shell = mkOption {
type = str;
default = "\${pkgs.bash}/bin/bash";
};
};
config = lib.mkIf cfg.enable {
programs.tmux.enable = true;
programs.tmux.baseIndex = cfg.baseIndex;
programs.tmux.keyMode = "vi";
programs.tmux.mouse = true;
programs.tmux.terminal = "screen-256color";
programs.tmux.prefix = cfg.prefix;
# TODO: package tmux plugins so tpm is not necessary
home.file."${config.xdg.configHome}/tmux/plugins/tpm" = {
source = inputs.tmux-plugin-manager;
};
home.packages = with pkgs; [
entr # b0o/tmux-autoreload depends on it
];
programs.tmux.extraConfig = ''
set -g @plugin 'b0o/tmux-autoreload'
set -g @plugin 'aserowy/tmux.nvim'
set -g @plugin 'guz013/frappuccino-tmux'
set -g @plugin 'pschmitt/tmux-ssh-split'
set -sg terminal-overrides ",*:RGB"
set -g renumber-windows on
bind -T prefix / split-window -v -c "#''''{pane_current_path}"
bind -T prefix \\ split-window -h -c "#''''{pane_current_path}"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "application directory session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
run '${config.xdg.configHome}/tmux/plugins/tpm/tpm'
'';
};
}

View File

@@ -1,84 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.wezterm;
in {
imports = [];
options.wezterm = with lib;
with lib.types; {
enable = mkEnableOption "Enable Wezterm";
integration = {
zsh = mkEnableOption "Enable Zsh Integration";
};
colorScheme = mkOption {
type = str;
default = "system";
};
defaultProg = mkOption {
default = [];
};
font = mkOption {
default = "Fira Code";
type = str;
};
fontSize = mkOption {
default = 12;
type = number;
};
};
config = lib.mkIf cfg.enable {
programs.wezterm.enable = true;
programs.wezterm.enableZshIntegration = lib.mkIf (cfg.integration.zsh) true;
programs.wezterm.extraConfig = ''
return {
enable_tab_bar = false;
color_scheme = "${cfg.colorScheme}",
default_prog = { ${lib.concatMapStrings (x: "'" + x + "',") cfg.defaultProg} },
font = wezterm.font("${cfg.font}"),
font_size = ${toString cfg.fontSize},
enable_wayland = false, -- TEMPORALLY FIX (see wez/wezterm#4483)
}
'';
programs.wezterm.colorSchemes = {
system = with config.colorScheme.palette; {
foreground = "#${base05}";
background = "#${base00}";
cursor_fg = "#${base01}";
cursor_bg = "#${config.theme.accent}";
cursor_border = "#${config.theme.accent}";
selection_fg = "#${base04}";
selection_bg = "#${config.theme.accent}";
split = "#${base04}";
ansi = [
"#${base03}"
"#${base08}"
"#${base0B}"
"#${base0A}"
"#${base0D}"
"#${base0E}"
"#${base0C}"
"#${base03}"
];
brights = [
"#${base03}"
"#${base08}"
"#${base0B}"
"#${base0A}"
"#${base0D}"
"#${base0E}"
"#${base0C}"
"#${base03}"
];
};
};
};
}

View File

@@ -1,67 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.zsh;
in {
imports = [];
options.zsh = with lib;
with lib.types; {
enable = mkEnableOption "Enable Zsh shell";
plugins = {
suggestions.enable = mkOption {
type = bool;
default = true;
};
completion.enable = mkOption {
type = bool;
default = true;
};
};
extraConfig = {
init = mkOption {
type = lines;
default = "";
};
beforeComp = mkOption {
type = lines;
default = "";
};
first = mkOption {
type = lines;
default = "";
};
};
loginExtra = mkOption {
type = lines;
default = "";
};
logoutExtra = mkOption {
type = lines;
default = "";
};
variables = mkOption {
type = attrsOf str;
default = {};
};
};
config = lib.mkIf cfg.enable {
programs.zsh = {
enable = true;
oh-my-zsh.enable = true;
loginExtra = cfg.loginExtra;
logoutExtra = cfg.logoutExtra;
initExtra = cfg.extraConfig.init;
initExtraBeforeCompInit = cfg.extraConfig.beforeComp;
initExtraFirst = cfg.extraConfig.first;
localVariables = cfg.variables;
enableAutosuggestions = lib.mkIf (cfg.plugins.suggestions.enable) true;
enableCompletion = lib.mkIf (cfg.plugins.completion.enable) true;
};
};
}

View File

@@ -1,6 +1,9 @@
{...}: {
imports = [
./hyprland.nix
./krita
./neovim.nix
./obsidian
./wezterm.nix
];
options = {};

View File

@@ -0,0 +1,38 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.programs.hyprland;
hyprconfValueType = with lib.types;
nullOr (oneOf [
bool
int
float
str
path
(attrsOf hyprconfValueType)
(listOf hyprconfValueType)
]);
in {
imports = [];
options.programs.hyprland = with lib;
with lib.types; {
enable = mkEnableOption "";
settings = mkOption {
type = attrsOf hyprconfValueType;
default = {};
};
};
config = with lib;
mkIf cfg.enable {
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.package = inputs.hyprland.packages."${pkgs.system}".hyprland;
wayland.windowManager.hyprland.xwayland.enable = true;
wayland.windowManager.hyprland.systemd.enable = true;
wayland.windowManager.hyprland.settings = cfg.settings;
};
}

View File

@@ -0,0 +1,21 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.programs.krita;
in {
imports = [];
options.programs.krita = with lib;
with lib.types; {
enable = mkEnableOption "";
};
config = with lib;
mkIf cfg.enable {
home.packages = with pkgs; [krita];
home.file."${config.xdg.configHome}/kritarc".source = ./kritarc;
home.file."${config.xdg.configHome}/kritashortcutsrc".source = ./kritashortcutsrc;
};
}

View File

@@ -0,0 +1 @@
{...}: {}

View File

@@ -0,0 +1,42 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.programs.obsidian;
vaultCmd = pkgs.writeShellScriptBin "vault" ''
function awk() { ${pkgs.gawk}/bin/awk "$@"; }
function git() { ${pkgs.git}/bin/git "$@"; }
function gum() { ${pkgs.gum}/bin/gum "$@"; }
${builtins.readFile ./vault.sh}
'';
in {
imports = [];
options.programs.obsidian = with lib;
with lib.types; {
enable = mkEnableOption "";
vaultCmd = mkOption {
type = bool;
default = false;
};
vaultDir = mkOption {
type = str;
default = "${config.home.homeDirectory}/.vault";
};
};
config = with lib;
mkIf cfg.enable {
services.flatpak.packages = mkIf cfg.flatpak [
"md.obsidian.Obsidian"
];
home.packages = [
(
if cfg.vaultCmd
then vaultCmd
else null
)
];
};
}

View File

@@ -0,0 +1,41 @@
function vault-sync() {
local vault_dir="$1"
date="$(date +%F) $(date +%R)"
set -e
pushd $vault_dir
gum log --structured --prefix 'vault sync' --level info "Syncing vault through git"
gum log --structured --prefix 'vault sync' --level debug "Pulling from remote"
git pull
# Skip if there's no changes
if git diff --quiet "*.*"; then
gum log --structured \
--prefix 'vault sync' \
--level warn \
'No files changed'
popd
exit 0
else
gum log --structured --prefix 'vault sync' --level debug 'Committing' commit_msg "vault sync: $date"
git commit -am "vault sync: $date"
gum log --structured --prefix 'vault sync' --level debug 'Pushing to remote'
git push
gum log --structured --prefix 'vault sync' --level info 'Vault synced!'
fi
popd
}
case "$1" in
"sync") vault-sync $vault_dir ;;
*) gum log --structured --prefix 'vault' --level error "Command $1 does not exist" ;;
esac

View File

@@ -1,50 +0,0 @@
{
config,
lib,
inputs,
pkgs,
...
}: let
cfg = config.theme;
in {
imports = [
inputs.nix-colors.homeManagerModules.default
];
options.theme = with lib;
with lib.types; {
accent = mkOption {
type = str;
default = "cdd6f4";
description = "The accent color of Frappuccino";
};
accentBase = mkOption {
type = str;
default = "magenta";
description = "The base name for the accent color to be used in the terminal";
};
scheme = mkOption {
type = path;
default = ../../themes/frappuccino.yaml;
};
};
config = {
colorScheme = inputs.nix-colors.lib.schemeFromYAML "frappuccino" (builtins.readFile cfg.scheme);
home.packages = with pkgs; [
gnome.gnome-themes-extra
];
gtk = {
enable = true;
theme = {
name = "Catppuccin-Mocha-Compact-Mauve-Dark";
package = pkgs.catppuccin-gtk.override {
size = "compact";
tweaks = ["rimless" "black"];
accents = ["mauve"];
variant = "mocha";
};
};
};
};
}