Did A BUNCH of semantic refactoring.

Added i3blocks config; not active.
This commit is contained in:
vorboyvo 2024-12-04 12:53:29 -05:00
parent dd1bd44945
commit a5349ca647
8 changed files with 569 additions and 450 deletions

View file

@ -1,24 +1,35 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:
let
scripts = ../../scripts;
extra = ../../extra;
terminal = pkgs.alacritty;
in {
rec {
imports = [
../../snippets/defaults.nix
../../snippets/gammastep.nix
../../snippets/kdeconnect.nix
../../snippets/ssh.nix
../../snippets/zsh.nix
../../snippets/taskwarrior.nix
../../snippets/kakoune.nix
../../snippets/clifm.nix
../../snippets/git.nix
../../snippets/sway.nix
../../snippets/waybar.nix
# ../../snippets/i3blocks.nix
../../snippets/firefox.nix
../../snippets/thunderbird.nix
];
home.username = "alice";
home.homeDirectory = "/home/alice";
home.stateVersion = "23.11";
# Configure default applications
defaultPrograms = with pkgs; {
terminal = alacritty;
editor = kakoune;
browser = firefox;
mail = thunderbird;
};
# Configure cursor
home.pointerCursor = {
package = pkgs.vanilla-dmz;
@ -78,7 +89,7 @@ in {
] ++ # Basic utilities
[ bitwarden-cli htop snore hledger hledger-ui ]
++ # Personalized selection of command-line (CLI/TUI) apps
[ terminal ] ++ # Terminal emulator
[ defaultPrograms.terminal ] ++ # Terminal emulator
[
evince
imv
@ -139,13 +150,6 @@ in {
# };
# };
wayland.windowManager.sway = import ../../snippets/sway.nix {
inherit scripts extra config lib pkgs terminal;
};
programs.waybar =
import ../../snippets/waybar.nix { inherit scripts config lib pkgs terminal; };
programs.swaylock = {
enable = true;
settings = { font-size = 14; };
@ -167,14 +171,11 @@ in {
# configure fonts correctly
fonts.fontconfig.enable = true;
xdg.configFile."fontconfig/conf.d/20-default.fonts.conf".source =
"${extra}/20-default-fonts.conf";
../../extra/20-default-fonts.conf;
# terminal emulator
programs.alacritty.enable = true;
programs.kakoune = import ../../snippets/kakoune.nix pkgs;
xdg.configFile."kak-lsp/kak-lsp.toml".source =
../../snippets/kakoune/kak-lsp.toml;
xdg.desktopEntries.kakoune = {
name = "Kakoune";
genericName = "Text Editor";
@ -229,8 +230,4 @@ in {
"-d 3"
];
};
programs.firefox = import ../../snippets/firefox.nix { inherit pkgs; };
programs.thunderbird = import ../../snippets/thunderbird.nix;
}

31
snippets/defaults.nix Normal file
View file

@ -0,0 +1,31 @@
{ lib, pkgs, ... } :
with lib;
{
options.defaultPrograms = {
terminal = mkOption {
type = types.nullOr types.package;
default = null;
description = "Terminal emulator";
example = pkgs.alacritty;
};
editor = mkOption {
type = types.nullOr types.package;
default = null;
description = "Text editor";
example = pkgs.kakoune;
};
browser = mkOption {
type = types.nullOr types.package;
default = null;
description = "Web browser";
example = pkgs.firefox;
};
mail = mkOption {
type = types.nullOr types.package;
default = null;
description = "Email client";
example = pkgs.thunderbird;
};
};
}

View file

@ -1,4 +1,6 @@
{ pkgs }: {
{ pkgs, ... }:
{
programs.firefox = {
enable = true;
profiles = {
default = {
@ -94,4 +96,5 @@
};
};
};
};
}

45
snippets/i3blocks.nix Normal file
View file

@ -0,0 +1,45 @@
{ pkgs, lib, config, ... }:
rec {
programs.i3blocks = {
enable = true;
bars = {
top = {
# The title block
title = {
interval = "persist";
command = "ls";
};
};
bottom = {
time = {
command = "date +%r";
interval = 1;
};
# Make sure this block comes after the time block
date = lib.hm.dag.entryAfter [ "time" ] {
command = "date +%d";
interval = 5;
};
# And this block after the example block
example = lib.hm.dag.entryAfter [ "date" ] {
command = "echo hi $(date +%s)";
interval = 3;
};
};
};
};
wayland.windowManager.sway.config.bars = [
{
statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package}"; # -c ${config.xdg.}";
position = "top";
fonts = config.wayland.windowManager.sway.config.fonts;
}
{
statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package} -c bottom";
position = "bottom";
fonts = config.wayland.windowManager.sway.config.fonts;
}
];
}

View file

@ -1,4 +1,6 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs.kakoune = {
enable = true;
defaultEditor = true;
plugins = with pkgs.kakounePlugins;
@ -92,4 +94,36 @@
eval %sh{kak-lsp --kakoune -s $kak_session}
lsp-enable
'';
};
xdg.configFile."kak-lsp/kak-lsp.toml".source =
./kakoune/kak-lsp.toml;
xdg.desktopEntries.kakoune = {
name = "Kakoune";
genericName = "Text Editor";
comment = "Edit text files";
icon = "kak";
exec = "kak %F";
terminal = true;
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
"text/x-devicetree-source"
];
categories = [ "Utility" "TextEditor" ];
};
}

View file

@ -1,20 +1,23 @@
{ scripts, extra, config, lib, pkgs, terminal, ... }@inputs:
{ lib, pkgs, ... }@inputs:
let
extra = ../extra;
scripts = ../scripts;
dynscreenshot = pkgs.writeShellScript "dynscreenshot"
(builtins.readFile "${scripts}/dynscreenshot.sh");
changebrightness = pkgs.writeShellScript "changebrightness"
(builtins.readFile "${scripts}/changebrightness.sh");
mod = config.wayland.windowManager.sway.config.modifier;
mod = "Mod4";
dmenuCommand = builtins.readFile "${scripts}/dmenu.sh";
shutdownMenu = pkgs.writeShellScript "shutdownmenu"
(builtins.readFile "${scripts}/shutdownmenu.sh");
backgroundImage = "${extra}/kuwaitboat.jpg";
in {
wayland.windowManager.sway = {
enable = true;
config = rec {
terminal = "${pkgs.lib.getExe inputs.terminal}";
modifier = "Mod4";
terminal = "${pkgs.lib.getExe inputs.config.defaultPrograms.terminal}";
modifier = mod;
fonts = {
names = [ "Red Hat Display" ];
style = "Regular";
@ -32,12 +35,6 @@ in {
xkb_variant = ",eng";
};
};
bars = let config = config;
in [{
command = "${pkgs.lib.getExe pkgs.waybar}";
position = "top";
inherit fonts;
}];
window = {
border = 2;
titlebar = true;
@ -75,7 +72,7 @@ in {
"${mod}+Shift+l" = "exec swaylock -f";
} // { });
menu = "j4-dmenu-desktop --no-generic --term=${
pkgs.lib.getExe inputs.terminal
terminal
} --dmenu='${dmenuCommand}'";
focus.followMouse = false;
};
@ -112,4 +109,5 @@ in {
bindswitch --reload --locked lid:off output $laptop enable
'' + # Clamshell mode
"";
};
}

View file

@ -1,4 +1,6 @@
{
{ ... }: {
programs.thunderbird = {
enable = true;
profiles = { main = { isDefault = true; }; };
};
}

View file

@ -1,7 +1,9 @@
{ scripts, config, lib, pkgs, terminal, ... }:
{ pkgs, config, ... }:
let terminalExec = "${pkgs.lib.getExe terminal} -e";
in {
let terminalExec = "${pkgs.lib.getExe config.defaultPrograms.terminal} -e";
in
rec {
programs.waybar = {
enable = true;
settings = [{
modules-left = [ "sway/workspaces" ];
@ -139,4 +141,11 @@ in {
min-width: 30px;
}
'' + "";
};
wayland.windowManager.sway.config.bars = [{
command = "${pkgs.lib.getExe config.programs.waybar.package}";
position = "top";
fonts = config.wayland.windowManager.sway.config.fonts;
}];
}