1

Compare commits

...

23 Commits

Author SHA1 Message Date
150959a8f1 Lib: Add color functions 2024-10-14 17:13:53 +02:00
cde73d530e Lib: Add library template 2024-10-14 17:13:53 +02:00
80ed6dfdc2 Waybar: Highlight current workspace 2024-10-14 17:13:53 +02:00
d02e5b9fe5 Home: Fix remaining name qualifications after module update 2024-10-14 17:13:53 +02:00
5a5cb72f42 Rofi: Update colorscheme 2024-10-14 17:13:53 +02:00
7da63bf09a Color: Move schemes to own folder 2024-10-14 17:13:53 +02:00
242bd67562 Home: Update HM module template + apply changes to modules 2024-10-14 17:13:53 +02:00
6ef826b03a Hyprland: Move rofi keybindings into rofi module + update rofi styling 2024-10-14 17:13:53 +02:00
b2cd460c11 Neovim: Update colorscheme 2024-10-14 17:13:53 +02:00
962fc533ea Waybar: Update colorscheme 2024-10-14 17:13:53 +02:00
ab12bed918 Rofi: Update colorscheme + menus 2024-10-14 17:13:53 +02:00
18ebac0059 Waybar: Update styling 2024-10-14 17:13:53 +02:00
cc193972c2 Hyprland: Add keybind to lock session 2024-10-14 17:13:53 +02:00
52a80ad815 Neovim: Byte-compile init.lua 2024-10-14 17:13:53 +02:00
b7f1538560 Hyprland: Update hyprpicker shortcuts 2024-10-14 17:13:53 +02:00
bfd54c89e6 Hyprland: Update groupbar colorscheme 2024-10-14 17:13:53 +02:00
7bddc6a15f Neovim: Update lualine colorscheme 2024-10-14 17:13:53 +02:00
a007ffe542 Hyprland: Update dunst normal notification frame 2024-10-14 17:13:53 +02:00
3c69eb5124 Kitty: Update colorscheme to match neovim's lualine 2024-10-14 17:13:53 +02:00
dd21ce0e0b Ags: Switch back to waybar for now
Until I figure out how to theme this thing
2024-10-14 17:13:53 +02:00
782d2dacac Ags: Add starter config 2024-10-14 17:13:53 +02:00
f5919a8389 Neovim: Add typescript LSP support 2024-10-14 17:13:53 +02:00
646889a4a2 System: Cleanup default.nix 2024-10-14 17:13:53 +02:00
34 changed files with 829 additions and 454 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@
result result
config/neovim/store config/neovim/store
home/modules/ags/config/types
home/modules/ags/config/tsconfig.json

View File

@ -1,7 +0,0 @@
* {
bg-col-op: rgba(239, 241, 245, 100%);
bg-col: rgba(239, 241, 245, 60%);
fg-col: #4c4f69;
pink: #d20f39;
trans: rgba(255, 255, 255, 0);
}

View File

@ -1,16 +0,0 @@
* {
dark: #2A231C;
light: #EBEBE5;
accent-dark: #463A2E;
accent-light: #865E43;
pastel-a: #797D62;
pastel-b: #9B9B7A;
pastel-c: #D9AE94;
pastel-d: #E5C59E;
pastel-e: #F1DCA7;
pastel-f: #F8D488;
pastel-g: #E4B074;
pastel-h: #D08C60;
pastel-i: #997B66;
}

View File

@ -1,100 +0,0 @@
/*See https://github.com/davatorium/rofi/blob/1.7.3/doc/rofi-theme.5.markdown#basic-structure-1*/
configuration{
modi: "run,drun,ssh,filebrowser";
font: "JetBrainsMono Nerd Font Mono 14";
show-icons: true;
icon-theme: "Papirus";
/*terminal: "alacritty -o font.size=12";*/
terminal: "kitty";
drun-display-format: "{icon} {name}";
disable-history: false;
hide-scrollbar: true;
display-drun: " apps ";
display-run: " run ";
display-filebrowser: " file ";
display-ssh: " ssh ";
sidebar-mode: false;
}
@theme "colors.rasi"
element-text,
element-icon,
mode-switcher {
background-color: inherit;
text-color: inherit;
}
window {
height: 500px;
width: 700px;
border-radius: 0px;
background-color: @bg-col;
}
mainbox {
background-color: @trans;
}
message {
background-color: @trans;
}
error-message {
background-color: @trans;
margin: 0px 0px 20px 0px;
}
textbox {
background-color: @trans;
padding: 6px;
margin: 20px 20px 0px 20px;
border-radius: 3;
}
inputbar {
children: [prompt,entry];
background-color: @trans;
}
prompt {
background-color: @pink;
padding: 6px;
text-color: @bg-col-op;
border-radius: 3px;
margin: 20px 0px 0px 20px;
}
entry {
padding: 6px;
margin: 20px 20px 0px 10px;
text-color: @fg-col;
background-color: @trans;
border-radius: 3px;
}
listview {
border: 0px 0px 0px;
padding: 6px 0px 0px;
margin: 10px 0px 0px 20px;
columns: 1;
background-color: @trans;
}
element {
padding: 5px;
margin: 0px 20px 0px 0px;
background-color: @trans;
text-color: @pink;
border-radius: 3px;
}
element-icon {
size: 25px;
}
element selected {
background-color: @pink;
text-color: @bg-col-op;
}

View File

@ -1,14 +0,0 @@
#!/bin/bash
# NOTE: This script is used in conjunction with the rocm/python docker image
# Install if necessary
if [[ ! -f "/webui-data/stable-diffusion-webui/launch.py" ]]; then
cd /webui-data
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
python -m pip install --upgrade pip wheel
fi
cd /webui-data/stable-diffusion-webui
REQS_FILE='requirements.txt' python launch.py --precision full --no-half

View File

@ -33,6 +33,8 @@ rec {
# Enable and configure my custom HM modules. # Enable and configure my custom HM modules.
modules = { modules = {
ags.enable = false; # TODO: Configure
chromium = { chromium = {
enable = true; enable = true;
google = false; google = false;
@ -68,12 +70,11 @@ rec {
"$mainMod, T" = ["exec, kitty"]; "$mainMod, T" = ["exec, kitty"];
"$mainMod, E" = ["exec, kitty"]; "$mainMod, E" = ["exec, kitty"];
"$mainMod, N" = ["exec, neovide"]; "$mainMod, N" = ["exec, neovide"];
# "$mainMod, T" = ["exec, alacritty -o font.size=12 -e tmux"];
# "$mainMod, E" = ["exec, alacritty -o font.size=12 -e tmux"];
"$mainMod, P" = ["exec, hyprpicker -a"]; "$mainMod, P" = ["exec, hyprpicker -autocopy -format=hex"];
"$mainMod, S" = ["exec, grim -g \"$(slurp)\""]; "$mainMod, S" = ["exec, grim -g \"$(slurp)\""];
"$mainMod CTRL, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"]; "$mainMod CTRL, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
"$mainMod SHIFT, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"]; ", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"];
", XF86AudioLowerVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"]; ", XF86AudioLowerVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"];
@ -170,10 +171,7 @@ rec {
theme = "Foggy-Lake"; theme = "Foggy-Lake";
}; };
waybar = { waybar.enable = true;
enable = true;
};
zathura.enable = true; zathura.enable = true;
}; };

View File

@ -48,7 +48,6 @@
]; ];
}; };
# TODO: Also set the dunst monitor
waybar.monitor = "HDMI-A-1"; waybar.monitor = "HDMI-A-1";
}; };

View File

@ -5,12 +5,10 @@
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) TEMPLATE;
with mylib.modules; let
cfg = config.modules.TEMPLATE;
in { in {
options.modules.TEMPLATE = import ./options.nix {inherit lib mylib;}; options.modules.TEMPLATE = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {}; config = lib.mkIf TEMPLATE.enable {};
} }

View File

@ -0,0 +1,204 @@
const hyprland = await Service.import("hyprland");
const notifications = await Service.import("notifications");
const mpris = await Service.import("mpris");
const audio = await Service.import("audio");
const battery = await Service.import("battery");
const systemtray = await Service.import("systemtray");
const date = Variable("", {
poll: [1000, 'date "+%H:%M:%S %b %e."'],
});
// widgets can be only assigned as a child in one container
// so to make a reuseable widget, make it a function
// then you can simply instantiate one by calling it
function Workspaces() {
const activeId = hyprland.active.workspace.bind("id");
const workspaces = hyprland.bind("workspaces").as((ws) =>
ws.map(({ id }) =>
Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
class_name: activeId.as((i) => `${i === id ? "focused" : ""}`),
}),
),
);
return Widget.Box({
class_name: "workspaces",
children: workspaces,
});
}
function ClientTitle() {
return Widget.Label({
class_name: "client-title",
label: hyprland.active.client.bind("title"),
});
}
function Clock() {
return Widget.Label({
class_name: "clock",
label: date.bind(),
});
}
// we don't need dunst or any other notification daemon
// because the Notifications module is a notification daemon itself
function Notification() {
const popups = notifications.bind("popups");
return Widget.Box({
class_name: "notification",
visible: popups.as((p) => p.length > 0),
children: [
Widget.Icon({
icon: "preferences-system-notifications-symbolic",
}),
Widget.Label({
label: popups.as((p) => p[0]?.summary || ""),
}),
],
});
}
function Media() {
const label = Utils.watch("", mpris, "player-changed", () => {
if (mpris.players[0]) {
const { track_artists, track_title } = mpris.players[0];
return `${track_artists.join(", ")} - ${track_title}`;
} else {
return "Nothing is playing";
}
});
return Widget.Button({
class_name: "media",
on_primary_click: () => mpris.getPlayer("")?.playPause(),
on_scroll_up: () => mpris.getPlayer("")?.next(),
on_scroll_down: () => mpris.getPlayer("")?.previous(),
child: Widget.Label({ label }),
});
}
function Volume() {
const icons = {
101: "overamplified",
67: "high",
34: "medium",
1: "low",
0: "muted",
};
function getIcon() {
const icon = audio.speaker.is_muted
? 0
: [101, 67, 34, 1, 0].find(
(threshold) => threshold <= audio.speaker.volume * 100,
);
return `audio-volume-${icons[icon]}-symbolic`;
}
const icon = Widget.Icon({
icon: Utils.watch(getIcon(), audio.speaker, getIcon),
});
const slider = Widget.Slider({
hexpand: true,
draw_value: false,
on_change: ({ value }) => (audio.speaker.volume = value),
setup: (self) =>
self.hook(audio.speaker, () => {
self.value = audio.speaker.volume || 0;
}),
});
return Widget.Box({
class_name: "volume",
css: "min-width: 180px",
children: [icon, slider],
});
}
function BatteryLabel() {
const value = battery.bind("percent").as((p) => (p > 0 ? p / 100 : 0));
const icon = battery
.bind("percent")
.as((p) => `battery-level-${Math.floor(p / 10) * 10}-symbolic`);
return Widget.Box({
class_name: "battery",
visible: battery.bind("available"),
children: [
Widget.Icon({ icon }),
Widget.LevelBar({
widthRequest: 140,
vpack: "center",
value,
}),
],
});
}
function SysTray() {
const items = systemtray.bind("items").as((items) =>
items.map((item) =>
Widget.Button({
child: Widget.Icon({ icon: item.bind("icon") }),
on_primary_click: (_, event) => item.activate(event),
on_secondary_click: (_, event) => item.openMenu(event),
tooltip_markup: item.bind("tooltip_markup"),
}),
),
);
return Widget.Box({
children: items,
});
}
function Left() {
return Widget.Box({
spacing: 8,
children: [Workspaces(), ClientTitle()],
});
}
function Center() {
return Widget.Box({
spacing: 8,
children: [Media(), Notification()],
});
}
function Right() {
return Widget.Box({
hpack: "end",
spacing: 8,
children: [Volume(), Clock(), SysTray()],
});
}
function Bar(monitor = 0) {
return Widget.Window({
name: `bar-${monitor}`,
class_name: "ags_bar",
monitor,
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(),
center_widget: Center(),
end_widget: Right(),
}),
});
}
App.config({
style: "/home/christoph/.config/ags/style.css",
windows: [Bar(0)],
});
export {};

View File

@ -0,0 +1,40 @@
window.bar {
background-color: @theme_bg_color;
color: @theme_fg_color;
}
button {
min-width: 0;
padding-top: 0;
padding-bottom: 0;
background-color: transparent;
}
button:active {
background-color: @theme_selected_bg_color;
}
button:hover {
border-bottom: 3px solid @theme_fg_color;
}
label {
font-weight: bold;
}
.workspaces button.focused {
border-bottom: 3px solid @theme_selected_bg_color;
}
.client-title {
color: @theme_selected_bg_color;
}
.notification {
color: yellow;
}
levelbar block,
highlight {
min-height: 10px;
}

View File

@ -2,15 +2,27 @@
config, config,
lib, lib,
mylib, mylib,
pkgs,
... ...
}: }: let
with lib; inherit (config.modules) ags;
with mylib.modules; let
cfg = config.modules.ags;
in { in {
options.modules.ags = import ./options.nix {inherit lib mylib;}; options.modules.ags = import ./options.nix {inherit lib mylib;};
config = config = lib.mkIf ags.enable {
mkIf cfg.enable { programs.ags = {
enable = true;
systemd.enable = true;
# configDir = ./config;
};
home.file = {
# NOTE: Keep this symlinked as long as I'm configuring
".config/ags".source = config.lib.file.mkOutOfStoreSymlink "/home/christoph/NixFlake/home/modules/ags/config";
# LSP typechecking support (use ags --init)
# ".config/ags/types".source = config.lib.file.mkOutOfStoreSymlink "${pkgs.ags}/share/com.github.Aylur.ags/types";
};
}; };
} }

View File

@ -1,22 +1,18 @@
# TODO: Expose some settings
{ {
config, config,
nixosConfig,
lib, lib,
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) chromium;
with mylib.modules; let
cfg = config.modules.chromium;
in { in {
options.modules.chromium = import ./options.nix {inherit lib mylib;}; options.modules.chromium = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf chromium.enable {
home.packages = with pkgs; home.packages = with pkgs;
builtins.concatLists [ builtins.concatLists [
(optionals cfg.google [ (lib.optionals chromium.google [
google-chrome # Trash, but required for decker pdf export google-chrome # Trash, but required for decker pdf export
# Required for some flatpak compatibility # Required for some flatpak compatibility

View File

@ -3,10 +3,8 @@
lib, lib,
mylib, mylib,
... ...
}: }: let
with lib; inherit (config.modules) color;
with mylib.modules; let
cfg = config.modules.color;
# Options and assignments will be generated from those keys # Options and assignments will be generated from those keys
colorKeys = [ colorKeys = [
@ -44,13 +42,13 @@ in {
options.modules.color = import ./options.nix {inherit lib mylib colorKeys;}; options.modules.color = import ./options.nix {inherit lib mylib colorKeys;};
config = let config = let
lightDefs = import ./${cfg.lightScheme}.nix; lightDefs = import ./schemes/${color.lightScheme}.nix;
darkDefs = import ./${cfg.darkScheme}.nix; darkDefs = import ./schemes/${color.darkScheme}.nix;
mkLightColorAssignment = key: {${key} = lightDefs.${key};}; mkLightColorAssignment = key: {${key} = lightDefs.${key};};
mkDarkColorAssignment = key: {${key} = darkDefs.${key};}; mkDarkColorAssignment = key: {${key} = darkDefs.${key};};
in in
mkIf cfg.enable { lib.mkIf color.enable {
# This module sets its own options # This module sets its own options
# to the values specified in a colorscheme file. # to the values specified in a colorscheme file.
modules.color.light = lib.pipe colorKeys [ modules.color.light = lib.pipe colorKeys [

View File

@ -3,6 +3,7 @@
# Obsolete modules are kept in "1_deprecated" for reference. # Obsolete modules are kept in "1_deprecated" for reference.
# My own HM modules # My own HM modules
./ags
./chromium ./chromium
./color ./color
./firefox ./firefox

View File

@ -6,39 +6,37 @@
pkgs, pkgs,
hostname, hostname,
... ...
}: }: let
with lib; inherit (config.modules) firefox;
with mylib.modules; let
cfg = config.modules.firefox;
in { in {
options.modules.firefox = import ./options.nix {inherit lib mylib;}; options.modules.firefox = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf firefox.enable {
home.packages = with pkgs; home.packages = with pkgs;
builtins.concatLists [ builtins.concatLists [
# TODO: I don't think vaapi works yet # TODO: I don't think vaapi works yet
(optionals cfg.vaapi [ (lib.optionals firefox.vaapi [
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there... # NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libva # libva
# libvdpau # libvdpau
]) ])
# TODO: Derivation borked on standalone HM # TODO: Derivation borked on standalone HM
# (optionals cfg.gnomeTheme [firefox-gnome-theme]) # (lib.optionals firefox.gnomeTheme [firefox-gnome-theme])
]; ];
home.sessionVariables = mkMerge [ home.sessionVariables = lib.mkMerge [
{ {
MOZ_USE_XINPUT2 = 1; MOZ_USE_XINPUT2 = 1;
} }
(optionalAttrs cfg.wayland { (lib.optionalAttrs firefox.wayland {
MOZ_ENABLE_WAYLAND = 1; MOZ_ENABLE_WAYLAND = 1;
EGL_PLATFORM = "wayland"; EGL_PLATFORM = "wayland";
# XDG_CURRENT_DESKTOP = "Hyprland"; # TODO: Or "sway"? # Already set by hyprland # XDG_CURRENT_DESKTOP = "Hyprland"; # TODO: Or "sway"? # Already set by hyprland
}) })
(optionalAttrs cfg.vaapi { (lib.optionalAttrs firefox.vaapi {
# LIBVA_DRIVER_NAME = "radeonsi"; # "nvidia" for Nvidia card # LIBVA_DRIVER_NAME = "radeonsi"; # "nvidia" for Nvidia card
# LIBVA_DRIVER_NAME = "nvidia"; # Specified in hardware-configuration # LIBVA_DRIVER_NAME = "nvidia"; # Specified in hardware-configuration
MOZ_DISABLE_RDD_SANDBOX = 1; MOZ_DISABLE_RDD_SANDBOX = 1;
@ -72,7 +70,7 @@ in {
# not strictly necessary # not strictly necessary
extraPolicies = { extraPolicies = {
# TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders # TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders
Bookmarks = optionalAttrs cfg.defaultBookmarks {}; Bookmarks = lib.optionalAttrs firefox.defaultBookmarks {};
CaptivePortal = false; CaptivePortal = false;
DisableFirefoxAccounts = true; DisableFirefoxAccounts = true;
DisableFirefoxStudies = true; DisableFirefoxStudies = true;
@ -98,13 +96,13 @@ in {
default = { default = {
id = 0; # 0 is default profile id = 0; # 0 is default profile
userChrome = concatStringsSep "\n" [ userChrome = lib.concatStringsSep "\n" [
# TODO: Borked after standalone HM # TODO: Borked after standalone HM
# (optionalString cfg.gnomeTheme '' # (optionalString cfg.gnomeTheme ''
# @import "${pkgs.firefox-gnome-theme}/share/firefox-gnome-theme/gnome-theme.css"; # @import "${pkgs.firefox-gnome-theme}/share/firefox-gnome-theme/gnome-theme.css";
# '') # '')
(optionalString cfg.disableTabBar '' (lib.optionalString firefox.disableTabBar ''
#TabsToolbar { display: none; } #TabsToolbar { display: none; }
'') '')
]; ];
@ -153,8 +151,8 @@ in {
youtube-shorts-block youtube-shorts-block
]; ];
settings = mkMerge [ settings = lib.mkMerge [
(optionalAttrs cfg.vaapi { (lib.optionalAttrs firefox.vaapi {
# Firefox wayland hardware video acceleration # Firefox wayland hardware video acceleration
# https://github.com/elFarto/nvidia-vaapi-driver/#firefox= # https://github.com/elFarto/nvidia-vaapi-driver/#firefox=
# TODO: Disable and check if it works by default # TODO: Disable and check if it works by default
@ -255,7 +253,6 @@ in {
"identity.fxaccounts.account.device.name" = hostname; "identity.fxaccounts.account.device.name" = hostname;
"media.hardwaremediakeys.enabled" = false; # Do not interfere with spotify "media.hardwaremediakeys.enabled" = false; # Do not interfere with spotify
"media.videocontrols.picture-in-picture.video-toggle.enabled" = true; "media.videocontrols.picture-in-picture.video-toggle.enabled" = true;
@ -278,7 +275,7 @@ in {
"toolkit.coverage.opt-out" = true; "toolkit.coverage.opt-out" = true;
"toolkit.coverage.endpoint.base" = ""; "toolkit.coverage.endpoint.base" = "";
"toolkit.legacyUserProfileCustomizations.stylesheets" = cfg.gnomeTheme || cfg.disableTabBar; "toolkit.legacyUserProfileCustomizations.stylesheets" = firefox.gnomeTheme || firefox.disableTabBar;
"toolkit.telemetry.unified" = false; "toolkit.telemetry.unified" = false;
"toolkit.telemetry.enabled" = false; "toolkit.telemetry.enabled" = false;
"toolkit.telemetry.server" = "data:,"; "toolkit.telemetry.server" = "data:,";

View File

@ -4,14 +4,12 @@
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) fish;
with mylib.modules; let
cfg = config.modules.fish;
in { in {
options.modules.fish = import ./options.nix {inherit lib mylib;}; options.modules.fish = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf fish.enable {
home.file.".config/fish/themes/catppuccin-latte.theme".text = '' home.file.".config/fish/themes/catppuccin-latte.theme".text = ''
# name: 'Catppuccin Latte' # name: 'Catppuccin Latte'
# url: 'https://github.com/catppuccin/fish' # url: 'https://github.com/catppuccin/fish'
@ -109,19 +107,19 @@ in {
shellAbbrs = let shellAbbrs = let
# Only add " | bat" if bat is installed # Only add " | bat" if bat is installed
batify = command: command + (optionalString config.programs.bat.enable " | bat"); batify = command: command + (lib.optionalString config.programs.bat.enable " | bat");
# Same as above but with args for bat # Same as above but with args for bat
batifyWithArgs = command: args: command + (optionalString config.programs.bat.enable (" | bat " + args)); batifyWithArgs = command: args: command + (lib.optionalString config.programs.bat.enable (" | bat " + args));
# These can be used for my config.modules and for HM config.programs, # These can be used for my config.modules and for HM config.programs,
# as both of these add the package to home.packages # as both of these add the package to home.packages
hasHomePackage = package: (contains config.home.packages package); hasHomePackage = package: (mylib.modules.contains config.home.packages package);
# Only add fish abbr if package is installed # Only add fish abbr if package is installed
abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr); abbrify = package: abbr: (lib.optionalAttrs (hasHomePackage package) abbr);
in in
mkMerge [ lib.mkMerge [
# Abbrs that are always available are defined here. # Abbrs that are always available are defined here.
{ {
# Shell basics # Shell basics

View File

@ -10,8 +10,7 @@
nixosConfig, nixosConfig,
... ...
}: let }: let
cfg = config.modules.hyprland; inherit (config.modules) hyprland color;
color = config.modules.color;
# This function is mapped to the "cfg.monitors" attrSet. # This function is mapped to the "cfg.monitors" attrSet.
# For each key-value entry in "cfg.monitors", # For each key-value entry in "cfg.monitors",
@ -29,22 +28,22 @@
+ (lib.optionalString (builtins.hasAttr "class" attrs) ", class:^(${attrs.class})$") + (lib.optionalString (builtins.hasAttr "class" attrs) ", class:^(${attrs.class})$")
+ (lib.optionalString (builtins.hasAttr "title" attrs) ", title:^(${attrs.title})$"); + (lib.optionalString (builtins.hasAttr "title" attrs) ", title:^(${attrs.title})$");
mkTranslucentRule = class: "opacity ${cfg.transparent-opacity} ${cfg.transparent-opacity}, class:^(${class})$"; mkTranslucentRule = class: "opacity ${hyprland.transparent-opacity} ${hyprland.transparent-opacity}, class:^(${class})$";
mkBind = key: action: "${key}, ${action}"; mkBind = key: action: "${key}, ${action}";
mkBinds = key: actions: builtins.map (mkBind key) actions; mkBinds = key: actions: builtins.map (mkBind key) actions;
# These functions are used to generate the keybindings.info file for Rofi # These functions are used to generate the keybindings.info file for Rofi
fixupNoMod = key: ''${builtins.replaceStrings ["<-"] ["<"] key}''; fixupNoMod = key: ''${builtins.replaceStrings ["<-"] ["<"] key}'';
mkBindHelpKey = key: ''${builtins.replaceStrings ["$mainMod" " " ","] ["${cfg.keybindings.main-mod}" "-" ""] key}''; mkBindHelpKey = key: ''${builtins.replaceStrings ["$mainMod" " " ","] ["${hyprland.keybindings.main-mod}" "-" ""] key}'';
mkBindHelpAction = action: ''${builtins.replaceStrings [","] [""] action}''; mkBindHelpAction = action: ''${builtins.replaceStrings [","] [""] action}'';
mkBindHelp = key: action: "<${mkBindHelpKey key}>: ${mkBindHelpAction action}"; mkBindHelp = key: action: "<${mkBindHelpKey key}>: ${mkBindHelpAction action}";
mkBindsHelp = key: actions: builtins.map fixupNoMod (builtins.map (mkBindHelp key) actions); mkBindsHelp = key: actions: builtins.map fixupNoMod (builtins.map (mkBindHelp key) actions);
mkWallpaper = monitor: "${monitor}, ${config.home.homeDirectory}/NixFlake/wallpapers/${cfg.theme}.png"; mkWallpaper = monitor: "${monitor}, ${config.home.homeDirectory}/NixFlake/wallpapers/${hyprland.theme}.png";
mkDelayedStart = str: "hyprctl dispatch exec \"sleep 5s && ${str}\""; mkDelayedStart = str: "hyprctl dispatch exec \"sleep 5s && ${str}\"";
delayed-exec = builtins.map mkDelayedStart cfg.autostart.delayed; delayed-exec = builtins.map mkDelayedStart hyprland.autostart.delayed;
mkExec = prog: "${prog}"; mkExec = prog: "${prog}";
always-bind = { always-bind = {
@ -55,6 +54,7 @@
"$mainMod, F" = ["fullscreen"]; "$mainMod, F" = ["fullscreen"];
"$mainMod, C" = ["exec, clipman pick --tool=rofi"]; "$mainMod, C" = ["exec, clipman pick --tool=rofi"];
"$mainMod, G" = ["togglegroup"]; "$mainMod, G" = ["togglegroup"];
"$mainMod, L" = ["exec, loginctl lock-session"];
"ALT, tab" = ["changegroupactive"]; "ALT, tab" = ["changegroupactive"];
"$mainMod, tab" = ["workspace, previous"]; "$mainMod, tab" = ["workspace, previous"];
@ -70,13 +70,7 @@
"$mainMod CTRL, k" = ["movewindow, u"]; "$mainMod CTRL, k" = ["movewindow, u"];
"$mainMod CTRL, d" = ["movewindow, d"]; "$mainMod CTRL, d" = ["movewindow, d"];
# Rofi # TODO: Somehow write this more compact? Try to use workspace 0 instead of 10...
"$mainMod, D" = ["exec, ~/NixFlake/config/rofi/menus/systemd-podman.fish"];
"$mainMod, O" = ["exec, ~/NixFlake/config/rofi/menus/lectures.fish"];
"$mainMod, M" = ["exec, ~/NixFlake/config/rofi/menus/keybinds.fish"];
"$mainMod, U" = ["exec, ~/NixFlake/config/rofi/menus/vpn.fish"];
# TODO: Somehow write this more compact?
"$mainMod, 1" = ["workspace, 1"]; "$mainMod, 1" = ["workspace, 1"];
"$mainMod, 2" = ["workspace, 2"]; "$mainMod, 2" = ["workspace, 2"];
"$mainMod, 3" = ["workspace, 3"]; "$mainMod, 3" = ["workspace, 3"];
@ -131,7 +125,7 @@
in { in {
options.modules.hyprland = import ./options.nix {inherit lib mylib;}; options.modules.hyprland = import ./options.nix {inherit lib mylib;};
config = lib.mkIf cfg.enable { config = lib.mkIf hyprland.enable {
# Some assertion is not possible if HM is used standalone, # Some assertion is not possible if HM is used standalone,
# because nixosConfig won't be available. # because nixosConfig won't be available.
assertions = [ assertions = [
@ -179,7 +173,7 @@ in {
]; ];
file = { file = {
".config/hypr/keybindings.info".text = lib.pipe (cfg.keybindings.bindings ".config/hypr/keybindings.info".text = lib.pipe (hyprland.keybindings.bindings
// always-bind) [ // always-bind) [
(builtins.mapAttrs mkBindsHelp) (builtins.mapAttrs mkBindsHelp)
builtins.attrValues builtins.attrValues
@ -218,7 +212,7 @@ in {
background = [ background = [
{ {
path = "~/NixFlake/wallpapers/${cfg.theme}.png"; path = "~/NixFlake/wallpapers/${hyprland.theme}.png";
blur_passes = 3; blur_passes = 3;
blur_size = 10; blur_size = 10;
monitor = ""; monitor = "";
@ -284,8 +278,8 @@ in {
splash = false; splash = false;
splash_offset = 2.0; splash_offset = 2.0;
preload = "~/NixFlake/wallpapers/${cfg.theme}.png"; preload = "~/NixFlake/wallpapers/${hyprland.theme}.png";
wallpaper = lib.pipe cfg.monitors [ wallpaper = lib.pipe hyprland.monitors [
builtins.attrNames builtins.attrNames
(builtins.map mkWallpaper) (builtins.map mkWallpaper)
]; ];
@ -318,6 +312,7 @@ in {
}; };
# Notification service # Notification service
# TODO: Allow setting the dunst monitor
dunst = { dunst = {
enable = true; enable = true;
@ -341,7 +336,7 @@ in {
}; };
urgency_normal = { urgency_normal = {
frame_color = "#${color.light.yellow}"; frame_color = "#${color.light.green}";
}; };
urgency_critical = { urgency_critical = {
@ -357,7 +352,7 @@ in {
xwayland.enable = true; xwayland.enable = true;
settings = { settings = {
"$mainMod" = "${cfg.keybindings.main-mod}"; "$mainMod" = "${hyprland.keybindings.main-mod}";
general = { general = {
gaps_in = 5; gaps_in = 5;
@ -370,9 +365,13 @@ in {
group = { group = {
groupbar = { groupbar = {
enabled = true;
render_titles = false; render_titles = false;
font_size = 10; font_size = 10;
gradients = false; gradients = false;
"col.active" = "rgb(${color.dark.lavender})";
"col.inactive" = "rgba(${color.dark.base}AA)";
}; };
"col.border_active" = "rgb(${color.dark.lavender})"; "col.border_active" = "rgb(${color.dark.lavender})";
@ -380,8 +379,8 @@ in {
}; };
input = { input = {
kb_layout = "${cfg.kb-layout}"; kb_layout = "${hyprland.kb-layout}";
kb_variant = "${cfg.kb-variant}"; kb_variant = "${hyprland.kb-variant}";
kb_model = "pc104"; kb_model = "pc104";
kb_options = ""; kb_options = "";
kb_rules = ""; kb_rules = "";
@ -395,18 +394,18 @@ in {
sensitivity = 0; # -1.0 - 1.0, 0 means no modification. sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
}; };
monitor = lib.pipe cfg.monitors [ monitor = lib.pipe hyprland.monitors [
(builtins.mapAttrs mkMonitor) (builtins.mapAttrs mkMonitor)
builtins.attrValues builtins.attrValues
]; ];
workspace = lib.pipe cfg.workspaces [ workspace = lib.pipe hyprland.workspaces [
(builtins.mapAttrs mkWorkspaces) (builtins.mapAttrs mkWorkspaces)
builtins.attrValues builtins.attrValues
builtins.concatLists builtins.concatLists
]; ];
bind = lib.pipe (cfg.keybindings.bindings bind = lib.pipe (hyprland.keybindings.bindings
// always-bind) [ // always-bind) [
(builtins.mapAttrs mkBinds) (builtins.mapAttrs mkBinds)
builtins.attrValues builtins.attrValues
@ -419,20 +418,20 @@ in {
builtins.concatLists builtins.concatLists
]; ];
exec-once = lib.pipe (always-exec ++ cfg.autostart.immediate ++ delayed-exec) [ exec-once = lib.pipe (always-exec ++ hyprland.autostart.immediate ++ delayed-exec) [
(builtins.map mkExec) (builtins.map mkExec)
]; ];
windowrulev2 = windowrulev2 =
lib.pipe cfg.workspacerules [ lib.pipe hyprland.workspacerules [
(builtins.mapAttrs mkWorkspaceRules) (builtins.mapAttrs mkWorkspaceRules)
builtins.attrValues builtins.attrValues
builtins.concatLists builtins.concatLists
] ]
++ lib.pipe cfg.floating [ ++ lib.pipe hyprland.floating [
(builtins.map mkFloatingRule) (builtins.map mkFloatingRule)
] ]
++ lib.pipe cfg.transparent [ ++ lib.pipe hyprland.transparent [
(builtins.map mkTranslucentRule) (builtins.map mkTranslucentRule)
]; ];
@ -451,13 +450,20 @@ in {
misc = { misc = {
# Say no to the anime girl # Say no to the anime girl
disable_hyprland_logo = true;
force_default_wallpaper = 0; force_default_wallpaper = 0;
disable_splash_rendering = true;
font_family = "${color.font}";
}; };
# Because those are not windows, but layouts, # Because those are not windows, but layouts,
# we have to blur them explicitly # we have to blur them explicitly
layerrule = [ layerrule = [
"blur,rofi" "blur,rofi"
"ignorealpha 0.001,rofi"
# "dimaround,rofi"
"blur,waybar" "blur,waybar"
]; ];

View File

@ -4,16 +4,12 @@
lib, lib,
mylib, mylib,
... ...
}: }: let
with lib; inherit (config.modules) kitty color;
with mylib.modules; let
cfg = config.modules.kitty;
color = config.modules.color;
# cfgnv = config.modules.neovim;
in { in {
options.modules.kitty = import ./options.nix {inherit lib mylib;}; options.modules.kitty = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf kitty.enable {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
shellIntegration.enableFishIntegration = true; shellIntegration.enableFishIntegration = true;
@ -72,11 +68,11 @@ in {
macos_titlebar_color = "system"; macos_titlebar_color = "system";
# Tab bar colors # Tab bar colors
active_tab_foreground = "#${color.light.base}"; active_tab_foreground = "#${color.dark.base}";
active_tab_background = "#${color.light.mauve}"; active_tab_background = "#${color.dark.lavender}";
inactive_tab_foreground = "#${color.light.text}"; inactive_tab_foreground = "#${color.dark.text}";
inactive_tab_background = "#${color.light.overlay0}"; inactive_tab_background = "#${color.dark.crust}";
tab_bar_background = "#${color.light.surface1}"; tab_bar_background = "#${color.light.base}";
# Color for marks (marked text in the terminal) # Color for marks (marked text in the terminal)
mark1_foreground = "#${color.light.base}"; mark1_foreground = "#${color.light.base}";

View File

@ -4,14 +4,12 @@
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) latex;
with mylib.modules; let
cfg = config.modules.latex;
in { in {
options.modules.latex = import ./options.nix {inherit lib mylib;}; options.modules.latex = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf latex.enable {
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
texliveFull texliveFull

View File

@ -6,14 +6,12 @@
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) neovim color;
with mylib.modules; let
cfg = config.modules.neovim;
in { in {
options.modules.neovim = import ./options.nix {inherit lib mylib;}; options.modules.neovim = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf neovim.enable {
home = { home = {
file.".config/neovide/config.toml".source = ./neovide_config.ini; file.".config/neovide/config.toml".source = ./neovide_config.ini;
file.".config/vale/.vale.ini".source = ./vale_config.ini; file.".config/vale/.vale.ini".source = ./vale_config.ini;
@ -25,7 +23,7 @@ in {
packages = with pkgs; packages = with pkgs;
builtins.concatLists [ builtins.concatLists [
(optionals cfg.neovide [neovide]) (lib.optionals neovim.neovide [neovide])
[ [
(pkgs.ripgrep.override {withPCRE2 = true;}) (pkgs.ripgrep.override {withPCRE2 = true;})
@ -35,19 +33,21 @@ in {
lua51Packages.xml2lua # For rest lua51Packages.xml2lua # For rest
lua51Packages.mimetypes # For rest lua51Packages.mimetypes # For rest
lua51Packages.jsregexp # For tree-sitter lua51Packages.jsregexp # For tree-sitter
nodejs
# Language servers # Language servers
clang-tools_18 clang-tools_18
clojure-lsp clojure-lsp
cmake-language-server cmake-language-server
haskell-language-server haskell-language-server
ltex-ls
lua-language-server lua-language-server
nil nil
nixd nixd
pyright pyright
rust-analyzer rust-analyzer
texlab texlab
ltex-ls typescript
# Linters # Linters
checkstyle # java checkstyle # java
@ -77,24 +77,25 @@ in {
defaultEditor = true; defaultEditor = true;
enableMan = false; # Nixvim man pages enableMan = false; # Nixvim man pages
luaLoader.enable = true; # NOTE: Experimental luaLoader.enable = true; # NOTE: Experimental
viAlias = cfg.alias; viAlias = neovim.alias;
vimAlias = cfg.alias; vimAlias = neovim.alias;
colorschemes.catppuccin = { # Configured using plugin
enable = true; # colorschemes.catppuccin = {
settings = { # enable = true;
flavour = "mocha"; # latte, frappe, macchiato, mocha # settings = {
background = { # flavour = "mocha"; # latte, frappe, macchiato, mocha
light = "latte"; # background = {
dark = "mocha"; # light = "latte";
}; # dark = "mocha";
}; # };
}; # };
# };
performance.byteCompileLua = { performance.byteCompileLua = {
enable = true; enable = true;
configs = true; configs = true;
initLua = false; # When debugging init.lua turn this off initLua = true; # When debugging init.lua turn this off
nvimRuntime = true; nvimRuntime = true;
plugins = true; plugins = true;
}; };
@ -263,6 +264,52 @@ in {
light = "latte"; light = "latte";
dark = "mocha"; dark = "mocha";
}; };
default_integrations = false;
integrations = {
cmp = true;
dashboard = true;
diffview = true;
flash = true;
gitsigns = true;
mini.enabled = true;
neotree = true;
noice = true;
native_lsp = {
enabled = true;
virtual_text = {
errors = ["italic"];
hints = ["italic"];
warnings = ["italic"];
information = ["italic"];
ok = ["italic"];
};
underlines = {
errors = ["underline"];
hints = ["underline"];
warnings = ["underline"];
information = ["underline"];
ok = ["underline"];
};
inlay_hints = {
background = true;
};
};
navic = {
enabled = true;
# custom_bg = "crust";
};
notify = true;
treesitter = true;
ufo = true;
rainbow_delimiters = true;
telescope.enabled = true;
lsp_trouble = true;
illuminate = {
enabled = true;
lsp = true;
};
which_key = true;
};
}; };
}; };
@ -1051,37 +1098,50 @@ in {
''; '';
opts = let opts = let
bubbles = '' bubbles = ''
(function() {
-- Wrap this in an immediately invoked function and require catppuccin
-- because we need "colors" in the scope.
-- For this, the catppuccin plugin must be installed,
-- just setting the neovim colorscheme isn't enough.
local colors = require("catppuccin.palettes").get_palette("mocha")
-- Use :lua print(vim.inspect(require("catppuccin.palettes").get_palette("mocha"))) to list colors
return {
normal = { normal = {
a = { fg = colors.base, bg = colors.lavender }, a = { fg = "#${color.dark.base}", bg = "#${color.dark.lavender}", gui = "bold" },
b = { fg = colors.text, bg = colors.crust }, b = { fg = "#${color.dark.text}", bg = "#${color.dark.crust}" },
c = { fg = colors.text }, c = { fg = "#${color.dark.text}", bg = "NONE" },
}, },
insert = { a = { fg = colors.base, bg = colors.blue } }, insert = {
visual = { a = { fg = colors.base, bg = colors.teal } }, a = { fg = "#${color.dark.base}", bg = "#${color.dark.green}", gui = "bold" },
replace = { a = { fg = colors.base, bg = colors.red } }, b = { fg = "#${color.dark.green}", bg = "#${color.dark.crust}" },
},
visual = {
a = { fg = "#${color.dark.base}", bg = "#${color.dark.mauve}", gui = "bold" },
b = { fg = "#${color.dark.mauve}", bg = "#${color.dark.crust}" },
},
replace = {
a = { fg = "#${color.dark.base}", bg = "#${color.dark.red}", gui = "bold" },
b = { fg = "#${color.dark.red}", bg = "#${color.dark.crust}" },
},
-- terminal = {
-- a = { fg = "#${color.dark.base}", bg = "#${color.dark.green}", gui = "bold" },
-- b = { fg = "#${color.dark.green}", bg = "#${color.dark.crust}" },
-- },
command = {
a = { fg = "#${color.dark.base}", bg = "#${color.dark.peach}", gui = "bold" },
b = { fg = "#${color.dark.peach}", bg = "#${color.dark.crust}" },
},
inactive = { inactive = {
a = { fg = colors.text, bg = colors.base }, a = { fg = "#${color.dark.text}", bg = "#${color.dark.base}" },
b = { fg = colors.text, bg = colors.base }, b = { fg = "#${color.dark.text}", bg = "#${color.dark.base}" },
c = { fg = colors.text }, c = { fg = "#${color.dark.text}", bg = "NONE" },
}, },
} }
end)()
''; '';
in { in {
extensions = ["fzf" "lazy" "neo-tree" "oil" "quickfix" "toggleterm" "trouble"]; extensions = ["fzf" "lazy" "neo-tree" "oil" "quickfix" "toggleterm" "trouble"];
options = { options = {
# theme = "catppuccin";
theme.__raw = bubbles; theme.__raw = bubbles;
always_divide_middle = true; always_divide_middle = true;
globalstatus = true; globalstatus = true;
@ -1505,19 +1565,17 @@ in {
opts = { opts = {
line.__raw = '' line.__raw = ''
function(line) function(line)
local colors = require("catppuccin.palettes").get_palette("mocha") local base = { fg = "#${color.dark.base}", bg = "#${color.dark.base}" }
local crust = { fg = "#${color.dark.crust}", bg = "#${color.dark.crust}" }
local base = { fg = colors.base, bg = colors.base } local text = { fg = "#${color.dark.text}", bg = "#${color.dark.crust}" }
local crust = { fg = colors.crust, bg = colors.crust } local lavender = { fg = "#${color.dark.lavender}", bg = "#${color.dark.lavender}" }
local text = { fg = colors.text, bg = colors.crust }
local lavender = { fg = colors.lavender, bg = colors.lavender }
local numtabs = vim.call("tabpagenr", "$") local numtabs = vim.call("tabpagenr", "$")
return { return {
-- Head -- Head
{ {
{ " NEOVIM ", hl = { fg = colors.base, bg = colors.lavender } }, { " NEOVIM ", hl = { fg = "#${color.dark.base}", bg = "#${color.dark.lavender}", style = "bold" } },
-- The separator gets a foreground and background fill (each have fg + bg). -- The separator gets a foreground and background fill (each have fg + bg).
-- line.sep("", lavender, lavender), -- line.sep("", lavender, lavender),
@ -1526,7 +1584,7 @@ in {
-- Tabs -- Tabs
line.tabs().foreach(function(tab) line.tabs().foreach(function(tab)
-- Switch out the start separator instead of the ending one because the last separator is different -- Switch out the start separator instead of the ending one because the last separator is different
local hl = tab.is_current() and { fg = colors.lavender, bg = colors.crust, style = "bold" } or text local hl = tab.is_current() and { fg = "#${color.dark.lavender}", bg = "#${color.dark.crust}", style = "bold" } or text
local sep_start = tab.number() == 1 and "" or "" local sep_start = tab.number() == 1 and "" or ""
local sep_end = tab.number() == numtabs and "" or "" local sep_end = tab.number() == numtabs and "" or ""
@ -1858,6 +1916,15 @@ in {
config = mkDefaultConfig name; config = mkDefaultConfig name;
}; };
typescript-tools = rec {
name = "typescript-tools";
pkg = pkgs.vimPlugins.typescript-tools-nvim;
lazy = true;
ft = ["javascript" "typescript"];
dependencies = [_plenary lspconfig];
config = mkDefaultConfig name;
};
_promise = { _promise = {
name = "promise"; name = "promise";
pkg = pkgs.vimPlugins.promise-async; pkg = pkgs.vimPlugins.promise-async;
@ -2020,6 +2087,7 @@ in {
treesitter # AST based syntax highlighting + indentation treesitter # AST based syntax highlighting + indentation
trim # Trim whitespace trim # Trim whitespace
trouble # Diagnostics window trouble # Diagnostics window
typescript-tools # Typescript tsserver LSP
ufo # Code folding ufo # Code folding
vimtex # LaTeX support vimtex # LaTeX support
wakatime # Time tracking wakatime # Time tracking

View File

@ -1,19 +1,16 @@
# TODO: Expose some settings # TODO: Expose some settings
{ {
config, config,
nixosConfig,
lib, lib,
mylib, mylib,
pkgs, pkgs,
... ...
}: }: let
with lib; inherit (config.modules) nnn;
with mylib.modules; let
cfg = config.modules.nnn;
in { in {
options.modules.nnn = import ./options.nix {inherit lib mylib;}; options.modules.nnn = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf nnn.enable {
home.sessionVariables = { home.sessionVariables = {
# NNN_TERMINAL = "alacritty"; # NNN_TERMINAL = "alacritty";
# NNN_FIFO = "/tmp/nnn.fifo"; # For nnn preview # NNN_FIFO = "/tmp/nnn.fifo"; # For nnn preview

View File

@ -7,14 +7,133 @@
pkgs, pkgs,
... ...
}: let }: let
cfg = config.modules.rofi; inherit (config.modules) rofi color;
in { in {
options.modules.rofi = import ./options.nix {inherit lib mylib;}; options.modules.rofi = import ./options.nix {inherit lib mylib;};
config = lib.mkIf cfg.enable { config = lib.mkIf rofi.enable {
home.packages = with pkgs; [ programs.rofi = {
rofi-wayland enable = true;
]; package = pkgs.rofi-wayland;
terminal = "kitty";
font = "${color.font} 14";
location = "center";
cycle = true;
extraConfig = {
modi = "run,drun,ssh,filebrowser";
show-icons = true;
icon-theme = "Papirus";
drun-display-format = "{icon} {name}";
disable-history = false;
hide-scrollbar = true;
display-drun = " apps ";
display-run = " run ";
display-filebrowser = " file ";
display-ssh = " ssh ";
sidebar-mode = false;
};
# bg-col: rgba(239, 241, 245, 60%);
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
mkColor = color: mkLiteral "#{color}";
in {
"*" = {
bg = mkLiteral "rgba(239, 241, 245, 0.3)";
hl = mkLiteral "#${color.dark.lavender}";
text = mkLiteral "#${color.dark.base}";
trans = mkLiteral "rgba(255, 255, 255, 0)";
};
"element-text,element-icon,mode-switcher" = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
"window" = {
height = 480;
width = 700;
# border-style = mkLiteral "solid";
border = mkLiteral "2 solid 2 solid 2 solid 2 solid";
border-radius = 6;
border-color = mkLiteral "@hl";
background-color = mkLiteral "@bg";
};
"mainbox" = {
background-color = mkLiteral "@trans";
};
"message" = {
background-color = mkLiteral "@trans";
};
"error-message" = {
background-color = mkLiteral "@trans";
margin = mkLiteral "0px 0px 20px 0px";
};
"textbox" = {
background-color = mkLiteral "@trans";
padding = 6;
margin = mkLiteral "20px 20px 0px 20px";
border-radius = 3;
};
"inputbar" = {
children = builtins.map mkLiteral ["prompt" "entry"];
background-color = mkLiteral "@trans";
};
"prompt" = {
background-color = mkLiteral "@hl";
padding = 6;
text-color = mkLiteral "@text";
border-radius = 3;
margin = mkLiteral "20px 0px 0px 20px";
};
"entry" = {
padding = 6;
margin = mkLiteral "20px 20px 0px 10px";
text-color = mkLiteral "@text";
background-color = mkLiteral "@trans";
border = mkLiteral "2 solid 2 solid 2 solid 2 solid";
border-radius = 3;
border-color = mkLiteral "@hl";
};
"listview" = {
# border = mkLiteral "0px 0px 0px";
padding = 0;
margin = mkLiteral "10px 20px 20px 20px";
columns = 1;
background-color = mkLiteral "@trans";
border = mkLiteral "2 solid 2 solid 2 solid 2 solid";
border-radius = 3;
border-color = mkLiteral "@hl";
};
"element" = {
padding = 5;
margin = 0;
background-color = mkLiteral "@trans";
text-color = mkLiteral "@text";
border-radius = 3;
};
"element-icon" = {
size = 25;
};
"element selected" = {
background-color = mkLiteral "@hl";
text-color = mkLiteral "@text";
};
};
};
modules.hyprland.keybindings = let modules.hyprland.keybindings = let
power-menu = power-menu =
@ -23,18 +142,23 @@ in {
{ {
"Poweroff" = "poweroff"; "Poweroff" = "poweroff";
"Reboot" = "reboot"; "Reboot" = "reboot";
"Lock" = "loginctl lock-session";
"Reload Hyprland" = "hyprctl reload"; "Reload Hyprland" = "hyprctl reload";
"Exit Hyprland" = "hyprctl dispatch exit"; "Exit Hyprland" = "hyprctl dispatch exit";
}; };
vpn-menu = pkgs.writeScript "rofi-menu-vpn" (builtins.readFile ./menus/vpn.fish);
keybinds-menu = pkgs.writeScript "rofi-menu-keybinds" (builtins.readFile ./menus/keybinds.fish);
# TODO: Expand on that
lectures-menu = pkgs.writeScript "rofi-menu-lectures" (builtins.readFile ./menus/lectures.fish);
in { in {
bindings = { bindings = {
"$mainMod, escape" = ["exec, \"${power-menu}\""]; "$mainMod, escape" = ["exec, \"${power-menu}\""];
"$mainMod, O" = ["exec, \"${lectures-menu}\""];
"$mainMod, M" = ["exec, \"${keybinds-menu}\""];
"$mainMod, U" = ["exec, \"${vpn-menu}\""];
}; };
}; };
home.file = {
".config/rofi/config.rasi".source = ../../../config/rofi/rofi.rasi;
".config/rofi/colors.rasi".source = ../../../config/rofi/colors/${cfg.theme}.rasi;
};
}; };
} }

View File

@ -12,4 +12,6 @@ if test -z $DECK
exit exit
end end
# TODO: $LECTURE and $DECK seem fine, but nothing opens:
# error: Could not determine file type.
xdg-open ~/Notes/TU/$LECTURE/Lecture/$DECK xdg-open ~/Notes/TU/$LECTURE/Lecture/$DECK

View File

@ -2,18 +2,13 @@
config, config,
lib, lib,
mylib, mylib,
pkgs,
... ...
}: }: let
with lib; inherit (config.modules) color waybar;
with mylib.modules; let
cfg = config.modules.waybar;
color = config.modules.color;
hyprcfg = config.modules.hyprland;
in { in {
options.modules.waybar = import ./options.nix {inherit lib mylib;}; options.modules.waybar = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf waybar.enable {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
@ -22,16 +17,18 @@ in {
mainBar = { mainBar = {
layer = "top"; layer = "top";
position = "top"; position = "top";
height = 40; height = 36;
spacing = 4; spacing = 0;
output = ["${cfg.monitor}"]; margin = "10px 10px 0px 10px";
fixed-center = true;
output = ["${waybar.monitor}"];
modules-left = ["custom/launcher" "user" "hyprland/window"]; modules-left = ["custom/launcher" "user" "hyprland/window"];
modules-center = ["hyprland/workspaces"]; modules-center = ["hyprland/workspaces"];
modules-right = ["pulseaudio" "network" "cpu" "memory" "temperature" "clock" "tray"]; modules-right = ["pulseaudio" "network" "cpu" "memory" "temperature" "clock" "tray"];
"custom/launcher" = { "custom/launcher" = {
format = "<span font='${color.font}'></span> "; format = "<span></span>";
interval = "once"; interval = "once";
on-click = "rofi -drun-show-actions -show drun"; on-click = "rofi -drun-show-actions -show drun";
}; };
@ -46,33 +43,33 @@ in {
}; };
"pulseaudio" = { "pulseaudio" = {
format = "<span font='${color.font}'></span> {volume}%"; format = "<span></span> {volume}%";
format-muted = "<span font='${color.font}'></span> "; format-muted = "<span></span> ";
on-click = "kitty ncpamixer -t o"; on-click = "kitty ncpamixer -t o";
}; };
"network" = { "network" = {
format = "<span font='${color.font}'></span> {ipaddr}"; format = "<span></span> {ipaddr}";
format-disconnected = "<span font='${color.font}'></span> "; format-disconnected = "<span></span> ";
interface = "enp8s0"; interface = "enp8s0";
tooltip-format = "{ifname} via {gwaddr}"; tooltip-format = "{ifname} via {gwaddr}";
}; };
cpu = { cpu = {
format = "<span font='${color.font}'></span> {load}%"; format = "<span></span> {load}%";
}; };
memory = { memory = {
format = "<span font='${color.font}'></span> {percentage}%"; format = "<span></span> {percentage}%";
}; };
temperature = { temperature = {
format = "<span font='${color.font}'></span> {temperatureC}°C"; format = "<span></span> {temperatureC}°C";
thermal-zone = 3; thermal-zone = 3;
}; };
clock = { clock = {
format = "<span font='${color.font}'></span> {:%H:%M}"; format = "<span></span> {:%H:%M}";
timezone = "Europe/Berlin"; timezone = "Europe/Berlin";
tooltip-format = "<tt><small>{calendar}</small></tt>"; tooltip-format = "<tt><small>{calendar}</small></tt>";
}; };
@ -87,33 +84,43 @@ in {
style = '' style = ''
/*Order is Top-Right-Bottom-Left for combined properties*/ /*Order is Top-Right-Bottom-Left for combined properties*/
window#waybar { * {
color: #${color.dark.base};
font-family: ${color.font}; font-family: ${color.font};
font-weight: bold; font-weight: bold;
color: #${color.light.base};
/*Can't use color.light.base here because waybar doesn't support rrggbbaa*/
background-color: rgba(239, 241, 245, 0.5);
} }
window#waybar {
border-style: solid;
border-width: 2px;
border-radius: 6px;
border-color: #${color.dark.lavender};
/*Can't use color.light.base here because waybar doesn't support rrggbbaa :(*/
background-color: rgba(239, 241, 245, 0.3);
}
/*Colors*/
#custom-launcher {background-color: #${color.dark.lavender};}
#user {background-color: #${color.dark.pink};}
#window {background-color: #${color.dark.mauve};}
#workspaces button {background-color: #${color.dark.lavender};}
#workspaces button.active {background-color: #${color.dark.sapphire};}
#pulseaudio {background-color: #${color.dark.maroon};}
#network {background-color: #${color.dark.peach};}
#cpu {background-color: #${color.dark.yellow};}
#memory {background-color: #${color.dark.green};}
#temperature {background-color: #${color.dark.teal};}
#clock {background-color: #${color.dark.sky};}
#tray {background-color: #${color.dark.lavender};}
/*Square Widgets*/ /*Square Widgets*/
#custom-launcher, #custom-launcher,
#workspaces button, #workspaces button,
#tray { #tray {
padding: 0px 10px 0px 10px; padding: 0px 10px 0px 10px;
margin: 5px 5px 5px 5px;
border-radius: 6px; border-radius: 6px;
color: #${color.light.base};
}
#workspaces button:hover {
color: #${color.light.pink};
}
/*Tux Icon*/
#custom-launcher {
font-size: 18px;
padding-right: 0px;
} }
/*Rectangle Widgets*/ /*Rectangle Widgets*/
@ -130,39 +137,24 @@ in {
border-radius: 6px; border-radius: 6px;
} }
/*Colors*/ /*make window module transparent when no windows present*/
window#waybar.empty #window {
background-color: transparent;
}
/*Tux Icon*/
#custom-launcher { #custom-launcher {
background-color: #${color.light.flamingo}; font-size: 26px;
} padding-right: 10px;
#user { margin: 0px 5px 0px 0px;
background-color: #${color.light.pink};
}
#window {
background-color: #${color.light.mauve};
} }
#workspaces button { #workspaces button {
background-color: #${color.light.red}; margin: 0px 5px 0px 5px;
}
#pulseaudio {
background-color: #${color.light.maroon};
}
#network {
background-color: #${color.light.peach};
}
#cpu {
background-color: #${color.light.yellow};
}
#memory {
background-color: #${color.light.green};
}
#temperature {
background-color: #${color.light.teal};
}
#clock {
background-color: #${color.light.sky};
} }
#tray { #tray {
background-color: #${color.light.sapphire}; margin: 0px 0px 0px 5px;
} }
''; '';
}; };

View File

@ -3,17 +3,17 @@
lib, lib,
mylib, mylib,
... ...
}: }: let
with lib; inherit (config.modules) zathura;
with mylib.modules; let
cfg = config.modules.zathura;
in { in {
options.modules.zathura = import ./options.nix {inherit lib mylib;}; options.modules.zathura = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = lib.mkIf zathura.enable {
programs.zathura = { programs.zathura = {
enable = true; enable = true;
# TODO: Set database backend
# TODO: Use color module
options = { options = {
# Catppuccin Latte # Catppuccin Latte
default-fg = "#4C4F69"; default-fg = "#4C4F69";

View File

@ -0,0 +1,8 @@
{
inputs,
pkgs,
lib,
...
}: rec {
templateLibFunction = args: "${args}";
}

133
lib/color.nix Normal file
View File

@ -0,0 +1,133 @@
{
inputs,
pkgs,
lib,
...
}: let
# This code was blatantly stolen from here:
# https://github.com/Misterio77/nix-colors/blob/b92df8f5eb1fa20d8e09810c03c9dc0d94ef2820/lib/core/conversions.nix#L87
hexToDecMap = {
"0" = 0;
"1" = 1;
"2" = 2;
"3" = 3;
"4" = 4;
"5" = 5;
"6" = 6;
"7" = 7;
"8" = 8;
"9" = 9;
"a" = 10;
"b" = 11;
"c" = 12;
"d" = 13;
"e" = 14;
"f" = 15;
};
pow = base: exponent: let
inherit (nixpkgs-lib) mod;
in
if exponent > 1
then let
x = pow base (exponent / 2);
odd_exp = mod exponent 2 == 1;
in
x
* x
* (
if odd_exp
then base
else 1
)
else if exponent == 1
then base
else if exponent == 0 && base == 0
then throw "undefined"
else if exponent == 0
then 1
else throw "undefined";
base16To10 = exponent: scalar: scalar * (pow 16 exponent);
hexCharToDec = hex: let
inherit (nixpkgs-lib) toLower;
lowerHex = toLower hex;
in
if builtins.stringLength hex != 1
then throw "Function only accepts a single character."
else if hexToDecMap ? ${lowerHex}
then hexToDecMap."${lowerHex}"
else throw "Character ${hex} is not a hexadecimal value.";
in rec {
/*
Converts from hexadecimal to decimal.
Type: hexToDec :: string -> int
Args:
hex: A hexadecimal string.
Example:
hexadecimal "12"
=> 18
hexadecimal "FF"
=> 255
hexadecimal "abcdef"
=> 11259375
*/
hexToDec = hex: let
inherit (lib) stringToCharacters reverseList imap0 foldl;
decimals = builtins.map hexCharToDec (stringToCharacters hex);
decimalsAscending = reverseList decimals;
decimalsPowered = imap0 base16To10 decimalsAscending;
in
foldl builtins.add 0 decimalsPowered;
/*
Converts a 6 character hexadecimal string to RGB values.
Type: hexToRGB :: string => [int]
Args:
hex: A hexadecimal string of length 6.
Example:
hexToRGB "012345"
=> [ 1 35 69 ]
hexToRGB "abcdef"
=> [171 205 239 ]
hexToRGB "000FFF"
=> [ 0 15 255 ]
*/
hexToRGB = hex: let
rgbStartIndex = [0 2 4];
hexList = builtins.map (x: builtins.substring x 2 hex) rgbStartIndex;
hexLength = builtins.stringLength hex;
in
if hexLength != 6
then
throw ''
Unsupported hex string length of ${builtins.toString hexLength}.
Length must be exactly 6.
''
else builtins.map hexToDec hexList;
/*
Converts a 6 character hexadecimal string to an RGB string seperated by a
delimiter.
Type: hexToRGBString :: string -> string
Args:
sep: The delimiter or seperator.
hex: A hexadecimal string of length 6.
*/
hexToRGBString = sep: hex: let
inherit (builtins) map toString;
inherit (nixpkgs-lib) concatStringsSep;
hexInRGB = hexToRGB hex;
hexInRGBString = map toString hexInRGB;
in
concatStringsSep sep hexInRGBString;
}

View File

@ -12,4 +12,5 @@
networking = import ./networking.nix {inherit inputs pkgs lib;}; networking = import ./networking.nix {inherit inputs pkgs lib;};
rofi = import ./rofi.nix {inherit inputs pkgs lib;}; rofi = import ./rofi.nix {inherit inputs pkgs lib;};
generators = import ./generators.nix {inherit inputs pkgs lib;}; generators = import ./generators.nix {inherit inputs pkgs lib;};
color = import ./color.nix {inherit inputs pkgs lib;};
} }

View File

@ -46,15 +46,6 @@ with mylib.networking; {
}; };
}; };
# NOTE: This should be handled by my local DNS
# networking.hosts = {
# "192.168.86.50" = ["nixinator"];
# "192.168.86.4" = ["proxmox"];
# "192.168.86.20" = ["truenas"];
# "192.168.86.5" = ["opnsense"];
# "192.168.86.25" = ["servenix"];
# };
# Enable flakes # Enable flakes
nix = { nix = {
package = pkgs.nixVersions.stable; package = pkgs.nixVersions.stable;
@ -64,18 +55,12 @@ with mylib.networking; {
settings.trusted-users = ["root" "christoph"]; settings.trusted-users = ["root" "christoph"];
# Keep nix-shell from garbage collection for direnv (keep-outputs + keep-derivations)
# NOTE: nix-direnv use nix or use flake should do this automatically
# keep-outputs = true
# keep-derivations = true
# Auto garbage-collect and optimize store # Auto garbage-collect and optimize store
# gc.automatic = true; # NOTE: Disabled for "nh clean" # gc.automatic = true; # NOTE: Disabled for "nh clean"
gc.options = "--delete-older-than 5d"; gc.options = "--delete-older-than 5d";
settings.auto-optimise-store = true; settings.auto-optimise-store = true;
optimise.automatic = true; optimise.automatic = true;
# TODO: I do not understand this
# This will add your inputs as registries, making operations with them (such # This will add your inputs as registries, making operations with them (such
# as nix shell nixpkgs#name) consistent with your flake inputs. # as nix shell nixpkgs#name) consistent with your flake inputs.
# (Registry contains flakes) # (Registry contains flakes)
@ -88,9 +73,7 @@ with mylib.networking; {
# Bootloader/Kernel stuff # Bootloader/Kernel stuff
boot = { boot = {
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
# kernelPackages = pkgs.linuxPackages_zen; # NOTE: Only set for nixinator kernelParams = ["mitigations=off"]; # I don't care
# kernelPackages = pkgs.linuxPackages_latest; # The package set that includes the kernel and modules
kernelParams = ["mitigations=off"]; # I don't care about security regarding spectre/meltdown
# plymouth.enable = true; # plymouth.enable = true;
loader = { loader = {
@ -118,23 +101,13 @@ with mylib.networking; {
hyprlock = {}; hyprlock = {};
}; };
# TODO: Replace with polkit
sudo.enable = true; sudo.enable = true;
sudo.extraRules = [ sudo.extraRules = [
{ {
users = ["christoph"]; users = ["christoph"];
commands = [ commands = [
# Launch gamemode without password because it is annoying # We allow running flatpak without password
# { # so flatpaks can be installed from the hm config
# command = "/etc/profiles/per-user/christoph/bin/gamemoderun";
# options = [ "SETENV" "NOPASSWD" ];
# }
# {
# command = "${pkgs.gamemode}/libexec/cpugovctl";
# options = [ "SETENV" "NOPASSWD" ];
# }
# We allow running flatpak without password so flatpaks can be installed from the hm config (needs sudo)
{ {
command = "/run/current-system/sw/bin/flatpak"; command = "/run/current-system/sw/bin/flatpak";
options = ["SETENV" "NOPASSWD"]; options = ["SETENV" "NOPASSWD"];
@ -198,7 +171,7 @@ with mylib.networking; {
textEditor = "neovide.desktop"; # Helix.desktop textEditor = "neovide.desktop"; # Helix.desktop
videoPlayer = "mpv.desktop"; videoPlayer = "mpv.desktop";
imageViewer = "imv.desktop"; imageViewer = "imv.desktop";
audioPlayer = "vlc.desktop"; # mov.desktop audioPlayer = "mpv.desktop"; # mov.desktop
in { in {
"inode/directory" = "nnn.desktop"; "inode/directory" = "nnn.desktop";
@ -245,8 +218,9 @@ with mylib.networking; {
enableDefaultPackages = true; # Some default fonts for unicode coverage enableDefaultPackages = true; # Some default fonts for unicode coverage
fontDir.enable = true; # Puts fonts to /run/current-system/sw/share/X11/fonts fontDir.enable = true; # Puts fonts to /run/current-system/sw/share/X11/fonts
# Font packages go here # Font packages go here.
# NOTE: Don't do this with HomeManager as I need the fonts in the fontdir for flatpak apps # They are installed system-wide so they land in fontdir,
# this is required for flatpak to find them.
packages = with pkgs; [ packages = with pkgs; [
# Monospace fonts # Monospace fonts
(nerdfonts.override { (nerdfonts.override {
@ -262,8 +236,6 @@ with mylib.networking; {
lxgw-wenkai lxgw-wenkai
]; ];
# TODO: Check if this works
# TODO: Conflicts with kde?
fontconfig = { fontconfig = {
enable = true; enable = true;
antialias = true; antialias = true;
@ -296,7 +268,8 @@ with mylib.networking; {
"lp" "lp"
"libvirtd" "libvirtd"
]; ];
shell = pkgs.fish; # TODO: Is this needed if programs.fish.enable = true? shell = pkgs.fish;
# We do this with HomeManager # We do this with HomeManager
# packages = with pkgs; []; # packages = with pkgs; [];
}; };
@ -335,25 +308,12 @@ with mylib.networking; {
# egl-wayland # egl-wayland
]; ];
# NOTE: Gnome # It is preferred to use the module (if it exists) over environment.systemPackages,
# TODO: Identify all the crap # as some extra configs are applied.
# Remove these packages that come by default with GNOME # I would prefer to use HomeManager for some of these but the modules don't exist (yet).
# environment.gnome.excludePackages = with pkgs.gnome; [
# # epiphany # gnome webbrowser, could be good with new version
# gnome-maps
# gnome-contacts
# ];
# NOTE: Plasma
# TODO: Identify all the crap
# environment.plasma5.excludePackages = with pkgs.libsForQt5; [
# ];
# It is preferred to use the module (if it exists) over environment.systemPackages, as some extra configs are applied.
# I would prefer to use HomeManager for some of these but the modules don't exist (yet)
programs = { programs = {
adb.enable = true; adb.enable = true;
dconf.enable = true; # NOTE: Also needed for Plasma Wayland (GTK theming) dconf.enable = true;
fish.enable = true; fish.enable = true;
firejail.enable = true; # Use to run app in network namespace (e.g. through vpn) firejail.enable = true; # Use to run app in network namespace (e.g. through vpn)
git.enable = true; git.enable = true;
@ -376,7 +336,6 @@ with mylib.networking; {
# ausweisapp.openFirewall = true; # Directly set port in firewall # ausweisapp.openFirewall = true; # Directly set port in firewall
}; };
# sound.enable = false; # Alsa, seems to conflict with PipeWire # NOTE: Deprecated
hardware.pulseaudio.enable = false; # Get off my lawn hardware.pulseaudio.enable = false; # Get off my lawn
# List services that you want to enable: # List services that you want to enable:
@ -388,9 +347,7 @@ with mylib.networking; {
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
jack.enable = false; jack.enable = false;
wireplumber.enable = true;
wireplumber.enable = true; # Probably the default
# media-session.enable = false; # NOTE: Deprecated
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
@ -416,6 +373,7 @@ with mylib.networking; {
dell-b1160w # TODO: Broken dell-b1160w # TODO: Broken
]; ];
}; };
avahi = { avahi = {
enable = false; # Network printers enable = false; # Network printers
nssmdns4 = true; nssmdns4 = true;
@ -441,13 +399,6 @@ with mylib.networking; {
enable = true; enable = true;
package = lib.mkForce pkgs.gnome3.gvfs; package = lib.mkForce pkgs.gnome3.gvfs;
}; };
# packagekit.enable = true; # KDE Discover/Gnome Software
# samba = {
# package = pkgs.samba4Full;
# enable = true;
# openFirewall = true;
# };
udev = { udev = {
packages = with pkgs; [ packages = with pkgs; [
@ -455,10 +406,7 @@ with mylib.networking; {
]; ];
}; };
gnome.gnome-keyring.enable = true; # TODO: Is probably also needed for Plasma (some apps require it) gnome.gnome-keyring.enable = true; # Some apps require this
# gnome.sushi.enable = true;
# gnome.gnome-settings-daemon.enable = true;
# gnome.gnome-online-accounts.enable = true; # Probably Gnome enables this
}; };
virtualisation = { virtualisation = {
@ -484,13 +432,9 @@ with mylib.networking; {
oci-containers.backend = "podman"; # "docker" or "podman" oci-containers.backend = "podman"; # "docker" or "podman"
libvirtd.enable = true; libvirtd.enable = true;
# Follow steps from https://nixos.wiki/wiki/WayDroid
# waydroid.enable = true;
# lxd.enable = true;
}; };
# NOTE: Current system was installed on 22.05, do not change # The current system was installed on 22.05, do not change.
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave