This commit is contained in:
alsaiduq-lab 2025-06-30 21:21:44 -06:00
parent de4b14a35d
commit 37346c49e0
23 changed files with 12 additions and 39 deletions

21
hosts/modules/audio.nix Normal file
View file

@ -0,0 +1,21 @@
{pkgs, ...}: {
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
};
environment.systemPackages = with pkgs; [
cava
pulseaudio
alsa-utils
portaudio
alsa-lib
pavucontrol
clang
];
}

View file

@ -0,0 +1,15 @@
{pkgs, ...}: {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
environment.systemPackages = with pkgs; [
blueman
];
}

30
hosts/modules/boot.nix Normal file
View file

@ -0,0 +1,30 @@
{pkgs, ...}: {
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 5;
};
efi.canTouchEfiVariables = true;
timeout = 5;
};
tmp = {
cleanOnBoot = true;
};
kernelPackages = pkgs.linuxPackages_xanmod_latest;
};
system.activationScripts.binbash = {
deps = [];
text = ''
mkdir -p /bin
if [ ! -e /bin/bash ]; then
ln -sf ${pkgs.bash}/bin/bash /bin/bash
fi
mkdir -p /usr/bin
if [ ! -e /usr/bin/env ]; then
ln -sf ${pkgs.coreutils}/bin/env /usr/bin/env
fi
'';
};
}

6
hosts/modules/cups.nix Normal file
View file

@ -0,0 +1,6 @@
{pkgs, ...}: {
services.printing = {
enable = true;
drivers = with pkgs; [cups-filters];
};
}

13
hosts/modules/docker.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, ...}: {
virtualisation.docker = {
enable = true;
enableOnBoot = true;
autoPrune.enable = true;
};
environment.systemPackages = with pkgs; [
docker
docker-compose
lazydocker
];
}

59
hosts/modules/env.nix Normal file
View file

@ -0,0 +1,59 @@
{
pkgs,
lib,
...
}: {
environment.shellInit = ''
if [ -d "$HOME/.cargo/bin" ]; then
export PATH="$PATH:$HOME/.cargo/bin"
fi
if [ -d "$HOME/.npm-global/bin" ]; then
export PATH="$PATH:$HOME/.npm-global/bin"
fi
'';
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERM = "ghostty";
CC = "${pkgs.gcc}/bin/gcc";
LUA_PATH = "${pkgs.luajit}/share/lua/5.1/?.lua;${pkgs.luajit}/share/lua/5.1/?/init.lua;;";
LUA_CPATH = "${pkgs.luajit}/lib/lua/5.1/?.so;;";
PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" [
pkgs.mesa
pkgs.openssl.dev
pkgs.libxml2.dev
pkgs.zlib.dev
pkgs.portaudio
pkgs.alsa-lib
pkgs.stdenv.cc.cc
pkgs.xorg.libX11.dev
pkgs.xorg.libXtst
pkgs.xorg.libXi.dev
];
LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.libglvnd
pkgs.mesa
pkgs.gcc-unwrapped.lib
pkgs.linuxPackages.nvidia_x11
pkgs.cudatoolkit
pkgs.mangohud
pkgs.portaudio
pkgs.alsa-lib
pkgs.stdenv.cc.cc.lib
pkgs.xorg.libX11
pkgs.xorg.libXtst
pkgs.xorg.libXi
pkgs.glib
];
};
environment.pathsToLink = [
"/share/fish"
"/bin"
];
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

26
hosts/modules/fonts.nix Normal file
View file

@ -0,0 +1,26 @@
{pkgs, ...}: {
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
nerd-fonts._0xproto
nerd-fonts.noto
nerd-fonts.symbols-only
ipafont
kochi-substitute
clear-sans
binary-font
];
fontconfig = {
enable = true;
defaultFonts = {
monospace = ["0xProto Nerd Font" "Noto Sans Mono CJK JP"];
sansSerif = ["Clear Sans" "Noto Sans CJK JP"];
serif = ["Noto Serif" "Noto Serif CJK JP"];
emoji = ["Noto Color Emoji"];
};
};
};
}

224
hosts/modules/i3-xfce.nix Normal file
View file

@ -0,0 +1,224 @@
{pkgs, ...}: let
wallpaperDir = "/home/cobray/wallpapers";
randomWallpaper = pkgs.writeShellScript "wallpaper.sh" ''
#!${pkgs.runtimeShell}
set -e
BG_DIR="/var/lib/lightdm-background"
BG_LINK="$BG_DIR/random-wallpaper.png"
LAST_WALLPAPER="$BG_DIR/.last-wallpaper"
WALLPAPER_DIR="${wallpaperDir}"
mkdir -p "$BG_DIR"
rm -f "$BG_LINK"
mapfile -t WALLPAPERS < <(${pkgs.findutils}/bin/find "$WALLPAPER_DIR" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \))
COUNT=''${#WALLPAPERS[@]}
if [[ "$COUNT" -eq 0 ]]; then
cp -f "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" "$BG_LINK"
echo "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" > "$LAST_WALLPAPER"
chown lightdm:lightdm "$BG_LINK" "$LAST_WALLPAPER"
exit 0
fi
RAND=$(${pkgs.coreutils}/bin/shuf -i 0-$(($COUNT - 1)) -n 1)
SELECT=''${WALLPAPERS[$RAND]}
cp -f "$SELECT" "$BG_LINK"
echo "$SELECT" > "$LAST_WALLPAPER"
chown lightdm:lightdm "$BG_LINK" "$LAST_WALLPAPER"
'';
in {
services.xserver.enable = true;
services.xserver.xkb = {
layout = "us";
variant = "";
};
services.xserver.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
extraPackages = with pkgs; [
dmenu
i3status
i3lock-color
i3blocks
picom
feh
rofi
dunst
polybar
i3-auto-layout
xsettingsd
mpv
yt-dlp
flameshot
imagemagick
slop
ghostscript
];
extraSessionCommands = ''
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
fi
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface gtk-theme "Tokyonight-Dark"
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface icon-theme "candy-icons"
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface cursor-theme "capitaine-cursors"
cat > $HOME/.config/xsettingsd << EOF
Net/ThemeName "Tokyonight-Dark"
Net/IconThemeName "candy-icons"
Gtk/CursorThemeName "capitaine-cursors"
EOF
killall xsettingsd || true
${pkgs.xsettingsd}/bin/xsettingsd &
'';
};
services.xserver.desktopManager.xfce = {
enable = true;
noDesktop = true;
enableXfwm = false;
};
services.xserver.displayManager.lightdm = {
enable = true;
background = "/var/lib/lightdm-background/random-wallpaper.png";
greeters.gtk = {
enable = true;
theme = {
package = pkgs.tokyonight-gtk-theme;
name = "Tokyonight-Dark";
};
iconTheme = {
package = pkgs.candy-icons;
name = "candy-icons";
};
cursorTheme = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors";
};
extraConfig = ''
[greeter]
greeting = Welcome back, Traveller
font-name=Clear Sans 10
cursor-theme-name=capitaine-cursors
icon-theme-name=candy-icons
'';
};
};
systemd.tmpfiles.rules = [
"d /var/lib/lightdm-background 0755 lightdm lightdm - -"
"d ${wallpaperDir} 0755 cobray users - -"
"f /var/log/random-wallpaper.log 0644 root root - -"
];
systemd.services.random-wallpaper = {
description = "Update wallpaper to a random image";
before = ["display-manager.service"];
wantedBy = ["display-manager.service"];
serviceConfig = {
Type = "oneshot";
ExecStart = "${randomWallpaper}";
User = "root";
};
};
systemd.timers.random-wallpaper = {
description = "Daily wallpaper refresh for LightDM";
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
};
services.displayManager.defaultSession = "xfce+i3";
services.displayManager.autoLogin = {
enable = true;
user = "cobray";
};
qt = {
enable = true;
platformTheme = "qt5ct";
};
environment.etc = {
"gtk-2.0/gtkrc".text = ''
gtk-theme-name="Tokyonight-Dark"
gtk-icon-theme-name="candy-icons"
gtk-font-name="Clear Sans 10"
gtk-cursor-theme-name="capitaine-cursors"
gtk-cursor-theme-size=24
'';
"gtk-3.0/settings.ini".text = ''
[Settings]
gtk-application-prefer-dark-theme=1
gtk-theme-name=Tokyonight-Dark
gtk-icon-theme-name=candy-icons
gtk-font-name=Clear Sans 10
gtk-cursor-theme-name=capitaine-cursors
gtk-cursor-theme-size=24
'';
"gtk-4.0/settings.ini".text = ''
[Settings]
gtk-application-prefer-dark-theme=1
gtk-theme-name=Tokyonight-Dark
gtk-icon-theme-name=candy-icons
gtk-font-name=Clear Sans 10
gtk-cursor-theme-name=capitaine-cursors
gtk-cursor-theme-size=24
'';
};
environment.systemPackages = with pkgs; [
arandr
xclip
lxappearance
gsettings-desktop-schemas
adwaita-qt
candy-icons
capitaine-cursors
tokyonight-gtk-theme
xsettingsd
hicolor-icon-theme
adwaita-icon-theme
kdePackages.breeze-icons
gnome-themes-extra
findutils
coreutils
feh
];
environment.pathsToLink = [
"/share/icons"
"/share/pixmaps"
];
services.xserver.desktopManager.session = [
{
name = "xfce+i3";
start = ''
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
fi
export XDG_DATA_DIRS="${pkgs.tokyonight-gtk-theme}/share:${pkgs.candy-icons}/share:${pkgs.hicolor-icon-theme}/share:${pkgs.adwaita-icon-theme}/share:$XDG_DATA_DIRS"
${pkgs.xfce.xfce4-session}/bin/xfce4-session --with-ck-launch &
${pkgs.i3-gaps}/bin/i3
'';
}
];
programs.dconf.enable = true;
programs.dconf.profiles.user.databases = [
{
settings = {
"org/gnome/desktop/interface" = {
icon-theme = "candy-icons";
gtk-theme = "Tokyonight-Dark";
cursor-theme = "capitaine-cursors";
};
};
}
];
}

5
hosts/modules/ld.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.nix-ld = {
enable = true;
};
}

31
hosts/modules/net.nix Normal file
View file

@ -0,0 +1,31 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
networkmanagerapplet
wget
curl
cloudflared
nmap
httpie
socat
];
networking.firewall.allowedTCPPorts = [57621];
networking.firewall.allowedUDPPorts = [5353];
networking.wireless.enable = false; # Enables wireless support via wpa_supplicant.
networking.hostName = "nixos";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networking.networkmanager.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
services.openssh.enable = true;
# Disable NetworkManager-wait-online to fix boot hang
systemd.services."NetworkManager-wait-online".enable = false;
}

18
hosts/modules/nixos.nix Normal file
View file

@ -0,0 +1,18 @@
{...}: {
nixpkgs.config.allowUnfree = true;
programs.nix-index.enable = true;
programs.command-not-found.enable = false;
nix.settings = {
auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
substituters = [
"https://cache.nixos.org"
"https://nix-gaming.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
];
};
}

47
hosts/modules/npm.nix Normal file
View file

@ -0,0 +1,47 @@
{
config,
pkgs,
lib,
...
}: let
npmConf = pkgs.writeText "npmrc" ''
prefix=${"$"}{HOME}/.npm-global
cache=${"$"}{HOME}/.npm
init-module=${"$"}{HOME}/.npm-init.js
'';
in {
options.npm.enable = lib.mkEnableOption "system-wide npm environment";
config = lib.mkIf config.npm.enable {
environment.systemPackages = with pkgs; [
nodejs_22
nodePackages.npm
yarn
bun
pnpm
electron
nodePackages.typescript
nodePackages.prettier
nodePackages.eslint
nodePackages.sql-formatter
nodePackages.markdownlint-cli
nodePackages.stylelint
nodePackages.htmlhint
nodePackages.jsonlint
];
environment.sessionVariables.PATH =
lib.mkAfter ":${"$"}{HOME}/.npm-global/bin";
environment.etc."npmrc".source = npmConf;
systemd.user.services."npm-setup" = {
description = "Install .npmrc";
wantedBy = ["default.target"];
script = ''
install -m600 -D ${npmConf} "$HOME/.npmrc"
'';
serviceConfig.Type = "oneshot";
};
};
}

35
hosts/modules/nvidia.nix Normal file
View file

@ -0,0 +1,35 @@
{
config,
pkgs,
...
}: {
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
open = true;
modesetting.enable = true; # must be true for Wayland
powerManagement.enable = false;
nvidiaSettings = true;
};
hardware.graphics = {
enable = true;
enable32Bit = true;
};
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
stdenv.cc.cc.lib
cudaPackages.cudatoolkit.lib
cudaPackages.cudnn
cudaPackages.nccl
];
};
environment.systemPackages = with pkgs; [
glxinfo
cudaPackages.cudatoolkit
];
}

7
hosts/modules/ollama.nix Normal file
View file

@ -0,0 +1,7 @@
{
services.ollama = {
enable = true;
acceleration = "cuda";
loadModels = [];
};
}

27
hosts/modules/python.nix Normal file
View file

@ -0,0 +1,27 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
(python311.withPackages (ps:
with ps; [
i3ipc
requests
ipython
six
psutil
pynvml
pyqtgraph
pyqt6
pyyaml
pillow
jedi
libcst
wheel
jupyterlab
datasets
debugpy
]))
isort
uv
python311
ruff
];
}

16
hosts/modules/rust.nix Normal file
View file

@ -0,0 +1,16 @@
{pkgs, ...}: let
rustToolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [rustc cargo rustfmt clippy];
};
in {
environment.systemPackages = with pkgs; [
rustToolchain
rust-analyzer
cargo-edit
cargo-watch
cargo-outdated
cargo-audit
minijinja-cli
];
}

31
hosts/modules/steam.nix Normal file
View file

@ -0,0 +1,31 @@
{pkgs, ...}: {
programs.steam = {
enable = true;
# apparently enabling this makes big picture boot up, does not work on nvidia however
# gamescopeSession.enable = true;
extraCompatPackages = [
pkgs.proton-ge-bin
];
};
hardware.graphics = {
enable = true;
enable32Bit = true;
};
environment.systemPackages = with pkgs; [
lutris
wineWowPackages.stable
winetricks
protontricks
gamemode
mangohud
vulkan-tools
vulkan-loader
vulkan-headers
vulkan-validation-layers
libstrangle
piper
portaudio
alsa-lib
libglvnd
];
}

View file

@ -0,0 +1,10 @@
{...}: {
services.tailscale = {
enable = true;
};
networking.firewall = {
allowedUDPPorts = [41641];
trustedInterfaces = ["tailscale0"];
};
}

View file

@ -0,0 +1,4 @@
{...}: {
time.timeZone = "America/Edmonton";
i18n.defaultLocale = "en_CA.UTF-8";
}

21
hosts/modules/user.nix Normal file
View file

@ -0,0 +1,21 @@
{pkgs, ...}: let
fish-rust = pkgs.callPackage ../pkgs/fish-rust {};
in {
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.cobray = {
isNormalUser = true;
description = "Mon Aie";
extraGroups = ["networkmanager" "wheel" "docker" "video"];
shell = pkgs.bash;
};
security.sudo = {
enable = true;
wheelNeedsPassword = true;
};
programs.fish = {
enable = true;
package = fish-rust;
};
}

12
hosts/modules/x11.nix Normal file
View file

@ -0,0 +1,12 @@
# For xorgsisters only
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
xorg.xdpyinfo
slop
xorg.libX11
xorg.libXtst
xorg.libXi
xorg.xorgproto
xclip
];
}