refactor: reorganize module layout
This commit is contained in:
1 parent
9a6bbc26c1
commit
0431bce152
63 files changed
+323
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,6 @@
|
||||
{ den, ... }: {
|
||||
den.aspects.software.cad = {
|
||||
includes = [ (den.batteries.unfree [ "plasticity" ]) ];
|
||||
homeManager = { pkgs, ... }: { home.packages = [ pkgs.plasticity ]; };
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
den.aspects.software.cli.nixos = { pkgs, ... }: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
# nix
|
||||
comma
|
||||
home-manager
|
||||
nh
|
||||
nix-index
|
||||
nix-output-monitor
|
||||
nix-prefetch
|
||||
nvd
|
||||
# dev
|
||||
git
|
||||
nil
|
||||
nixd
|
||||
nixfmt
|
||||
# editors
|
||||
micro
|
||||
# net
|
||||
inetutils
|
||||
wget
|
||||
# files
|
||||
psmisc
|
||||
tree
|
||||
unzip
|
||||
];
|
||||
};
|
||||
}
|
||||
File renamed without changes.
@@ -1,63 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
den.aspects.nix-ld = {
|
||||
nixos =
|
||||
{ pkgs, options, ... }:
|
||||
{
|
||||
programs.nix-ld = let
|
||||
libxml2-so2-compat = pkgs.runCommand "libxml2-so2-compat" { } ''
|
||||
mkdir -p $out/lib
|
||||
ln -s ${pkgs.libxml2.out}/lib/libxml2.so.16 $out/lib/libxml2.so.2
|
||||
'';
|
||||
in {
|
||||
enable = true;
|
||||
|
||||
libraries =
|
||||
options.programs.nix-ld.libraries.default
|
||||
++ (with pkgs; [
|
||||
libxml2-so2-compat
|
||||
|
||||
udev
|
||||
gcc
|
||||
egl-wayland
|
||||
mesa
|
||||
libglvnd
|
||||
wayland
|
||||
libX11
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXi
|
||||
libxcb
|
||||
glibc
|
||||
vulkan-loader
|
||||
alsa-lib
|
||||
pipewire
|
||||
libpulseaudio
|
||||
|
||||
libz
|
||||
libGL
|
||||
|
||||
xcbutil
|
||||
xcbutilimage
|
||||
xcbutilkeysyms
|
||||
xcbutilrenderutil
|
||||
xcbutilwm
|
||||
|
||||
libXrender
|
||||
libXext
|
||||
libXfixes
|
||||
libSM
|
||||
libICE
|
||||
systemd
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
fontconfig.lib
|
||||
freetype
|
||||
libxkbcommon
|
||||
dbus.lib
|
||||
libidn2
|
||||
]);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
den.aspects.software.dev.homeManager = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
jdk25
|
||||
python314Packages.pyside6
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
den.aspects.software.editors.homeManager = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
zed-editor
|
||||
#arduino-ide
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
den.aspects.software.files = {
|
||||
nixos = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.file-roller ];
|
||||
};
|
||||
|
||||
homeManager = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
impression
|
||||
baobab
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{ inputs, lib, ... }: {
|
||||
den.aspects.flatpak = {
|
||||
nixos = { ... }: {
|
||||
imports = [ inputs.nix-flatpak.nixosModules.nix-flatpak ];
|
||||
|
||||
services.flatpak = {
|
||||
enable = true;
|
||||
|
||||
remotes = lib.mkOptionDefault [{
|
||||
name = "flathub-beta";
|
||||
location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo";
|
||||
} {
|
||||
name = "RSILauncher";
|
||||
location = "https://mactan-sc.github.io/rsilauncher/RSILauncher.flatpakrepo";
|
||||
}];
|
||||
|
||||
update.auto.enable = true;
|
||||
uninstallUnmanaged = true;
|
||||
|
||||
overrides = {
|
||||
global = {
|
||||
Context.sockets = [ "wayland" "!x11" "!fallback-x11" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
{ ... }: {
|
||||
den.aspects.fonts = {
|
||||
nixos = { pkgs, ... }: {
|
||||
fonts = {
|
||||
fontDir.enable = true;
|
||||
enableDefaultPackages = true;
|
||||
|
||||
packages = with pkgs; [
|
||||
twitter-color-emoji
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.droid-sans-mono
|
||||
];
|
||||
|
||||
fontconfig = {
|
||||
enable = true;
|
||||
useEmbeddedBitmaps = true;
|
||||
|
||||
defaultFonts = {
|
||||
emoji = [ "Twitter Color Emoji" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
den.aspects.software.gaming.nixos.services.flatpak.packages = [ "community.pathofbuilding.PathOfBuilding" ];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
den.aspects.software.gaming.nixos.services.flatpak.packages = [ "org.vinegarhq.Sober" ];
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
{
|
||||
den.aspects.janitor-backend = {
|
||||
nixos = { pkgs, lib, config, ... }:
|
||||
let
|
||||
cfg = config.services.janitor;
|
||||
|
||||
janitorScript = pkgs.writeText "janitor.py" ''
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import time
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="[janitor] %(message)s",
|
||||
stream=sys.stdout,
|
||||
)
|
||||
log = logging.getLogger("janitor")
|
||||
|
||||
CONFIG_PATH = os.environ.get("JANITOR_CONFIG")
|
||||
|
||||
|
||||
def load_config():
|
||||
if not CONFIG_PATH or not os.path.exists(CONFIG_PATH):
|
||||
raise FileNotFoundError(f"JANITOR_CONFIG not set or missing: {CONFIG_PATH}")
|
||||
with open(CONFIG_PATH) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def get_destination(extension, rules):
|
||||
ext = extension.lower().lstrip(".")
|
||||
for folder, extensions in rules.items():
|
||||
if ext in extensions:
|
||||
return folder
|
||||
return None
|
||||
|
||||
|
||||
def resolve_dest(dest_key, watch_dir):
|
||||
if os.path.isabs(dest_key):
|
||||
return Path(dest_key)
|
||||
return watch_dir.parent / dest_key
|
||||
|
||||
|
||||
def unique_path(target):
|
||||
if not target.exists():
|
||||
return target
|
||||
stem, suffix = target.stem, target.suffix
|
||||
counter = 1
|
||||
while True:
|
||||
candidate = target.parent / f"{stem}_{counter}{suffix}"
|
||||
if not candidate.exists():
|
||||
return candidate
|
||||
counter += 1
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config = load_config()
|
||||
except Exception as e:
|
||||
log.error("Failed to load config: %s", e)
|
||||
sys.exit(1)
|
||||
|
||||
grace_period = config.get("grace_period", 60)
|
||||
rules = config.get("rules", {})
|
||||
now = time.time()
|
||||
|
||||
for watch_dir_str in config.get("watched_dirs", []):
|
||||
watch_dir = Path(os.path.expanduser(watch_dir_str))
|
||||
|
||||
if not watch_dir.exists():
|
||||
log.warning("Watched dir does not exist: %s", watch_dir)
|
||||
continue
|
||||
|
||||
for item in watch_dir.iterdir():
|
||||
if not item.is_file() or item.name.startswith("."):
|
||||
continue
|
||||
|
||||
age = now - item.stat().st_mtime
|
||||
if age < grace_period:
|
||||
continue
|
||||
|
||||
dest_key = get_destination(item.suffix, rules)
|
||||
if dest_key is None:
|
||||
continue
|
||||
|
||||
target_dir = resolve_dest(dest_key, watch_dir)
|
||||
target_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
target = unique_path(target_dir / item.name)
|
||||
|
||||
try:
|
||||
shutil.move(str(item), str(target))
|
||||
log.info("Moved %s -> %s", item.name, target)
|
||||
except Exception as e:
|
||||
log.error("Failed to move %s: %s", item.name, e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
'';
|
||||
|
||||
janitorConfig = pkgs.writeText "janitor_config.json" (builtins.toJSON {
|
||||
grace_period = cfg.gracePeriod;
|
||||
watched_dirs = cfg.watchedDirs;
|
||||
rules = cfg.rules;
|
||||
});
|
||||
|
||||
in {
|
||||
options.services.janitor = {
|
||||
enable = lib.mkEnableOption "file sorting janitor";
|
||||
|
||||
interval = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "5min";
|
||||
description = "How often to run the janitor (systemd time span, e.g. \"5min\", \"1h\").";
|
||||
};
|
||||
|
||||
gracePeriod = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 60;
|
||||
description = "Seconds a file must remain unmodified before it is eligible to be moved.";
|
||||
};
|
||||
|
||||
watchedDirs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "~/Downloads" ];
|
||||
description = "Directories to scan and sort. Supports ~ expansion.";
|
||||
};
|
||||
|
||||
rules = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
|
||||
default = { };
|
||||
description = ''
|
||||
Mapping of destination folder path to a list of file extensions (without leading dot).
|
||||
Destinations are relative to the parent of the watched directory, or absolute if they
|
||||
start with /.
|
||||
|
||||
Example:
|
||||
rules = {
|
||||
"Pictures/Downloads" = [ "jpg" "png" "gif" "webp" ];
|
||||
"Videos/Downloads" = [ "mp4" "mkv" "webm" ];
|
||||
"/mnt/archive" = [ "zip" "tar" ];
|
||||
};
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
"Pictures/Downloads" = [ "jpg" "jpeg" "png" "gif" "webp" "avif" ];
|
||||
"Videos/Downloads" = [ "mp4" "mkv" "mov" "webm" "avi" ];
|
||||
"Music/Downloads" = [ "mp3" "flac" "wav" "ogg" "opus" "m4a" ];
|
||||
"Documents/Downloads" = [ "pdf" "doc" "docx" "odt" "txt" "md" "epub" ];
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "bug";
|
||||
description = "User account the janitor service runs as.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.janitor = {
|
||||
description = "File sorting janitor";
|
||||
|
||||
environment.JANITOR_CONFIG = "${janitorConfig}";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
ExecStart = "${pkgs.python3}/bin/python3 ${janitorScript}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.janitor = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
timerConfig = {
|
||||
OnBootSec = "10m";
|
||||
OnUnitActiveSec = cfg.interval;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
{ den, ... }: {
|
||||
den.aspects.janitor = {
|
||||
includes = with den.aspects; [ janitor-backend ];
|
||||
|
||||
nixos = {
|
||||
services.janitor = {
|
||||
enable = true;
|
||||
interval = "1min";
|
||||
gracePeriod = 60;
|
||||
watchedDirs = [ "~/Downloads" ];
|
||||
|
||||
rules = {
|
||||
"Pictures/Downloads" = [ "jpg" "jpeg" "png" "gif" "webp" "svg" "heic" "avif" "ico" ];
|
||||
"Videos/Downloads" = [ "mp4" "mkv" "mov" "webm" "avi" "flv" ];
|
||||
"Music/Downloads" = [ "mp3" "flac" "wav" "ogg" "m4a" "opus" ];
|
||||
"Documents/Downloads" = [ "pdf" "doc" "docx" "odt" "txt" "md" "epub" "ppt" "pptx" "xls" "xlsx" "csv" ];
|
||||
"Archives/Downloads" = [ "iso" "zip" "tar" "gz" "bz2" "xz" "rar" "7z" "wsz" ];
|
||||
"Fonts/Downloads" = [ "ttf" "otf" "woff" "woff2" ];
|
||||
"3D/Downloads" = [ "blend" "obj" "fbx" "stl" "dae" "3ds" "3mf" ];
|
||||
"Software/Downloads" = [ "deb" "rpm" "appimage" "jar" "exe" "msi" "flatpak" ];
|
||||
"Scripts/Downloads" = [ "sh" "py" "lua" ];
|
||||
|
||||
"Games/Doom" = [ "wad" "pk3" ];
|
||||
"Games/Switch" = [ "nsp" "xci" ];
|
||||
"Games/3DS" = [ "3ds" "cia" ];
|
||||
"Games/WiiU" = [ "wux" "wud" ];
|
||||
"Games/Wii" = [ "wbfs" ];
|
||||
"Games/GameCube" = [ "gcm" ];
|
||||
"Games/N64" = [ "n64" "z64" ];
|
||||
"Games/SNES" = [ "sfc" "smc" ];
|
||||
"Games/NES" = [ "nes" ];
|
||||
"Games/DS" = [ "nds" "dsi" ];
|
||||
"Games/GBA" = [ "gba" ];
|
||||
"Games/GBC" = [ "gbc" ];
|
||||
"Games/GB" = [ "gb" ];
|
||||
"Games/PS1" = [ "cue" "bin" ];
|
||||
"Games/Xbox" = [ "xiso" ];
|
||||
"Games/Genesis" = [ "gen" ];
|
||||
"Games/Dreamcast" = [ "gdi" "cdi" ];
|
||||
"Games/Saturn" = [ "sat" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
{ ... }: {
|
||||
den.aspects.llama = {
|
||||
nixos = { pkgs, lib, ... }: {
|
||||
environment.systemPackages = [ pkgs.cloudflared ];
|
||||
environment.etc."cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json".source = "/home/bug/.cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json";
|
||||
|
||||
services.cloudflared = {
|
||||
enable = true;
|
||||
tunnels = {
|
||||
"608ba37a-1be8-49e8-be2d-abeb8b77081d" = {
|
||||
credentialsFile = "/etc/cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json";
|
||||
|
||||
ingress = {
|
||||
"llama.bug.tools" = "http://127.0.0.1:8080";
|
||||
};
|
||||
|
||||
default = "http_status:404";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."cloudflared-tunnel-608ba37a-1be8-49e8-be2d-abeb8b77081d".environment = {
|
||||
TUNNEL_TRANSPORT_PROTOCOL = pkgs.lib.mkForce "http2";
|
||||
};
|
||||
|
||||
|
||||
services.llama-cpp = let
|
||||
# https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md
|
||||
modelsPreset = {
|
||||
"*" = rec {
|
||||
# keep-sorted start
|
||||
agent = true;
|
||||
cache-ram = 0; # unified memory
|
||||
cache-type-k = "q8_0";
|
||||
cache-type-v = "q8_0";
|
||||
ctx-size = 256 * 256 * parallel;
|
||||
fit = "off";
|
||||
flash-attn = "on";
|
||||
kv-unified = false;
|
||||
mlock = true;
|
||||
mmap = false;
|
||||
n-gpu-layers = "all";
|
||||
parallel = 1;
|
||||
reasoning-preserve = true;
|
||||
sleep-idle-seconds = -1;
|
||||
spec-draft-type-k = "q8_0";
|
||||
spec-draft-type-v = "q8_0";
|
||||
# keep-sorted end
|
||||
};
|
||||
|
||||
"qwen3.6-35b-a3b" = {
|
||||
# keep-sorted start
|
||||
hf-repo = "unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL";
|
||||
min-p = 0.0;
|
||||
temperature = 1.0;
|
||||
top-k = 20;
|
||||
top-p = 0.95;
|
||||
# keep-sorted end
|
||||
};
|
||||
|
||||
"qwen3.8-27b" = {
|
||||
# keep-sorted start
|
||||
ctx-size = 32768; # drop from the 65536 default to leave VRAM headroom at Q6
|
||||
hf-repo = "unsloth/Qwen3.8-27B-GGUF:UD-Q6_K";
|
||||
min-p = 0.0;
|
||||
temperature = 1.0;
|
||||
top-k = 20;
|
||||
top-p = 0.95;
|
||||
# keep-sorted end
|
||||
};
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
package = pkgs.llama-cpp.override { cudaSupport = true; };
|
||||
|
||||
settings = {
|
||||
host = "0.0.0.0";
|
||||
port = 8080;
|
||||
ctx-size = 65536;
|
||||
|
||||
models-max = 1;
|
||||
models-preset = pkgs.writeText "llama-models.ini" (lib.generators.toINI { } modelsPreset);
|
||||
no-models-autoload = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
den.aspects.software.media = {
|
||||
nixos = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.wl-screenrec ];
|
||||
};
|
||||
|
||||
homeManager = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
kooha
|
||||
loupe
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
den.aspects.software.monitor = {
|
||||
nixos = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.firmware-updater ];
|
||||
};
|
||||
|
||||
homeManager = { pkgs, ... }: {
|
||||
home.packages = [ pkgs.mission-center ];
|
||||
};
|
||||
};
|
||||
}
|
||||
File renamed without changes.
@@ -1,43 +0,0 @@
|
||||
{
|
||||
den.aspects.mpd = {
|
||||
homeManager = {
|
||||
services.mpd-mpris.enable = true;
|
||||
};
|
||||
|
||||
nixos = {
|
||||
services = {
|
||||
mpd = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
music_directory = "/home/bug/Music";
|
||||
|
||||
decoder = [
|
||||
{
|
||||
plugin = "ffmpeg";
|
||||
enabled = "yes";
|
||||
}
|
||||
{
|
||||
plugin = "opus";
|
||||
enabled = "no";
|
||||
}
|
||||
];
|
||||
|
||||
audio_output = [{
|
||||
type = "pipewire";
|
||||
name = "PipeWire Sound Server";
|
||||
}];
|
||||
};
|
||||
|
||||
user = "bug";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
mpd.environment = {
|
||||
XDG_RUNTIME_DIR = "/run/user/1000";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
{ den, ... }: {
|
||||
den.aspects.software.office = {
|
||||
includes = [ (den.batteries.unfree [ "obsidian" ]) ];
|
||||
|
||||
homeManager = { pkgs, ... }: {
|
||||
home.packages = [ pkgs.obsidian ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
den.aspects.software.security.homeManager = { pkgs, ... }: {
|
||||
home.packages = [ pkgs.authenticator ];
|
||||
};
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,29 @@
|
||||
{
|
||||
den.aspects.software.shell.nixos = { pkgs, host, ... }: {
|
||||
programs.fish = {
|
||||
shellAliases = {
|
||||
box = "ssh box.${host.domain}";
|
||||
unbox = "sh -c 'ssh -N -L \"$1\":0.0.0.0:\"$1\" box.${host.domain} &' --";
|
||||
rebox = "sh -c 'fuser -k \"$1\"/tcp' --";
|
||||
dock = "sh -c 'ssh -N -D \"$1\" box.${host.domain} &' --";
|
||||
|
||||
vpn = "sshuttle --dns --python python3 -r box.${host.domain} 0/0";
|
||||
|
||||
pico = "ssh pico.sh";
|
||||
|
||||
ns = "nh os switch ~/nix --impure -H (hostname)";
|
||||
rebuild = "ns";
|
||||
};
|
||||
|
||||
shellInit = ''
|
||||
function tssh
|
||||
ssh (tailscale status | awk -v host=$argv[1] '$2 == host {print $1}')
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs.fishPlugins; [
|
||||
sponge
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
den.aspects.software.social.homeManager = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
geary
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
den.aspects.software.terminal.homeManager = {
|
||||
programs.ghostty = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
window-decoration = "none";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user