Compare commits

..

44 Commits

Author SHA1 Message Date
9b08d81ab0 Merge branch 'master' of 192.168.1.126:TheCrazyInsanity/nixos-configv3 2026-05-21 21:18:09 -04:00
a3df8a8162 glorpshit 2026-05-21 21:16:51 -04:00
TheCrazyInsanity
48dc241b0b fix podman no build other computer monkey brain big 2026-05-10 21:41:48 -04:00
TheCrazyInsanity
7b70909a16 Merge branch 'master' of https://gitea.thecrazyinsanity.win/thecrazyinsanity/nixos-configv3 2026-05-08 15:51:16 -04:00
TheCrazyInsanity
ff07a0a8c6 gyatt 2026-05-08 15:51:13 -04:00
05aac965f1 Merge branch 'master' of 192.168.1.126:TheCrazyInsanity/nixos-configv3 2026-05-08 15:48:26 -04:00
a4f23b64d3 idkvro 2026-05-08 15:48:23 -04:00
TheCrazyInsanity
268a06af61 loses it mildly 2026-05-08 12:42:44 -04:00
TheCrazyInsanity
fbbef69fa1 fuck 2026-05-08 12:41:49 -04:00
TheCrazyInsanity
998200233c Merge branch 'master' of https://gitea.thecrazyinsanity.win/thecrazyinsanity/nixos-configv3 2026-05-01 07:44:42 -04:00
TheCrazyInsanity
34aab3550d screenshit 2026-05-01 07:44:04 -04:00
c9478fa513 add nvenc-compress package 2026-04-27 17:37:09 -04:00
4acde426e9 kirk 2026-04-27 17:23:21 -04:00
40a288f413 Merge branch 'master' of 192.168.1.126:TheCrazyInsanity/nixos-configv3 2026-04-19 18:27:17 -04:00
2e09c668e5 bullshiiit 2026-04-19 18:27:15 -04:00
TheCrazyInsanity
43020e5b51 random bg (ty gemini) 2026-04-15 12:40:34 -04:00
TheCrazyInsanity
0b3b7c1822 i dont rember 2026-04-14 12:36:59 -04:00
TheCrazyInsanity
497a318d0b i probably fixed gtk idk 2026-04-14 08:33:27 -04:00
TheCrazyInsanity
302a4fe136 waybar.css 2026-04-12 14:43:58 -04:00
TheCrazyInsanity
99b008305c hope this works 2026-04-11 21:37:28 -04:00
TheCrazyInsanity
c696e8702f i lowkirkenuinely don t know tbh #sigma 2026-04-11 19:32:45 -04:00
TheCrazyInsanity
ded04993c8 h 2026-04-11 17:41:27 -04:00
TheCrazyInsanity
23058e5831 hi 2026-04-11 20:14:51 +00:00
68f4726bcf hibernate maybe 2026-04-11 15:04:10 -04:00
TheCrazyInsanity
c54bf86f7f fix 2026-04-11 14:37:17 -04:00
TheCrazyInsanity
e15989f29f add latitude 2026-04-11 17:49:45 +00:00
a1fe50ee54 idk 2026-04-10 16:09:45 -04:00
ac5425e5b1 ffs 2026-04-05 22:08:19 -04:00
77c77a298b i have to commit in order to get the patches to work 2026-04-05 18:08:32 -04:00
00ebec0062 i dont rember 2026-04-02 16:28:07 -04:00
ca3c740b66 Merge branch 'master' of 192.168.1.126:TheCrazyInsanity/nixos-configv3 2026-03-13 18:44:17 -04:00
4b3a369c6e ts sucks vrah 2026-03-13 18:43:11 -04:00
b7e89f4da4 merge conflicts galore 2026-03-13 18:42:58 -04:00
TheCrazyInsanity
67c9ce550d Merge branch 'master' of https://gitea.thecrazyinsanity.win/TheCrazyInsanity/nixos-configv3 2026-03-13 16:22:07 +00:00
TheCrazyInsanity
000ab8fa93 huh 2026-03-13 16:18:27 +00:00
TheCrazyInsanity
346b2eac88 gyatt 2026-03-13 16:16:56 +00:00
5c1ef72f19 freaks it 2026-03-03 20:59:58 -05:00
c8bc205d3c qwen my beloved <3, now declarative! 2026-03-01 13:06:37 -05:00
a92363a211 im gonna die 2026-02-26 21:01:53 -05:00
a2fd8acc07 h 2026-02-07 12:14:01 -05:00
148a404283 Merge branch 'master' of 192.168.1.126:TheCrazyInsanity/nixos-configv3 2026-01-30 17:05:05 -05:00
c16526eabf ya 2026-01-30 17:04:38 -05:00
TheCrazyInsanity
b085512775 h 2026-01-08 18:39:49 +00:00
TheCrazyInsanity
68f8144c18 ough 2026-01-08 15:39:33 +00:00
26 changed files with 1840 additions and 73 deletions

267
flake.lock generated
View File

@@ -1,5 +1,108 @@
{
"nodes": {
"blueprint": {
"inputs": {
"nixpkgs": [
"llm-agents",
"nixpkgs"
],
"systems": [
"llm-agents",
"systems"
]
},
"locked": {
"lastModified": 1776249299,
"narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=",
"owner": "numtide",
"repo": "blueprint",
"rev": "56131e8628f173d24a27f6d27c0215eff57e40dd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "blueprint",
"type": "github"
}
},
"bun2nix": {
"inputs": {
"flake-parts": [
"llm-agents",
"flake-parts"
],
"nixpkgs": [
"llm-agents",
"nixpkgs"
],
"systems": [
"llm-agents",
"systems"
],
"treefmt-nix": [
"llm-agents",
"treefmt-nix"
]
},
"locked": {
"lastModified": 1777369708,
"narHash": "sha256-1xW7cRZNsFNPQD+cE0fwnLVStnDth0HSoASEIFeT7uI=",
"owner": "nix-community",
"repo": "bun2nix",
"rev": "e659e1cc4b8e1b21d0aa85f1c481f9db61ecfa98",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "staging-2.1.0",
"repo": "bun2nix",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"llm-agents",
"nixpkgs"
]
},
"locked": {
"lastModified": 1777988971,
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"glide": {
"inputs": {
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1777767341,
"narHash": "sha256-lV2i2hBWxUKU2dgHza9SGfizOsV+uUcTQD/De+6/X3M=",
"owner": "glide-browser",
"repo": "glide.nix",
"rev": "790c9d37e3dcf9bb04ae4486a0320b999a8eec32",
"type": "github"
},
"original": {
"owner": "glide-browser",
"repo": "glide.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -7,11 +110,11 @@
]
},
"locked": {
"lastModified": 1764998300,
"narHash": "sha256-fZatn/KLfHLDXnF0wy7JxXqGaZmGDTVufT4o/AOlj44=",
"lastModified": 1778248595,
"narHash": "sha256-dhFgEjoeJMYN/7OY6xfxS799YB4IjbbYXTjyGIJyLpc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "27a6182347ccae90a88231ae0dc5dfa7d15815bb",
"rev": "fdb2ccba9d5e1238d32e0c4a3ec1a277efa80c1d",
"type": "github"
},
"original": {
@@ -21,13 +124,38 @@
"type": "github"
}
},
"impermanence": {
"home-manager_2": {
"inputs": {
"nixpkgs": [
"impermanence",
"nixpkgs"
]
},
"locked": {
"lastModified": 1737831083,
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
"lastModified": 1768598210,
"narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1769548169,
"narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
"rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
"type": "github"
},
"original": {
@@ -36,13 +164,36 @@
"type": "github"
}
},
"llm-agents": {
"inputs": {
"blueprint": "blueprint",
"bun2nix": "bun2nix",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2",
"systems": "systems",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1778247177,
"narHash": "sha256-ZSe9r9xbx72NnBCCiC1UZxmIFzFA9IPno10Esp1kjiE=",
"owner": "Qumulo",
"repo": "llm-agents",
"rev": "02444d83933d3ca28c9fd5d0be28812bdcf1232e",
"type": "github"
},
"original": {
"owner": "Qumulo",
"repo": "llm-agents",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1764950072,
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
"lastModified": 1768564909,
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f61125a668a320878494449750330ca58b78c557",
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github"
},
"original": {
@@ -52,11 +203,105 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1778124196,
"narHash": "sha256-pYEytCNic/czazbV9r3tbQ6BZzqRBg/41x2dIC5ymOo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68a8af93ff4297686cb68880845e61e5e2e41d92",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1777954456,
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"plasma-manager": {
"inputs": {
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1775856943,
"narHash": "sha256-b7Mp7P+q2Md5AGt4rjHfMcBykzMumFTen10ST++AuTU=",
"owner": "nix-community",
"repo": "plasma-manager",
"rev": "a524a6160e6df89f7673ba293cf7d78b559eb1a5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "plasma-manager",
"type": "github"
}
},
"root": {
"inputs": {
"glide": "glide",
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs"
"llm-agents": "llm-agents",
"nixpkgs": "nixpkgs_3",
"plasma-manager": "plasma-manager"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"llm-agents",
"nixpkgs"
]
},
"locked": {
"lastModified": 1775636079,
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},

View File

@@ -11,7 +11,19 @@
# to avoid problems caused by different versions of nixpkgs.
inputs.nixpkgs.follows = "nixpkgs";
};
glide = {
url = "github:glide-browser/glide.nix";
# optionally: follow your flake's inputs
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
impermanence.url = "github:nix-community/impermanence";
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
llm-agents.url = "github:Qumulo/llm-agents";
# nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.6.0";
};
@@ -21,7 +33,10 @@
nixpkgs,
home-manager,
impermanence,
# nix-flatpak,
plasma-manager,
llm-agents,
glide,
# nix-flatpak,
}@inputs:
let
inherit (self) outputs;
@@ -43,6 +58,7 @@
home-manager.useUserPackages = true;
home-manager.users.laythe = import ./machines/homepc/home.nix;
home-manager.sharedModules = [ plasma-manager.homeModules.plasma-manager ];
}
];
};
@@ -58,7 +74,24 @@
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.laythe = import ./machines/homepc/home.nix;
home-manager.users.laythe = import ./machines/workstation/home.nix;
home-manager.sharedModules = [ plasma-manager.homeModules.plasma-manager ];
}
];
};
latitude = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
system = "x86_64-linux";
modules = [
./machines/latitude/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = { inherit inputs outputs; };
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.laythe = import ./machines/latitude/home.nix;
home-manager.sharedModules = [ plasma-manager.homeModules.plasma-manager ];
}
];
};

View File

@@ -16,10 +16,96 @@
nix-fast-build
colmena
;
openldap = prev.openldap.overrideAttrs {
doCheck = !prev.stdenv.hostPlatform.isi686;
};
})
];
nix.package = pkgs.lixPackageSets.stable.lix;
nixpkgs.config.packageOverrides = pkgs: {
# Stolen from https://www.nijho.lt/post/llama-nixos/
llama-cpp =
(pkgs.llama-cpp.override {
cudaSupport = true;
rocmSupport = false;
metalSupport = false;
# Enable BLAS for optimized CPU layer performance (OpenBLAS)
# This is crucial for models using split-mode or CPU offloading
blasSupport = true;
}).overrideAttrs
(oldAttrs: rec {
version = "8940";
src = pkgs.fetchFromGitHub {
owner = "ggml-org";
repo = "llama.cpp";
tag = "b${version}";
# rev = "6ebf2e0d00d31acfc1a1fa9662e9a7d38bd07bf7"; # https://github.com/ggml-org/llama.cpp/pull/19970
hash = "sha256-JlJeNO7eID6JvxZMkck136mC/Rvd5v8320tAuQabzhU=";
leaveDotGit = true;
postFetch = ''
git -C "$out" rev-parse --short HEAD > $out/COMMIT
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};
# Must update npm deps hash to match the new version's webui dependencies
npmDepsHash = "sha256-RAFtsbBGBjteCt5yXhrmHL39rIDJMCFBETgzId2eRRk=";
# Enable native CPU optimizations for massively better CPU performance
# This enables AVX, AVX2, AVX-512, FMA, etc. for your specific CPU
# NOTE: This is intentionally opposite of nixpkgs (which uses -DGGML_NATIVE=off
# for reproducible builds). We sacrifice portability for faster CPU layers.
cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [
"-DGGML_NATIVE=ON"
"-DGGML_LTO=ON" # Link Time Optimization for overall binary speed
"-DCMAKE_CUDA_ARCHITECTURES=86" # RTX 3090
"-DGGML_CUDA=ON"
"-DGGML_CUDA_FA=ON" # FlashAttention kernels (accelerated attention)
"-DGGML_CUDA_FA_ALL_QUANTS=ON" # Support for all KV cache quant types in FA
"-DGGML_CUDA_GRAPHS=ON" # CUDA Graphs for lower overhead inference
"-DGGML_CUDA_FORCE_CUBLAS=ON" # cuBLAS optimized prompt processing for Ampere+
"-DGGML_CUDA_PEER_MAX_BATCH_SIZE=256" # Increased for multi-GPU efficiency (split mode)
"-DGGML_CUDA_COMPRESSION_MODE=speed" # Fast binary loading (CUDA 12.8+)
"-DGGML_OPENMP=ON" # Optimal multi-threading on CPU
"-DGGML_LLAMAFILE=ON" # Use llamafile sgemm for faster CPU layers
"-DGGML_CPU_REPACK=ON" # Optimize Q4_0 quant handling
"-DGGML_AVX=ON"
"-DGGML_AVX2=ON"
"-DGGML_FMA=ON"
"-DGGML_F16C=ON"
"-DGGML_AVX512=ON" # Intel AVX-512 extensions
"-DGGML_AVX512_VNNI=ON" # Vector Neural Network Instructions
"-DGGML_AVX512_BF16=ON" # Bfloat16 support
"-DGGML_AVX_VNNI=ON" # VNNI for processors without AVX-512
"-DGGML_AMX_TILE=ON" # Intel Advanced Matrix Extensions (Sapphire Rapids+)
"-DGGML_AMX_INT8=ON"
"-DGGML_AMX_BF16=ON"
"-DGGML_BLAS=ON" # Uses internal BLAS provided by Nix (blasSupport=true works)
];
postPatch = "";
# Disable Nix's NIX_ENFORCE_NO_NATIVE which strips -march=native flags
# See: https://github.com/NixOS/nixpkgs/issues/357736
# See: https://github.com/NixOS/nixpkgs/pull/377484 (intentionally contradicts this)
preConfigure = ''
export NIX_ENFORCE_NO_NATIVE=0
${oldAttrs.preConfigure or ""}
'';
});
# llama-swap from GitHub releases
llama-swap = pkgs.runCommand "llama-swap" { } ''
mkdir -p $out/bin
tar -xzf ${
pkgs.fetchurl {
url = "https://github.com/mostlygeek/llama-swap/releases/download/v190/llama-swap_190_linux_amd64.tar.gz";
hash = "sha256-WAfmJ4YiVH/UYq++l2Ut6oLqkd270HgG7eV+6FG/0Oc=";
}
} -C $out/bin
chmod +x $out/bin/llama-swap
'';
};
# 🇺🇸
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
@@ -57,7 +143,7 @@
jack.enable = true;
};
programs.adb.enable = true; # Bit heavy but you never know when you might need it...
# programs.adb.enable = true; # Bit heavy but you never know when you might need it...
users.users.laythe = {
isNormalUser = true;
@@ -110,15 +196,15 @@
environment.systemPackages = with pkgs; [
git
wget
wineWowPackages.stable # Heavy but really annoying to not have when you need it
wineWow64Packages.stable # Heavy but really annoying to not have when you need it
winetricks
gparted
unrar
electrum
# electrum
qpwgraph
libimobiledevice
ifuse
neofetch
fastfetch
gimp # Despite the fact it falls under creative an image editor is too important to leave out.
zip
xz
@@ -144,8 +230,27 @@
xmodmap
nixfmt
units
android-tools
jq
nasctui
trilium-desktop
haruna
(pkgs.runCommand "nvenc-compress" { nativeBuildInputs = [ pkgs.bash ]; }
''
mkdir -p $out/bin
cp ${./nvenc_compress.sh} $out/bin/nvenc-compress
chmod +x $out/bin/nvenc-compress
'')
];
fonts.packages = with pkgs; [
twitter-color-emoji
];
fonts.fontconfig.defaultFonts = {
emoji = [ "Twitter Color Emoji" ];
};
services.usbmuxd = {
enable = true;
package = pkgs.usbmuxd2;

View File

@@ -61,6 +61,7 @@
"Documents"
"Videos"
"nixos-configv3"
".config/cura"
{
directory = ".local/share/Steam";
mode = "0777";
@@ -92,5 +93,5 @@
];
};
};
users.users.laythe.hashedPasswordFile="/persistent/etc/passwdfile";
users.users.laythe.hashedPasswordFile = "/persistent/etc/passwdfile";
}

87
global/nvenc_compress.sh Executable file
View File

@@ -0,0 +1,87 @@
#!/usr/bin/env bash
set -euo pipefail
# Usage: nvenc_compress.sh <video_path> [target_size_mb]
VIDEO="$1"
TARGET_MB="${2:-9}"
TARGET_BYTES=$((TARGET_MB * 1024 * 1024))
if [[ ! -f "$VIDEO" ]]; then
echo "Error: file not found: $VIDEO"
exit 1
fi
BASENAME="${VIDEO##*/}"
BASENAME="${BASENAME%.*}"
OUTDIR="$(dirname "$VIDEO")"
OUTFILE="$OUTDIR/${BASENAME}_compressed.mp4"
# nvenc cq range: 0 (best/largest) to 51 (worst/smallest)
# We binary search this range to hit the target file size
LO=0
HI=51
BEST_DIFF=999999999
BEST_CQ=23
MAX_ITERATIONS=20
echo "Target size: ${TARGET_MB}MB (${TARGET_BYTES} bytes)"
echo "Encoding with nvenc (h264_nvenc)..."
echo ""
for ((i=0; i<MAX_ITERATIONS; i++)); do
CQ=$(( (LO + HI) / 2 ))
TMPFILE="${OUTFILE}_iter_${i}_cq${CQ}.mp4"
echo "--- Iteration $((i+1))/$MAX_ITERATIONS ---"
echo "Trying cq=$CQ (lo=$LO, hi=$HI)"
ffmpeg -y -i "$VIDEO" -c:v h264_nvenc -cq "$CQ" -c:a copy -preset p7 -f mp4 "$TMPFILE" 2>/dev/null
if [[ ! -f "$TMPFILE" ]]; then
echo "Error: ffmpeg failed at cq=$CQ"
rm -f "$TMPFILE"
break
fi
FILE_SIZE=$(stat -c%s "$TMPFILE" 2>/dev/null || stat -f%z "$TMPFILE" 2>/dev/null)
DIFF=$(( FILE_SIZE - TARGET_BYTES ))
ABS_DIFF=${DIFF#-}
echo " Size: $(( FILE_SIZE / 1024 / 1024 ))MB (diff: $(( DIFF / 1024 / 1024 ))MB)"
if (( ABS_DIFF < BEST_DIFF )); then
BEST_DIFF=$ABS_DIFF
BEST_CQ=$CQ
cp "$TMPFILE" "$OUTFILE"
fi
rm -f "$TMPFILE"
# If within 1% of target, we're close enough
if (( ABS_DIFF < TARGET_BYTES / 100 )); then
echo ""
echo "Within tolerance! Stopping."
break
fi
# Binary search direction:
# Higher cq = smaller file, lower cq = larger file
if (( FILE_SIZE > TARGET_BYTES )); then
# File too big, need higher cq (smaller)
LO=$(( CQ + 1 ))
else
# File too small, need lower cq (larger)
HI=$(( CQ - 1 ))
fi
if (( LO > HI )); then
echo ""
echo "Range exhausted. Stopping."
break
fi
done
echo ""
echo "Done! Best cq=$BEST_CQ, final size: $(( BEST_DIFF / 1024 / 1024 ))MB from target"
echo "Output: $OUTFILE"

View File

@@ -1,4 +1,4 @@
{...}:
{ ... }:
{
programs.bash = {
enable = true;
@@ -12,4 +12,4 @@
activate-linux = "echo Done!"; # I am a shitposter at heart
};
};
}
}

View File

@@ -6,6 +6,7 @@
config,
lib,
pkgs,
inputs,
...
}:
{
@@ -31,6 +32,8 @@
# Configure network connections interactively with nmcli or nmtui.
networking.networkmanager.enable = true;
virtualization.podman.enableNvidia = true;
# Only computer I own that can actually run ollama, and I don't want to make an ai folder.
# services.ollama = {
# enable = true;
@@ -39,10 +42,95 @@
# };
# This is here because I don't have another computer that could run local AI, and regardless the packages would be different on every one.
environment.systemPackages = with pkgs; [
ollama-cuda
# TODO: honestly, while I currently only have one pc that can run local AI, might change in the future.
# And this config is getting a bit complicated for a single pc config
# Should be moved to it's own shit
environment.systemPackages = [
pkgs.ollama-cuda
pkgs.opencode
pkgs.llama-cpp
pkgs.llama-swap
# pkgs.agent-browser
pkgs.nvidia-container-toolkit
inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.pi
inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.rtk
];
services.ollama = {
enable = true;
package = pkgs.ollama-cuda;
environmentVariables = {
OLLAMA_NUM_PARALLEL = "1";
OLLAMA_FLASH_ATTENTION = "1";
OLLAMA_KV_CACHE_TYPE = "q4_0";
OLLAMA_CONTEXT_LENGTH = "16384";
};
};
# Configure llama-swap as a systemd service
systemd.services.llama-swap = {
description = "llama-swap - OpenAI compatible proxy with automatic model swapping";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "laythe";
Group = "users";
# Point to your declarative config file
ExecStart = "${pkgs.llama-swap}/bin/llama-swap --config /etc/llama-swap/config.yaml --listen 0.0.0.0:9292 --watch-config";
Restart = "always";
RestartSec = 10;
# Environment for CUDA support
Environment = [
"PATH=/run/current-system/sw/bin"
"LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib"
];
};
};
# As long as this is here the models are declarative. llama-server will grab them if not downloaded already.
environment.etc."llama-swap/config.yaml".text = ''
models:
"Qwen3.6-35B-A3B-GGUF":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_S --ctx-size 128000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -np 1 --fit-target 256 --ubatch-size 1024 -fa on --slots --slot-save-path /home/laythe/llamapcache --jinja -kvu --no-mmproj --swa-checkpoints 32 --chat-template-kwargs '{\"preserve_thinking\": true}'"
ttl: 2400
"Qwen3.6-35B-A3B-FLASH":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q3_K_M --ctx-size 128000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -np 1 --fit-target 256 --ubatch-size 1024 -fa on --slots --slot-save-path /home/laythe/llamapcache --jinja -kvu --no-mmproj --swa-checkpoints 32 --chat-template-kwargs '{\"preserve_thinking\": true}'"
ttl: 2400
"Qwen3.5-35B-A3B-GGUF":
cmd: llama-server --port ''${PORT} -hf mudler/Qwen3.5-35B-A3B-APEX-GGUF:Mini --ctx-size 128000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -np 1 --fit-target 256 --ubatch-size 1024 -fa on --slots --slot-save-path /home/laythe/llamapcache --jinja -kvu --no-mmproj --swa-checkpoints 32 --no-kv-offload
ttl: 2400
"Gemma4-26B-A4B":
cmd: llama-server --port ''${PORT} -hf mudler/gemma-4-26B-A4B-it-heretic-APEX-GGUF:Mini --ctx-size 128000 --temp 1.0 --top-p 0.95 --top-k 64 --min-p 0.00 -np 1 --fit-target 256 --ubatch-size 1024 -fa on --slots --slot-save-path /home/laythe/llamapcache --jinja -kvu --no-mmproj --swa-checkpoints 32 --no-kv-offload
ttl: 2400
"Qwen3-1.7B-GGUF":
cmd: llama-server --port ''${PORT} -hf unsloth/Qwen3-1.7B-GGUF:Q4_K_S --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu
ttl: 300
"Qwen3-8B-GGUF":
cmd: llama-server --port ''${PORT} -hf unsloth/Qwen3-8B-GGUF:Q4_K_S --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1
ttl: 300
"Qwen3-4B-Claude-Opus-Distill":
cmd: llama-server --port ''${PORT} -hf TeichAI/Qwen3-4B-Thinking-2507-Claude-4.5-Opus-High-Reasoning-Distill-GGUF:Q4_K_M --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256
ttl: 300
"Qwen3.5-9B":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-9B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 300
"Qwen3.5-9B-Claude-Opus-Distill":
cmd: "llama-server --port ''${PORT} -hf Jackrong/Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-GGUF:Q4_K_S --ctx-size 32000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 512 --chat-template-kwargs '{\"enable_thinking\": true}' --no-mmproj"
ttl: 300
"Qwen3.5-4B":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-4B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 300
"Gemma4-E4B":
cmd: "llama-server --port ''${PORT} -hf Abhiray/gemma-4-E4B-it-heretic-GGUF:Q4_K_M --ctx-size 64000 --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 300
"Qwen3.5-0.8B-Non-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-0.8B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 300'';
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
@@ -113,7 +201,7 @@
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you

View File

@@ -93,10 +93,10 @@
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
nix.settings = {
substituters = [ "https://cache.nixos-cuda.org" ];
trusted-public-keys = [ "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=" ];
};
# nix.settings = {
# substituters = [ "https://cache.nixos-cuda.org" ];
# trusted-public-keys = [ "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=" ];
# };
system.stateVersion = "24.11"; # No touchy
}

View File

@@ -1,4 +1,11 @@
{config, pkgs, lib, inputs, outputs, ...}:
{
config,
pkgs,
lib,
inputs,
outputs,
...
}:
{
# These both are probably always going to be the same, but I'll keep them local just in case:tm:
home.username = "laythe";
@@ -11,4 +18,6 @@
home.stateVersion = "24.11";
programs.home-manager.enable = true;
}
fonts.fontconfig.subpixelRendering = "none";
}

View File

@@ -0,0 +1,138 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
lib,
pkgs,
inputs,
...
}:
{
imports = [
./hardware-configuration.nix
../../global/default.nix
../../modules/communication/default.nix
../../modules/creative/default.nix
../../modules/development/default.nix
../../modules/fabrication/default.nix
../../modules/gaming/default.nix
../../modules/sway/default.nix
../../modules/virtualization/default.nix
# ../../modules/vr/default.nix
# ../../global/eraseyourdarlings.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
# boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "latitude"; # Define your hostname.
# Configure network connections interactively with nmcli or nmtui.
networking.networkmanager.enable = true;
# Only computer I own that can actually run ollama, and I don't want to make an ai folder.
# services.ollama = {
# enable = true;
# acceleration = "cuda";
# host = "[::]";
# };
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# services.xserver.enable = true; # On anything else modern this should be false.
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
# programs.firefox.enable = true;
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
environment.systemPackages = [
inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.pi
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "25.11"; # Did you read the comment?
}

View File

@@ -0,0 +1,86 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
# services.tlp.enable = true;
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
boot.resumeDevice = "/dev/disk/by-label/NIXSWAP";
fileSystems."/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
swapDevices = [
{
device = "/dev/disk/by-label/NIXSWAP";
}
];
services.power-profiles-daemon.enable = true;
# Suspend first then hibernate when closing the lid
services.logind.settings.Login.LidSwitch = "ignore";
# Hibernate on power button pressed
services.logind.settings.Login.PowerKey = "hibernate";
services.logind.settings.Login.PowerKeyLongPress = "poweroff";
# Suspend first
boot.kernelParams = [
"mem_sleep_default=deep"
];
# Define time delay for hibernation
systemd.sleep.settings.Sleep = {
HibernateDelaySec = 300;
};
# facial recognition
security.pam.howdy.enable = true;
services.howdy.enable = true;
services.linux-enable-ir-emitter.enable = true; # lmao
# by default face is good enough
security.pam.howdy.control = "sufficient";
services.howdy.settings = {
core = {
workaround = "off";
};
video = {
timeout = "20";
};
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

23
machines/latitude/home.nix Executable file
View File

@@ -0,0 +1,23 @@
{
config,
pkgs,
lib,
inputs,
outputs,
...
}:
{
# These both are probably always going to be the same, but I'll keep them local just in case:tm:
home.username = "laythe";
home.homeDirectory = lib.mkForce "/home/laythe";
imports = [
../../home/default.nix
../../modules/sway/home.nix
# ../../modules/kde/home.nix
];
home.stateVersion = "25.11";
programs.home-manager.enable = true;
}

View File

@@ -87,10 +87,9 @@
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
# environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
# ];
environment.systemPackages = with pkgs; [
cura-appimage # I want cura but not kicad so i dont pull in fabrication
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.

View File

@@ -19,40 +19,53 @@
"btrfs"
];
boot.initrd.kernelModules = [ "btrfs" ];
boot.kernelModules = [ "kvm-intel" "btrfs" ];
boot.kernelModules = [
"kvm-intel"
"btrfs"
];
boot.extraModulePackages = [ ];
boot.supportedFilesystems = [ "btrfs" ];
fileSystems."/" = {
device = "/dev/disk/by-label/BUTTER";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=root" ];
options = [
"compress=zstd"
"subvol=root"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/BUTTER";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=home" ];
};
# fileSystems."/home" = {
# device = "/dev/disk/by-label/BUTTER";
# fsType = "btrfs";
# options = [ "compress=zstd" "subvol=home" ];
# };
fileSystems."/nix" = {
# device = "/dev/disk/by-uuid/3c89fa92-1d43-4c48-b228-e2725fa70ee9";
device = "/dev/disk/by-label/BUTTER";
fsType = "btrfs";
options = [ "compress=zstd" "noatime" "subvol=nix" ];
options = [
"compress=zstd"
"noatime"
"subvol=nix"
];
};
# fileSystems."/swap" = {
# device = "/dev/disk/by-label/BUTTER";
# fsType = "btrfs";
# options = [ "noatime" "subvol=swap" ];
# };
# fileSystems."/swap" = {
# device = "/dev/disk/by-label/BUTTER";
# fsType = "btrfs";
# options = [ "noatime" "subvol=swap" ];
# };
fileSystems."/persistent" = {
device = "/dev/disk/by-label/BUTTER";
fsType = "btrfs";
neededForBoot = true;
options = [ "compress=zstd" "subvol=persist" ];
options = [
"compress=zstd"
"subvol=persist"
];
};
fileSystems."/boot" = {
@@ -64,17 +77,56 @@
];
};
# fileSystems = {
# "/".options = [ "compress=zstd" ];
# "/home".options = [ "compress=zstd" ];
# "/persist".options = [ "compress=zstd" ];
# "/nix".options = [ "compress=zstd" "noatime" ];
# "/swap".options = [ "noatime" ];
# };
# fileSystems = {
# "/".options = [ "compress=zstd" ];
# "/home".options = [ "compress=zstd" ];
# "/persist".options = [ "compress=zstd" ];
# "/nix".options = [ "compress=zstd" "noatime" ];
# "/swap".options = [ "noatime" ];
# };
# swapDevices = [
# { device = "/swap/swapfile"; }
# ];
# swapDevices = [
# { device = "/swap/swapfile"; }
# ];
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View File

@@ -1,4 +1,11 @@
{config, pkgs, lib, inputs, outputs, ...}:
{
config,
pkgs,
lib,
inputs,
outputs,
...
}:
{
# These both are probably always going to be the same, but I'll keep them local just in case:tm:
home.username = "laythe";
@@ -6,9 +13,10 @@
imports = [
../../home/default.nix
../../modules/kde/home.nix
];
home.stateVersion = "25.11";
home.stateVersion = "24.11";
programs.home-manager.enable = true;
}

View File

@@ -5,5 +5,6 @@
jami
element-desktop
signal-desktop
praat
];
}

View File

@@ -1,9 +1,11 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
blender
# davinci-resolve
shotcut
glaxnimate
kdePackages.kdenlive
krita
];
}
}

View File

@@ -1,7 +1,24 @@
{pkgs, ...}:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
vscode
antigravity # Free Gemini 3 credits was too good of an offer to not take up, even if it requires selling my soul.
chromium
];
}
home-manager.sharedModules = [
(
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
jnoortheen.nix-ide
];
userSettings = {
"editor.formatOnSave" = true;
};
};
}
)
];
}

View File

@@ -1,7 +1,7 @@
{pkgs, ...}:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
kicad
cura
# cura
];
}
}

View File

@@ -1,10 +1,11 @@
{pkgs, environment, ...}:
{ pkgs, environment, ... }:
{
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
protontricks.enable = true;
};
environment.systemPackages = with pkgs; [
@@ -13,4 +14,4 @@
lutris
prismlauncher
];
}
}

View File

@@ -8,8 +8,22 @@
programs.kdeconnect.enable = true;
environment.systemPackages = with pkgs; [
firefox # Odd spot, but my choice of browser is determined by environment.
kdePackages.kate
kdePackages.filelight
thunderbird
# kdePackages.kdeconnect-kde
];
programs.firefox = {
enable = true;
policies.ExtensionSettings = {
# uBlock Origin:
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
};
};
services.automatic-timezoned.enable = true;
}

97
modules/kde/home.nix Executable file
View File

@@ -0,0 +1,97 @@
{ pkgs, ... }:
{
programs.plasma = {
enable = true;
workspace = {
lookAndFeel = "org.kde.breezedark.desktop";
};
panels = [
# Windows-like panel at the bottom
{
location = "bottom";
widgets = [
# We can configure the widgets by adding the name and config
# attributes. For example to add the the kickoff widget and set the
# icon to "nix-snowflake-white" use the below configuration. This will
# add the "icon" key to the "General" group for the widget in
# ~/.config/plasma-org.kde.plasma.desktop-appletsrc.
{
name = "org.kde.plasma.kickoff";
config = {
General = {
icon = "nix-snowflake-white";
alphaSort = true;
};
};
}
# Or you can configure the widgets by adding the widget-specific options for it.
# See modules/widgets for supported widgets and options for these widgets.
# For example:
# {
# kickoff = {
# sortAlphabetically = true;
# icon = "nix-snowflake-white";
# };
# }
# Adding configuration to the widgets can also for example be used to
# pin apps to the task-manager, which this example illustrates by
# pinning dolphin and konsole to the task-manager by default with widget-specific options.
# {
# iconTasks = {
# launchers = [
# "applications:org.kde.dolphin.desktop"
# "applications:org.kde.konsole.desktop"
# ];
# };
# }
# Or you can do it manually, for example:
{
name = "org.kde.plasma.icontasks";
config = {
General = {
launchers = [
"applications:org.kde.dolphin.desktop"
"applications:org.kde.konsole.desktop"
];
};
};
}
# If no configuration is needed, specifying only the name of the
# widget will add them with the default configuration.
"org.kde.plasma.marginsseparator"
# If you need configuration for your widget, instead of specifying the
# the keys and values directly using the config attribute as shown
# above, plasma-manager also provides some higher-level interfaces for
# configuring the widgets. See modules/widgets for supported widgets
# and options for these widgets. The widgets below shows two examples
# of usage, one where we add a digital clock, setting 12h time and
# first day of the week to Sunday and another adding a systray with
# some modifications in which entries to show.
{
digitalClock = {
calendar.firstDayOfWeek = "monday";
time.format = "12h";
};
}
{
systemTray.items = {
# We explicitly show bluetooth and battery
shown = [
"org.kde.plasma.battery"
"org.kde.plasma.networkmanagement"
"org.kde.plasma.volume"
];
# And explicitly hide networkmanagement and volume
hidden = [
# "org.kde.plasma.networkmanagement"
# "org.kde.plasma.volume"
"org.kde.plasma.bluetooth"
];
};
}
];
hiding = "none";
}
];
};
}

77
modules/sway/default.nix Normal file
View File

@@ -0,0 +1,77 @@
{
config,
pkgs,
lib,
inputs,
...
}:
let
configure-gtk = pkgs.writeTextFile {
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text =
let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in
''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
};
in
{
environment.systemPackages = with pkgs; [
wl-clipboard # Copy/Paste functionality.
mako # Notification utility.
];
# Enables Gnome Keyring to store secrets for applications.
services.gnome.gnome-keyring.enable = true;
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-wlr
];
};
security.polkit.enable = true;
# Enable Sway.
programs.sway = {
enable = true;
wrapperFeatures.gtk = false;
extraPackages = [
pkgs.foot
pkgs.swayidle
pkgs.swaylock
pkgs.wmenu
pkgs.wl-clipboard
pkgs.mako
pkgs.kdePackages.kate
pkgs.kdePackages.filelight
inputs.glide.packages.${pkgs.stdenv.hostPlatform.system}.default
pkgs.swaybg
pkgs.pulseaudioFull
pkgs.waybar
pkgs.dracula-theme # gtk theme
pkgs.brightnessctl
configure-gtk
pkgs.mpvpaper
];
};
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --remember --time --cmd sway";
user = "greeter";
};
};
};
}

354
modules/sway/home.nix Normal file
View File

@@ -0,0 +1,354 @@
{ pkgs, ... }:
{
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true; # Fixes common issues with GTK 3 apps
config = rec {
modifier = "Mod4";
# Use kitty as default terminal
terminal = "foot";
keybindings = {
# Brightness Controls
"XF86MonBrightnessDown" = "exec brightnessctl s 5%-";
"XF86MonBrightnessUp" = "exec brightnessctl s 5%+";
# Volume Controls
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +1%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -1%";
"XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
"Mod4+q" = "kill";
"Mod4+Return" = "exec foot";
"Mod4+Shift+q" = "kill";
"Mod4+d" = "exec wmenu-run";
"Mod4+Left" = "focus left";
"Mod4+Down" = "focus down";
"Mod4+Up" = "focus up";
"Mod4+Right" = "focus right";
"Mod4+Shift+Left" = "move left";
"Mod4+Shift+Down" = "move down";
"Mod4+Shift+Up" = "move up";
"Mod4+Shift+Right" = "move right";
"Mod4+b" = "splith";
"Mod4+v" = "splitv";
"Mod4+f" = "fullscreen toggle";
"Mod4+a" = "focus parent";
"Mod4+s" = "layout stacking";
"Mod4+w" = "layout tabbed";
"Mod4+e" = "layout toggle split";
"Mod4+Shift+space" = "floating toggle";
"Mod4+space" = "focus mode_toggle";
"Mod4+1" = "workspace number 1";
"Mod4+2" = "workspace number 2";
"Mod4+3" = "workspace number 3";
"Mod4+4" = "workspace number 4";
"Mod4+5" = "workspace number 5";
"Mod4+6" = "workspace number 6";
"Mod4+7" = "workspace number 7";
"Mod4+8" = "workspace number 8";
"Mod4+9" = "workspace number 9";
"Mod4+0" = "workspace number 10";
"Mod4+Shift+1" = "move container to workspace number 1";
"Mod4+Shift+2" = "move container to workspace number 2";
"Mod4+Shift+3" = "move container to workspace number 3";
"Mod4+Shift+4" = "move container to workspace number 4";
"Mod4+Shift+5" = "move container to workspace number 5";
"Mod4+Shift+6" = "move container to workspace number 6";
"Mod4+Shift+7" = "move container to workspace number 7";
"Mod4+Shift+8" = "move container to workspace number 8";
"Mod4+Shift+9" = "move container to workspace number 9";
"Mod4+Shift+0" = "move container to workspace number 10";
"Mod4+Shift+minus" = "move scratchpad";
"Mod4+minus" = "scratchpad show";
"Mod4+p" = "[app_id=\"trilium\"] scratchpad show, resize set 90 ppt 90 ppt, move position center";
"Mod4+g" = "exec glide-browser";
"Mod4+Shift+i" = "exec makoctl invoke && makoctl dismiss";
"Mod4+i" = "exec makoctl dismiss";
"Mod4+Shift+c" = "reload";
"Mod4+Shift+e" =
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"Mod4+r" = "mode resize";
"Mod4+c" = "[app_id=\"discord\"] scratchpad show, resize set 90 ppt 90 ppt, move position center";
"Mod4+j" = "[class=\"Jami\"] scratchpad show, resize set 90 ppt 90 ppt, move position center";
"Print" = "exec flameshot gui";
};
bars = [
{
command = "${pkgs.waybar}/bin/waybar";
}
];
output = {
eDP-1 = {
scale = "1.25";
};
};
input = {
"type:touchpad" = {
# Enables or disables tap for specified input device.
tap = "enabled";
# Enables or disables natural (inverted) scrolling for the specified input device.
natural_scroll = "enabled";
# Enables or disables disable-while-typing for the specified input device.
dwt = "disabled";
};
};
bindswitches = {
"lid:on" = {
reload = true;
locked = true;
action = "exec systemctl suspend-then-hibernate";
};
};
startup = [
# { command = "swaybg -i ~/.background-image -m fill"; }
{ command = "discord --enable-features=UseOzonePlatform --ozone-platform=wayland"; }
{ command = "trilium"; }
{ command = "jami"; }
];
window.commands = [
{
criteria = {
app_id = "discord";
};
command = "move scratchpad";
}
{
criteria = {
app_id = "trilium";
};
command = "move scratchpad";
}
{
criteria = {
class = "Jami";
};
command = "move scratchpad";
}
];
};
};
systemd.user.services.random-background = {
Unit = {
Description = "Universal Wallpaper Rotator (Images, GIFs, Videos)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
Restart = "on-failure";
RestartSec = 5;
ExecStart = "${pkgs.writeShellScript "wallpaper-rotator" ''
WALLPAPER_DIR="$HOME/wallpapers"
INTERVAL=60 # Time in seconds between wallpaper changes (600 = 10 mins)
# 1. Safely find Wayland and Sway sockets
if [ -z "$WAYLAND_DISPLAY" ]; then
shopt -s nullglob
W_SOCKETS=("$XDG_RUNTIME_DIR"/wayland-[0-9]*)
if [ ''${#W_SOCKETS[@]} -gt 0 ]; then
export WAYLAND_DISPLAY=$(basename "''${W_SOCKETS[0]}")
fi
fi
if [ -z "$SWAYSOCK" ]; then
shopt -s nullglob
S_SOCKETS=("$XDG_RUNTIME_DIR"/sway-ipc.*.sock)
if [ ''${#S_SOCKETS[@]} -gt 0 ]; then
export SWAYSOCK="''${S_SOCKETS[0]}"
fi
fi
# State tracking for mpvpaper
MPV_PID=""
# Clean up mpvpaper gracefully if systemd stops the service
cleanup() {
if [ -n "$MPV_PID" ]; then
kill $MPV_PID 2>/dev/null || true
fi
exit 0
}
trap cleanup SIGINT SIGTERM
# 2. Infinite rotation loop
while true; do
if [ ! -d "$WALLPAPER_DIR" ]; then
echo "Wallpaper directory not found. Waiting..."
${pkgs.coreutils}/bin/sleep 60
continue
fi
# Find images, gifs, and videos
MEDIA=$(${pkgs.findutils}/bin/find "$WALLPAPER_DIR" -type f \( \
-iname \*.jpg -o -iname \*.jpeg -o -iname \*.png -o \
-iname \*.mp4 -o -iname \*.webm -o -iname \*.mkv -o -iname \*.gif \
\) 2>/dev/null | ${pkgs.coreutils}/bin/shuf -n 1 || true)
if [ -n "$MEDIA" ]; then
echo "Selected: $MEDIA"
EXT="''${MEDIA##*.}"
EXT=$(echo "$EXT" | tr '[:upper:]' '[:lower:]') # Convert to lowercase
# If it's a static image, use Sway directly (saves battery/RAM)
if [[ "$EXT" == "jpg" || "$EXT" == "jpeg" || "$EXT" == "png" ]]; then
if [ -n "$MPV_PID" ]; then
kill $MPV_PID 2>/dev/null || true
MPV_PID=""
fi
${pkgs.sway}/bin/swaymsg output "*" bg "$MEDIA" fill
# If it's a video/gif, use mpvpaper
else
if [ -n "$MPV_PID" ]; then
kill $MPV_PID 2>/dev/null || true
fi
# Start mpvpaper in the background and record its process ID
${pkgs.mpvpaper}/bin/mpvpaper -o "loop no-audio" "*" "$MEDIA" &
MPV_PID=$!
fi
else
echo "No media found in $WALLPAPER_DIR."
fi
# Wait for the next rotation
${pkgs.coreutils}/bin/sleep $INTERVAL
done
''}";
};
};
programs.waybar = {
enable = true;
style = ./waybar.css;
settings = {
mainBar = {
layer = "top";
position = "bottom"; # Puts the bar at the bottom
height = 30;
# Define what goes where on the bar
modules-left = [
"sway/workspaces"
"sway/mode"
];
modules-center = [ "sway/window" ];
modules-right = [
"backlight"
"pulseaudio"
"battery"
"clock"
"tray"
];
backlight = {
format = "{icon} {percent}%";
format-icons = [
"🌑"
"🌘"
"🌗"
"🌖"
"🌕"
];
};
pulseaudio = {
format = "{icon} {volume}%";
format-muted = "🔇 Muted";
format-icons = {
default = [
"🔈"
"🔉"
"🔊"
];
};
scroll-step = 1;
on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
clock = {
"format" = "{:%I:%M %p}";
"format-alt" = "{:%d-%m-%Y}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}% ({time})";
format-charging = " {capacity}% ({time})";
format-plugged = "🔌 {capacity}% ({time})";
format-icons = [
"🪫"
"🔋"
"🔋"
"🔋"
"🔋"
];
};
};
};
};
services.swayidle.events = {
"before-sleep" = "${pkgs.swaylock}/bin/swaylock -fF";
};
services.swayidle.enable = true;
# Configure Qt to use kvantum theming
qt = {
enable = true;
platformTheme.name = "org.kde.breezedark.desktop";
style = {
name = "org.kde.breezedark.desktop";
};
};
services.flameshot = {
# Also installs/enables flameshot
enable = true;
settings = {
General = {
useGrimAdapter = true;
# Stops warnings for using Grim
disabledGrimWarning = true;
uiColor = "#00ff73";
contrastUiColor = "#002f01";
drawColor = "#ff0000";
};
};
};
# Install packages for better Qt support and kvantum themes
home.packages = with pkgs; [
kdePackages.breeze
];
# Environment variables for kvantum theming
home.sessionVariables = {
QT_QPA_PLATFORMTHEME = "org.kde.breezedark.desktop";
QT_STYLE_OVERRIDE = "org.kde.breezedark.desktop";
GTK_THEME = "Materia-dark-compact";
};
}

329
modules/sway/waybar.css Normal file
View File

@@ -0,0 +1,329 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused,
#workspaces button.active {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left>widget:first-child>#workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right>widget:last-child>#workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging,
#battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray>.passive {
-gtk-icon-effect: dim;
}
#tray>.needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state>label {
padding: 0 5px;
}
#keyboard-state>label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}

View File

@@ -1,4 +1,4 @@
{pkgs, ...}:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
qemu
@@ -6,7 +6,7 @@
];
programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["laythe"];
users.groups.libvirtd.members = [ "laythe" ];
virtualisation.libvirtd.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd.qemu.swtpm.enable = true;
@@ -14,5 +14,6 @@
virtualisation.podman = {
enable = true;
dockerCompat = true;
# enableNvidia = true;
};
}
}