Refactoring

This commit is contained in:
fwastring 2025-09-07 20:26:24 +02:00
parent 23fa2928d7
commit 3a90b4b3f6
9 changed files with 475 additions and 428 deletions

66
Justfile Normal file
View file

@ -0,0 +1,66 @@
# just is a command runner, Justfile is very similar to Makefile, but simpler.
############################################################################
#
# Nix commands related to the local machine
#
############################################################################
deploy:
nixos-rebuild switch --flake . --use-remote-sudo
debug:
nixos-rebuild switch --flake . --use-remote-sudo --show-trace --verbose
up:
nix flake update
# Update specific input
# usage: make upp i=home-manager
upp:
nix flake update $(i)
history:
nix profile history --profile /nix/var/nix/profiles/system
repl:
nix repl -f flake:nixpkgs
clean:
# remove all generations older than 7 days
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
gc:
# garbage collect all unused nix store entries
sudo nix-collect-garbage --delete-old
############################################################################
#
# Idols, Commands related to my remote distributed building cluster
#
############################################################################
add-idols-ssh-key:
ssh-add ~/.ssh/ai-idols
aqua: add-idols-ssh-key
nixos-rebuild --flake .#aquamarine --target-host aquamarine --build-host aquamarine switch --use-remote-sudo
aqua-debug: add-idols-ssh-key
nixos-rebuild --flake .#aquamarine --target-host aquamarine --build-host aquamarine switch --use-remote-sudo --show-trace --verbose
ruby: add-idols-ssh-key
nixos-rebuild --flake .#ruby --target-host ruby --build-host ruby switch --use-remote-sudo
ruby-debug: add-idols-ssh-key
nixos-rebuild --flake .#ruby --target-host ruby --build-host ruby switch --use-remote-sudo --show-trace --verbose
kana: add-idols-ssh-key
nixos-rebuild --flake .#kana --target-host kana --build-host kana switch --use-remote-sudo
kana-debug: add-idols-ssh-key
nixos-rebuild --flake .#kana --target-host kana --build-host kana switch --use-remote-sudo --show-trace --verbose
idols: aqua ruby kana
idols-debug: aqua-debug ruby-debug kana-debug

View file

@ -7,89 +7,22 @@
pkgs, pkgs,
myhostname, myhostname,
... ...
}: { }:
{
# You can import other NixOS modules here # You can import other NixOS modules here
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../moduler/base.nix ../../moduler/base.nix
../../moduler/users.nix ../../moduler/users.nix
../../moduler/nginx.nix ../../moduler/nginx.nix
../../moduler/k3s.nix
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
unstable.lego unstable.lego
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 8384 22000];
allowedUDPPortRanges = [
{ from = 4000; to = 4007; }
{ from = 8000; to = 8010; }
]; ];
};
services.k3s = {
enable = true;
role = "server";
token = "supersupersecretkey";
extraFlags = toString ([
"--write-kubeconfig-mode \"0644\""
"--cluster-init"
"--disable local-storage"
"--disable traefik"
]);
clusterInit = true;
};
services.openiscsi = {
enable = true;
name = "iqn.2016-04.com.open-iscsi:desktop";
};
networking.firewall.allowedUDPPorts = [ 22000 21027 ];
services = {
openssh = {
enable = true;
# ports = [55502];
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
X11Forwarding = true;
};
extraConfig = ''
AllowUsers fw ios jw
'';
};
syncthing = {
enable = true;
user = "fw";
dataDir = "/home/fw/syncthing";
configDir = "/home/fw/.config/syncthing";
overrideDevices = true; # overrides any devices added or deleted through the WebUI
overrideFolders = true; # overrides any folders added or deleted through the WebUI
guiAddress = "0.0.0.0:8384";
settings = {
devices = {
"laptop" = { id = "2VEN7O3-PB3G2MK-XJI7R5Z-6MHTNN2-WMXERIX-6G7QWSK-VKSWOSH-Q5WFDAI"; };
"jobb" = { id = "XRKVC74-UNJDQSW-4G3RHC3-5I4W5UT-D2MRMBZ-R4A4MMT-4XB4W47-LFLFBAV"; };
};
folders = {
"Documents" = { # Name of folder in Syncthing, also the folder ID
path = "/home/fw/docs"; # Which folder to add to Syncthing
devices = [ "laptop" ]; # Which devices to share the folder with
};
};
};
};
};
security.rtkit.enable = true;
networking.hostName = myhostname; networking.hostName = myhostname;
services.xserver.dpi = 100;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }

View file

@ -1,5 +1,3 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ {
inputs, inputs,
lib, lib,
@ -9,8 +7,6 @@
}: }:
{ {
nixpkgs = { nixpkgs = {
overlays = [
];
config = { config = {
allowUnfree = true; allowUnfree = true;
}; };
@ -92,19 +88,10 @@
}; };
console.keyMap = "sv-latin1"; console.keyMap = "sv-latin1";
environment.systemPackages = with pkgs; [
waypipe
];
services = { services = {
clipmenu.enable = true; clipmenu.enable = true;
openssh = { openssh = {
enable = true; enable = true;
}; };
blueman = {
enable = true;
};
}; };
system.stateVersion = "25.05";
} }

View file

@ -20,6 +20,7 @@ in
waypipe waypipe
]; ];
services = { services = {
gnome.gnome-keyring.enable = true; gnome.gnome-keyring.enable = true;
greetd = { greetd = {
@ -260,7 +261,7 @@ in
# Applications # Applications
"$mod, q, exec, ${pkgs.firefox}/bin/firefox" "$mod, q, exec, ${pkgs.firefox}/bin/firefox"
"$mod, d, exec, ${pkgs.rofi}/bin/rofi" "$mod, d, exec, ${pkgs.rofi}/bin/rofi -show run"
# Screencapture # Screencapture
"$mod, S, exec, ${pkgs.grim}/bin/grim | wl-copy" "$mod, S, exec, ${pkgs.grim}/bin/grim | wl-copy"

View file

@ -9,21 +9,38 @@
let let
in in
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall = {
6443 enable = true;
5173 allowedTCPPorts = [
8080 6443
3000 5173
]; 8080
3000
8384
22000
];
allowedUDPPortRanges = [
{
from = 4000;
to = 4007;
}
{
from = 8000;
to = 8010;
}
22000
21027
];
};
services.k3s = { services.k3s = {
enable = true; enable = true;
role = "server"; role = "server";
extraFlags = toString ([ extraFlags = toString ([
"--write-kubeconfig-mode \"0644\"" "--write-kubeconfig-mode \"0644\""
"--cluster-init" "--cluster-init"
"--disable servicelb" # "--disable servicelb"
"--disable traefik" "--disable traefik"
"--disable local-storage" "--disable local-storage"
]); ]);
clusterInit = true; clusterInit = true;
}; };
@ -38,9 +55,9 @@ in
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
k3s k3s
cifs-utils cifs-utils
nfs-utils nfs-utils
git git
]; ];
} }

View file

@ -18,12 +18,17 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
openvpn openvpn
networkmanagerapplet networkmanagerapplet
networkmanager-l2tp
strongswan
networkmanager_strongswan
wireguard-tools wireguard-tools
networkmanager networkmanager
openssh openssh
dig
mtr # A network diagnostic tool
iperf3
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
]; ];
} }

View file

@ -9,6 +9,7 @@
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
}; };
blueman.enable = true;
}; };
hardware = { hardware = {
bluetooth = { bluetooth = {

View file

@ -7,80 +7,125 @@
pkgs, pkgs,
myhostname, myhostname,
... ...
}: { }:
{
services.pcscd.enable = true; services.pcscd.enable = true;
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
programs.nh = { programs.nh = {
enable = true; enable = true;
clean.enable = true; clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3"; clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/fw/nix"; flake = "/home/fw/nix";
}; };
environment.systemPackages = with pkgs; [
# Build
just
environment.systemPackages = with pkgs; [ # System
# System libnotify
libnotify lf
lf xsel
xsel xbanish
xbanish unzip
unzip zip
zip wget
wget alsa-utils
alsa-utils htop
htop procps
procps fzf
fzf eza
eza btop
btop xclip
xclip dysk
dysk rsync
rsync procs
procs dust
dust brightnessctl
brightnessctl lolcat
lolcat fortune
fortune cowsay
cowsay ripgrep
ripgrep poppler_utils
poppler_utils grc
grc pkg-config
pkg-config vim
vim bat
bat fd
fd bluez
bluez bluez-tools
bluez-tools openssl
openssl imagemagick
imagemagick pandoc
pandoc texliveFull
texliveFull fastfetch
fastfetch keyutils
keyutils pinentry-all
pinentry-all (pass.withExtensions (
(pass.withExtensions (ext: with ext; [ ext: with ext; [
pass-import pass-import
pass-genphrase pass-genphrase
pass-update pass-update
])) ]
lazygit ))
chawan lazygit
go-passbolt-cli chawan
waypipe go-passbolt-cli
wl-clipboard waypipe
smartmontools wl-clipboard
smartmontools
# Typesetting # Typesetting
typst typst
typstyle typstyle
tinymist tinymist
websocat websocat
nix-search-cli nix-search-cli
libsixel libsixel
];
# system call monitoring
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
# system tools
sysstat
lm_sensors # for `sensors` command
ethtool
pciutils # lspci
usbutils # lsusb
(
let
base = pkgs.appimageTools.defaultFhsEnvArgs;
in
pkgs.buildFHSUserEnv (
base
// {
name = "fhs";
targetPkgs =
pkgs:
# pkgs.buildFHSUserEnv provides only a minimal FHS environment,
# lacking many basic packages needed by most software.
# Therefore, we need to add them manually.
#
# pkgs.appimageTools provides basic packages required by most software.
(base.targetPkgs pkgs)
++ (with pkgs; [
pkg-config
ncurses
# Feel free to add more packages here if needed.
]);
profile = "export FHS=1";
runScript = "bash";
extraOutputsToInstall = [ "dev" ];
}
)
)
];
} }

View file

@ -1,25 +1,30 @@
{ {
config,
pkgs,
... ...
}: { }:
home.packages = with pkgs; [waybar]; {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true;
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";
"modules-left" = ["hyprland/workspaces" "hyprland/window"]; "modules-left" = [
"modules-center" = ["clock"]; "hyprland/workspaces"
"modules-right" = ["tray" "cpu" "memory" "idle_inhibitor" "pulseaudio" "bluetooth"]; ];
"modules-right" = [
"tray"
"clock"
"pulseaudio"
"bluetooth"
];
"hyprland/window" = { "hyprland/window" = {
format = "{title}"; format = "{title}";
"max-length" = 333; "max-length" = 333;
"seperate-outputs" = true; "seperate-outputs" = true;
}; };
clock = { clock = {
format = "<span foreground='#282828'> </span><span>{:%I:%M %a %d}</span>"; format = "<span>{:%c}</span>";
"tooltip-format" = "{calendar}"; "tooltip-format" = "{calendar}";
calendar = { calendar = {
mode = "month"; mode = "month";
@ -47,22 +52,6 @@
format = "<span foreground='#d65d9e'>󰍛</span> {}%"; format = "<span foreground='#d65d9e'>󰍛</span> {}%";
interval = 1; interval = 1;
}; };
"custom/gpu-util" = {
exec = "./scripts/gpu-util";
format = "<span foreground='#67b0e8'>󰯿</span> {}";
interval = 1;
};
"custom/gpu-temp" = {
exec = "./scripts/gpu-temp";
format = "<span foreground='#e57474'></span> {}";
interval = 1;
};
temperature = {
"hwmon-path" = "/sys/class/hwmon/hwmon1/temp1_input";
"critical-threshold" = 80;
format = "<span foreground='#83a598'></span> {temperatureC}°C";
interval = 1;
};
"hyprland/workspaces" = { "hyprland/workspaces" = {
format = "{icon}"; format = "{icon}";
"active-only" = false; "active-only" = false;
@ -103,7 +92,11 @@
headphone = ""; headphone = "";
phone = ""; phone = "";
portable = ""; portable = "";
default = ["" "" ""]; default = [
""
""
""
];
}; };
"on-click-left" = "pavucontrol"; "on-click-left" = "pavucontrol";
input = true; input = true;
@ -149,7 +142,7 @@
"tooltip-format" = "{title}"; "tooltip-format" = "{title}";
"on-click" = "activate"; "on-click" = "activate";
"on-click-middle" = "close"; "on-click-middle" = "close";
"ignore-list" = ["Alacritty"]; "ignore-list" = [ "Alacritty" ];
"app_ids-mapping" = { "app_ids-mapping" = {
firefoxdeveloperedition = "firefox-developer-edition"; firefoxdeveloperedition = "firefox-developer-edition";
}; };
@ -175,256 +168,255 @@
}; };
}; };
style = '' style = ''
@define-color bg #${config.stylix.base16Scheme.base00}; @define-color bg #eff1f5;
@define-color fg #${config.stylix.base16Scheme.base05}; @define-color fg #4c4f69;
@define-color lbg #${config.stylix.base16Scheme.base01}; @define-color lbg #e6e9ef;
@define-color yellow #${config.stylix.base16Scheme.base0A}; @define-color yellow #df8e1d;
@define-color lavender #${config.stylix.base16Scheme.base0E}; @define-color lavender #7287fd;
@define-color peach #${config.stylix.base16Scheme.base0A}; @define-color peach #fe640b;
@define-color red #${config.stylix.base16Scheme.base08}; @define-color red #d20f39;
@define-color green #${config.stylix.base16Scheme.base0B}; @define-color green #40a02b;
@define-color blue #${config.stylix.base16Scheme.base0D}; @define-color blue #1e66f5;
@define-color border #${config.stylix.base16Scheme.base02}; @define-color border #dce0e8;
* { * {
min-height: 0; min-height: 0;
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding: 0; padding: 0;
border-radius: 7px; border-radius: 7px;
font-family: "JetBrains Mono Nerd Font"; font-family: "ComicShannsMono Nerd Font";
font-size: 14pt; font-size: 11pt;
font-weight: 700; font-weight: 700;
padding-bottom: 0px; padding-bottom: 0px;
} }
tooltip { tooltip {
background: @bg; background: @bg;
border-radius: 7px; border-radius: 7px;
border: 2px solid @border; border: 2px solid @border;
} }
#window { #window {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 7px; padding-right: 7px;
border-radius: 3px; border-radius: 3px;
border-color: @lbg; border-color: @lbg;
background-color: @yellow; background-color: @yellow;
color: @bg; color: @bg;
} }
window#waybar.empty #window { window#waybar.empty #window {
background-color: @bg; background-color: @bg;
border-bottom: none; border-bottom: none;
border-right: none; border-right: none;
} }
window#waybar { window#waybar {
background-color: @bg; background-color: @bg;
color: @lavender; color: @lavender;
} }
/* Workspaces */ /* Workspaces */
@keyframes button_activate { @keyframes button_activate {
from { opacity: .3 } from { opacity: .3 }
to { opacity: 1.; } to { opacity: 1.; }
} }
#workspaces { #workspaces {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
border-radius: 3px; border-radius: 3px;
padding: 1px; padding: 1px;
background-color: @bg; background-color: @bg;
color: @bg; color: @bg;
} }
#workspaces button { #workspaces button {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
border-radius: 3px; border-radius: 3px;
padding-left: 3px; padding-left: 3px;
padding-right: 9px; padding-right: 9px;
background-color: @bg; background-color: @bg;
color: @fg; color: @fg;
} }
#workspaces button.active { #workspaces button.active {
background-color:@blue; background-color:@blue;
color: @bg; color: @bg;
} }
#workspaces button.urgent { #workspaces button.urgent {
color: #F38BA8; color: #F38BA8;
} }
#workspaces button:hover { #workspaces button:hover {
border: solid transparent; border: solid transparent;
} }
#custom-gpu-util { #custom-gpu-util {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
border-radius: 7px; border-radius: 7px;
background-color: @bg; background-color: @bg;
color: @fg; color: @fg;
} }
#tray { #tray {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
border-radius: 3px; border-radius: 3px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
background-color: @bg; background-color: @bg;
color: @fg; color: @fg;
} }
#idle_inhibitor { #idle_inhibitor {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 12px; padding-right: 12px;
border-radius: 3px; border-radius: 3px;
background-color: @bg; background-color: @bg;
color: @fg; color: @fg;
} }
#network { #network {
margin: 5px 5px 2px 5px; margin: 5px 5px 2px 5px;
padding-left: 10px; padding-left: 10px;
padding-right: 12px; padding-right: 12px;
border-radius: 7px; border-radius: 7px;
background-color: @bg; background-color: @bg;
color: @lavender; color: @lavender;
} }
#network.linked { #network.linked {
color: @peach; color: @peach;
} }
#network.disconnected, #network.disconnected,
#network.disabled { #network.disabled {
color: @red; color: @red;
} }
#custom-subs { #custom-subs {
color: @fg; color: @fg;
margin: 5px 5px 2px 5px; margin: 5px 5px 2px 5px;
padding-left: 10px; padding-left: 10px;
padding-right: 12px; padding-right: 12px;
border-radius: 3px; border-radius: 3px;
border-bottom: 2px solid @bg; border-bottom: 2px solid @bg;
border-right: 2px solid @bg; border-right: 2px solid @bg;
border-color: @lbg; border-color: @lbg;
background-color: @red; background-color: @red;
} }
#custom-spacer { #custom-spacer {
background-color: @yellow; background-color: @yellow;
} }
#custom-cliphist { #custom-cliphist {
color: @peach; color: @peach;
margin: 5px 5px 2px 5px; margin: 5px 5px 2px 5px;
padding-left: 10px; padding-left: 10px;
padding-right: 12px; padding-right: 12px;
border-radius: 3px; border-radius: 3px;
background-color: @bg; background-color: @bg;
} }
#custom-gpu-temp, #custom-gpu-temp,
#cpu, #cpu,
#memory, #memory,
#custom-clipboard, #custom-clipboard,
#temperature { #temperature {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
border-radius: 3px; border-radius: 3px;
color: @fg; color: @fg;
background-color: @bg; background-color: @bg;
} }
#custom-playerctl { #custom-playerctl {
margin: 5px 5px 2px 5px; margin: 5px 5px 2px 5px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
border-radius: 3px; border-radius: 3px;
color: @fg; color: @fg;
background-color: @bg; background-color: @bg;
} }
#battery, #battery,
#backlight, #backlight,
#bluetooth, #bluetooth,
#pulseaudio { #pulseaudio {
margin-top: 5px; margin-top: 5px;
margin-bottom: 2px; margin-bottom: 2px;
color: @fg; color: @fg;
background-color: @bg; background-color: @bg;
border-top-right-radius: 0px; border-top-right-radius: 0px;
border-bottom-right-radius: 0px; border-bottom-right-radius: 0px;
border-top-left-radius: 3px; border-top-left-radius: 3px;
border-bottom-left-radius: 3px; border-bottom-left-radius: 3px;
} }
#battery, #battery,
#bluetooth { #bluetooth {
margin-left: 0px; margin-left: 0px;
margin-right: 5px; margin-right: 5px;
padding-left: 7.5px; padding-left: 7.5px;
padding-right: 10px; padding-right: 10px;
border-top-left-radius: 0px; border-top-left-radius: 0px;
border-bottom-left-radius: 0px; border-bottom-left-radius: 0px;
border-top-right-radius: 3px; border-top-right-radius: 3px;
border-bottom-right-radius: 3px; border-bottom-right-radius: 3px;
} }
#backlight, #backlight,
#pulseaudio { #pulseaudio {
margin-right: 0px; margin-right: 0px;
margin-left: 5px; margin-left: 5px;
padding-left: 10px; padding-left: 10px;
padding-right: 7.5px; padding-right: 7.5px;
border-top-right-radius: 0px; border-top-right-radius: 0px;
border-bottom-right-radius: 0px; border-bottom-right-radius: 0px;
border-top-left-radius: 3px; border-top-left-radius: 3px;
border-bottom-left-radius: 3px; border-bottom-left-radius: 3px;
} }
#clock { #clock {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
border-radius: 3px; border-radius: 3px;
color: @bg; color: @bg;
background-color: @green; background-color: @green;
} }
#taskbar { #taskbar {
border-radius: 0px 0px 0px 0; border-radius: 0px 0px 0px 0;
padding: 0 3px; padding: 0 3px;
margin: 0 0px; margin: 0 0px;
color: #ffffff; color: #ffffff;
background-color: rgba(120,118,117,0.3); background-color: rgba(120,118,117,0.3);
} }
#taskbar button { #taskbar button {
border-radius: 0px 0px 0px 0px; border-radius: 0px 0px 0px 0px;
padding: 0 0 0 3px; padding: 0 0 0 3px;
margin: 3px 1; margin: 3px 1;
color: #ffffff; color: #ffffff;
background-color: rgba(120,118,117,0.1); background-color: rgba(120,118,117,0.1);
} }
#taskbar button.active { #taskbar button.active {
background-color: rgba(120,118,117,0.8); background-color: rgba(120,118,117,0.8);
} }
#mode { #mode {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
border-radius: 3px; border-radius: 3px;
background-color: @bg; background-color: @bg;
color: @peach; color: @peach;
} }
''; '';
}; };
} }