Files
nixos-configv3/global/default.nix

217 lines
5.5 KiB
Nix
Executable File

# This is for global config I DEFINITELY want on all machines, this should only include basic utilities and be relatively small.
# There is no order for where things are in this, it's a little messy.
{ pkgs, nix-flatpak, ... }:
{
imports = [
# nix-flatpak.nixosModules.nix-flatpak
];
# Lix
nixpkgs.overlays = [
(final: prev: {
inherit (prev.lixPackageSets.stable)
nixpkgs-review
nix-eval-jobs
nix-fast-build
colmena
;
})
];
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 = "8179";
src = pkgs.fetchFromGitHub {
owner = "ggml-org";
repo = "llama.cpp";
tag = "b${version}";
hash = "sha256-LzJfbw4Xl3ktaLmys1Y2a6Ncthjb/DjS9qKrdcHE2+Q=";
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-FKjoZTKm0ddoVdpxzYrRUmTiuafEfbKc4UD2fz2fb8A=";
# 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"
"-DCMAKE_CUDA_ARCHITECTURES=86" # RTX 3090 - needed since sandbox has no GPU
];
# 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 = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# TODO: Look and find out if there's a better way to configure printers, my Brother needs to be reconnected every boot :/
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
publish = {
enable = true;
userServices = true;
};
};
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
# programs.adb.enable = true; # Bit heavy but you never know when you might need it...
users.users.laythe = {
isNormalUser = true;
description = "laythe";
extraGroups = [
"networkmanager"
"wheel"
"docker"
"adbusers"
"jackaudio"
"podman"
];
#To make podman work
subUidRanges = [
{
startUid = 100000;
count = 65536;
}
];
subGidRanges = [
{
startGid = 100000;
count = 65536;
}
];
};
programs.appimage = {
enable = true;
binfmt = true;
package = pkgs.appimage-run.override {
extraPkgs = pkgs: [
];
};
};
services.flatpak.enable = true;
programs.nix-ld.enable = true;
nixpkgs.config.allowUnfree = true;
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "daily"; # Maybe the solution is to buy more storage for my devices :p
options = "--delete-older-than 3d";
};
environment.systemPackages = with pkgs; [
git
wget
wineWow64Packages.stable # Heavy but really annoying to not have when you need it
winetricks
gparted
unrar
# electrum
qpwgraph
libimobiledevice
ifuse
neofetch
gimp # Despite the fact it falls under creative an image editor is too important to leave out.
zip
xz
unzip
p7zip
dnsutils
file
which
tree
gnused
gnutar
gawk
zstd
lsof
sysstat
lm_sensors
ethtool
pciutils # lspci
usbutils # lsusb
ffmpeg-full
xbindkeys
xdotool
xmodmap
nixfmt
units
android-tools
];
services.usbmuxd = {
enable = true;
package = pkgs.usbmuxd2;
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}