Begin the move to the import all, activate by config model

This commit is contained in:
Jimbo 2024-11-04 22:41:38 -05:00
parent 7397b614de
commit 07cb2d67a2
97 changed files with 776 additions and 633 deletions

View file

@ -28,7 +28,7 @@ in {
initrd = {
systemd = {
enable = true;
services.root-reset = {
services.root-reset = {
description = "Reset BTRFS root and snapshot last boot";
wantedBy = [ "initrd.target" ];
after = [ "dev-nixos-root.device" ];

View file

@ -4,29 +4,15 @@
./boot
./disko
./hardware
# Apps and programs
../../modules/system
../../modules/system/accounts
../../modules/system/desktop
../../modules/system/programs
../../modules/system/services
../../modules/system/services/pc/sunshine
../../modules/system/services/pc/virtualization/qemu
# Devices and hardware
../../modules/system/devices
../../modules/system/devices/boot/lanzaboote
../../modules/system/devices/video/nvidia
../../modules/system/devices/networking/firewall/pc
# Misc
../../overlays
../../variables
];
networking.hostName = "firefly";
system.lanzaboote.enable = true;
system.wireless.enable = false;
system.wireguard.client.enable = false;
system.video.nvidia.enable = true;
system.libvirtd.enable = true;
# Force Electron to use Wayland
networking.hostName = "firefly";
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}

View file

@ -1,9 +1,11 @@
{ pkgs, ... }:
{
imports = [
./spotdl
./yt-dlp
];
home.packages = with pkgs; [
yt-dlp
spotdl
playerctl
ffmpeg
alsa-utils
puddletag

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ spotdl ];
programs.zsh.shellAliases.spotdl = "spotdl --m3u --format opus";
}

View file

@ -0,0 +1,20 @@
{ ... }:
{
programs = {
yt-dlp = {
enable = true;
settings = {
add-metadata = true;
embed-thumbnail = true;
convert-thumbnails = "jpg";
audio-format = "opus";
output = ''"%(artist)s - %(title)s.%(ext)s"'';
};
};
zsh.shellAliases = {
ytm3u = "yt-dlp -gS proto:m3u8";
opusdl = ''yt-dlp -f ba -x --audio-quality 0'';
spotdl = "spotdl --m3u --format opus";
};
};
}

View file

@ -0,0 +1,97 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"source": "xenia",
"color": {
"1": "1;97",
"2": "red",
"3": "yellow"
}
},
"display": {
"separator": " \u001b[33m ",
"color": "red"
},
"modules": [
{
"type": "custom",
"format": "\u001b[1m—————————————————————————————————————"
},
{
"type": "host",
"key": "󰌢 "
},
{
"type": "cpu",
"key": " "
},
{
"type": "gpu",
"key": "󰢮 "
},
{
"type": "disk",
"folders": "/",
"key": " "
},
{
"type": "memory",
"format": "{/1}{-}{/}{/2}{-}{/}{} / {}",
"key": " "
},
{
"type": "display",
"compactType": "original",
"key": "󰍹 "
},
{
"type": "custom",
"format": "\u001b[1m—————————————————————————————————————"
},
{
"type": "os",
"format": "{3} {12}",
"key": "󰍛 "
},
{
"type": "kernel",
"format": "{1} {2}",
"key": " "
},
{
"type": "wm",
"key": " "
},
{
"type": "shell",
"key": " "
},
{
"type": "terminal",
"key": " "
},
{
"type": "packages",
"key": "󰆧 "
},
{
"type": "uptime",
"key": "󰅐 "
},
{
"type": "command",
"text": "date -d @$(stat -c %W /) '+%a %b %d %r %Z %Y'",
"key": "󰶡 "
},
{
"type": "custom",
"format": "\u001b[1m—————————————————————————————————————"
},
{
"type": "custom",
"format": "\u001b[90m󰮯 \u001b[31m󰊠 \u001b[32m󰊠 \u001b[33m󰊠 \u001b[34m󰊠 \u001b[35m󰊠 \u001b[36m󰊠 \u001b[37m󰊠"
}
]
}

View file

@ -1,154 +1,6 @@
{ pkgs, ... }:
{ ... }:
{
home = {
file = let
fastConf = ''
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"source": "xenia",
"color": {
"1": "1;97",
"2": "red",
"3": "yellow"
}
},
"display": {
"separator": " \u001b[33m ",
"color": "red"
},
"modules": [
{
"type": "custom",
"format": "\u001b[1m"
},
{
"type": "host",
"key": "󰌢 "
},
{
"type": "cpu",
"key": " "
},
{
"type": "gpu",
"key": "󰢮 "
},
{
"type": "disk",
"folders": "/",
"key": " "
},
{
"type": "memory",
"format": "{/1}{-}{/}{/2}{-}{/}{} / {}",
"key": " "
},
{
"type": "display",
"compactType": "original",
"key": "󰍹 "
},
{
"type": "custom",
"format": "\u001b[1m"
},
{
"type": "os",
"format": "{3} {12}",
"key": "󰍛 "
},
{
"type": "kernel",
"format": "{1} {2}",
"key": " "
},
{
"type": "wm",
"key": " "
},
{
"type": "shell",
"key": " "
},
{
"type": "terminal",
"key": " "
},
{
"type": "packages",
"key": "󰆧 "
},
{
"type": "uptime",
"key": "󰅐 "
},
{
"type": "command",
"text": "date -d @$(stat -c %W /) '+%a %b %d %r %Z %Y'",
"key": "󰶡 "
},
{
"type": "custom",
"format": "\u001b[1m"
},
{
"type": "custom",
"format": "\u001b[90m󰮯 \u001b[31m󰊠 \u001b[32m󰊠 \u001b[33m󰊠 \u001b[34m󰊠 \u001b[35m󰊠 \u001b[36m󰊠 \u001b[37m󰊠"
}
]
}
'';
in {
# Fastfetch config
".config/fastfetch/config.jsonc".text = fastConf;
};
packages = let
# Small Neofetch config
pFetch = let
smallConf = pkgs.writeText "smallconf.jsonc" ''
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"type": "small"
},
"modules": [
{
"type": "os",
"format": "{3} {12}",
"key": "󰍛 "
},
{
"type": "host",
"key": "󰌢 "
},
{
"type": "kernel",
"format": "{1} {2}",
"key": " "
},
{
"type": "uptime",
"key": "󰅐 "
},
{
"type": "packages",
"key": "󰆧 "
},
{
"type": "memory",
"format": "{/1}{-}{/}{/2}{-}{/}{} / {}",
"key": " "
}
]
}
'';
in pkgs.writeScriptBin "pfetch"
''fastfetch --config ${smallConf}'';
in with pkgs; [
fastfetch pFetch
];
};
imports = [ ./small ];
home.file.".config/fastfetch/config.jsonc".source = ./config.jsonc;
programs.fastfetch.enable = true;
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
home = {
file.".config/fastfetch/small.jsonc".source = ./small.jsonc;
packages = let
pFetch = pkgs.writeScriptBin "pfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc";
in with pkgs; [ pFetch ];
};
}

View file

@ -0,0 +1,34 @@
{
"logo": {
"type": "small"
},
"modules": [
{
"type": "os",
"format": "{3} {12}",
"key": "󰍛 "
},
{
"type": "host",
"key": "󰌢 "
},
{
"type": "kernel",
"format": "{1} {2}",
"key": " "
},
{
"type": "uptime",
"key": "󰅐 "
},
{
"type": "packages",
"key": "󰆧 "
},
{
"type": "memory",
"format": "{/1}{-}{/}{/2}{-}{/}{} / {}",
"key": " "
}
]
}

View file

@ -6,7 +6,6 @@
preview_images = true;
preview_images_method = "sixel";
dirname_in_tabs = true;
cd_tab_fuzzy = true;
autosave_bookmarks = false;
show_hidden = true;
wrap_scroll = true;
@ -102,28 +101,24 @@
# Ranger's bookmarks and necessary tools
home = {
file = let
rangerBookmarks = ''
file = {
".local/share/ranger/bookmarks".text = ''
# Local files
h:/home/jimbo/
k:/home/jimbo/Downloads
v:/home/jimbo/Videos
c:/home/jimbo/.config
L:/home/jimbo/.local
D:/mnt
l:/home/jimbo/.local
d:/mnt
n:/etc/nixos
# Remote files
j:/home/jimbo/JimboNFS
J:/home/jimbo/JimboNFS
K:/home/jimbo/JimboNFS/Downloads
p:/home/jimbo/JimboNFS/Photos
P:/home/jimbo/JimboNFS/Projects
P:/home/jimbo/JimboNFS/Photos
V:/home/jimbo/JimboNFS/Videos/Random
m:/home/jimbo/JimboNFS/Music/Synced
s:/home/jimbo/JimboNFS/School
M:/home/jimbo/JimboNFS/Music/Synced
'';
in {
".local/share/ranger/bookmarks".text = rangerBookmarks;
};
packages = with pkgs; [
imagemagick

View file

@ -2,19 +2,21 @@
{
programs.tmux = {
enable = true;
keyMode = "vi";
mouse = true;
terminal = "st-256color";
historyLimit = 4096;
baseIndex = 1;
extraConfig = ''
set -g mouse on
set -g base-index 1
set -g default-terminal "st-256color"
set -g history-limit 4096
set -g set-titles on
set -g set-titles-string "#T"
set -g status on
set -g status-left ""
set -g status-position bottom
set -g status-right "#[bg=brightblack]#[fg=dark_purple] #T "
set -g status-style "bg=black"
setw -g pane-base-index 1
set -g set-titles on
set -g set-titles-string "#T"
setw -g window-status-format "#[bg=brightmagenta]#[fg=black] #I #[bg=brightblack]#[fg=white] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=black] #I #[bg=white]#[fg=black] #W "
'';

View file

@ -30,17 +30,8 @@
ncat = "/usr/bin/env cat";
copycat = "wl-copy <";
sunshinehost = "WAYLAND_DISPLAY=wayland-1 DISPLAY=:1 sunshine -0";
seneca = "ssh jhampton1@matrix.senecapolytechnic.ca";
# Curl tools
myip = "curl ifconfig.co";
# Download from sources
ytdl = ''yt-dlp --embed-thumbnail --embed-metadata --output "%(title)s.%(ext)s"'';
ytm3u = "yt-dlp -gS proto:m3u8";
opusdl = "ytdl --recode-video opus";
ytopus = "opusdl --format 251";
spotdl = "spotdl --m3u --format opus";
seneca = "ssh jhampton1@matrix.senecapolytechnic.ca";
};
initExtra = ''
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh

View file

@ -6,7 +6,9 @@
noto-fonts
sarasa-gothic
ubuntu_font_family
(nerdfonts.override { fonts = [ "UbuntuMono" ]; })
(nerdfonts.override {
fonts = [ "UbuntuMono" ];
})
];
fonts.fontconfig = {

View file

@ -20,8 +20,10 @@
};
};
iconTheme = {
package = pkgs.papirus-icon-theme.override { color = "${config.look.colors.folder}"; };
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme.override {
color = "${config.look.colors.folder}";
};
};
cursorTheme = {
package = pkgs.simp1e-cursors;

View file

@ -2,7 +2,7 @@
{
wayland.windowManager.sway = {
config = {
bars = [{command = "waybar";}];
bars = [ {command = "waybar";} ];
startup = [
# Scratchpads
@ -16,7 +16,6 @@
{command = "wl-copy";}
{command = "mako";}
{command = "sunshine";}
{command = "${pkgs.rot8}/bin/rot8";}
# Polkit agent
{command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";}

View file

@ -1,40 +1,18 @@
{ config, pkgs, ... }:
{ ... }:
{
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
};
nixpkgs.config.allowUnfree = true;
imports = [
./accounts
./devices
./options
./programs
./services
./settings
../../overlays
../../variables
];
time.timeZone = "America/Toronto";
programs = {
zsh.enable = true;
nano.enable = false;
};
documentation = {
nixos.enable = false;
info.enable = false;
};
console = {
font = "${pkgs.terminus_font}/share/consolefonts/ter-u22n.psf.gz";
packages = with pkgs; [ terminus_font ];
};
programs.nano.enable = false;
hardware.enableRedistributableFirmware = true;
system.stateVersion = "24.05";
}

View file

@ -1,8 +0,0 @@
{ ... }:
{
imports = [
./qt
./wayland
./sway
];
}

View file

@ -1,12 +0,0 @@
{ pkgs, ... }:
{
programs = {
dconf.enable = true;
light.enable = true;
};
services = {
dbus.enable = true;
tlp.enable = true;
};
}

View file

@ -1,7 +1,7 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
services.pipewire = {
enable = true;
enable = config.system.desktop.enable;
wireplumber = {
enable = true;
configPackages = [

View file

@ -1,17 +1,15 @@
{ ... }:
{ lib, config, ... }:
{
hardware.bluetooth = {
enable = true;
settings = {
General.Experimental = "true";
Policy.AutoEnable = "true";
config = lib.mkIf config.system.desktop.enable {
hardware.bluetooth = {
enable = true;
settings = {
General.Experimental = "true";
Policy.AutoEnable = "true";
};
};
systemd.tmpfiles.rules = [ "f /var/lib/systemd/linger/jimbo" ];
environment.persistence."/persist".directories = [ "/var/lib/bluetooth" ];
};
# Lingering helps keep headphones connected
systemd.tmpfiles.rules = [
"f /var/lib/systemd/linger/jimbo"
];
environment.persistence."/persist".directories = [ "/var/lib/bluetooth" ];
}

View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./extlinux
./lanzaboote
./systemd
];
}

View file

@ -1,7 +1,18 @@
{ ... }:
{ lib, config, ... }:
{
boot.loader = {
generic-extlinux-compatible.enable = true;
grub.enable = false;
options.system.extlinux = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable Lanzaboote and force disable Systemd-boot";
};
};
config = lib.mkIf config.system.extlinux.enable {
boot.loader = {
generic-extlinux-compatible.enable = true;
systemd-boot.enable = lib.mkForce false;
grub.enable = lib.mkForce false;
};
};
}

View file

@ -1,15 +1,25 @@
{ lanzaboote, pkgs, ... }:
{ lanzaboote, lib, config, pkgs, ... }:
{
imports = [
lanzaboote.nixosModules.lanzaboote
];
imports = [ lanzaboote.nixosModules.lanzaboote ];
boot.lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
options.system.lanzaboote = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable Lanzaboote and force disable Systemd-boot";
};
};
environment.systemPackages = with pkgs; [
sbctl
];
config = lib.mkIf config.system.lanzaboote.enable {
boot = {
loader.systemd-boot.enable = lib.mkForce false;
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
};
environment.systemPackages = with pkgs; [ sbctl ];
};
}

View file

@ -3,8 +3,8 @@
imports = [
./audio
./bluetooth
./filesystems
./impermanence
./boot
./disks
./networking
./printing
./udev

View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./filesystems
./impermanence
./snapper
];
}

View file

@ -1,7 +1,6 @@
{ lib, ... }:
{ ... }:
{
boot.supportedFilesystems = {
ntfs = true;
zfs = lib.mkForce false;
};
}

View file

@ -6,9 +6,10 @@
directories = [
"Downloads"
"Documents"
"Games"
"Pictures"
"Videos"
"Games"
".snapshots"
".mozilla"
".thunderbird"

View file

@ -1,5 +1,11 @@
{ ... }:
{
imports = [
./firewall
./wireguard
./wireless
];
networking = {
wireless.enable = false;
dhcpcd.enable = true;

View file

@ -0,0 +1,63 @@
{ lib, config, ... }:
{
options.system.firewall = {
server = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable server firewall settings";
};
};
};
config = {
networking = {
firewall = {
allowPing = false;
extraInputRules = lib.mkIf (!config.system.firewall.server.enable) ''
ip saddr { ${config.ips.server}, ${config.ips.wgSpan}.1 } accept comment "Accept Server"
'' // lib.mkIf config.system.firewall.server.enable ''
ip saddr { ${config.ips.localSpan}.0/24, ${config.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
'';
};
# Nftables configuration only if server is enabled
nftables = lib.mkIf config.system.firewall.server.enable {
tables = {
forwarding = {
family = "ip";
content = ''
chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
tcp dport 2222 dnat to ${config.ips.wgSpan}.19:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"
tcp dport { 58010, 57989, 57984 } dnat to ${config.ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } dnat to ${config.ips.pc} comment "PC Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat to ${config.ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${config.ips.vm} comment "VM Sunshine UDP"
udp dport { 7790, 7791, 7792 } dnat to ${config.ips.hx} comment "Deus Ex"
ip saddr ${config.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR TCP"
ip saddr ${config.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR UDP"
}
chain POSTROUTING {
type nat hook postrouting priority 100; policy accept;
oifname "${config.ips.netInt}" masquerade
}
'';
};
};
};
};
# Enable IP forwarding for the server configuration
boot.kernel.sysctl."net.ipv4.ip_forward" = lib.mkIf config.system.firewall.server.enable 1;
};
}

View file

@ -1,9 +0,0 @@
{ config, ... }:
{
networking.firewall = {
allowPing = false;
extraInputRules = ''
ip saddr { ${config.ips.server}, ${config.ips.wgSpan}.1 } accept comment "Accept Server"
'';
};
}

View file

@ -1,50 +0,0 @@
{ config, ... }:
{
# Allow forwarding
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
# Configure firewall
networking = {
firewall = {
allowPing = false;
extraInputRules = ''
ip saddr { ${config.ips.localSpan}.0/24, ${config.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
'';
};
# Enable nftables and forwarding
nftables = {
tables = {
forwarding = {
family = "ip";
content = ''
chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
tcp dport 2222 dnat to ${config.ips.wgSpan}.19:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"
tcp dport { 58010, 57989, 57984 } dnat to ${config.ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } dnat to ${config.ips.pc} comment "PC Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat to ${config.ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${config.ips.vm} comment "VM Sunshine UDP"
udp dport { 7790, 7791, 7792 } dnat to ${config.ips.hx} comment "Deus Ex"
ip saddr ${config.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR TCP"
ip saddr ${config.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR UDP"
}
chain POSTROUTING {
type nat hook postrouting priority 100; policy accept;
oifname "${config.ips.netInt}" masquerade
}
'';
};
};
};
};
}

View file

@ -0,0 +1,63 @@
{ lib, config, ... }:
{
options.system.wireguard = {
client = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable WireGuard client";
};
};
server = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable WireGuard server";
};
};
};
config = {
networking = {
firewall.allowedUDPPorts = [ 51820 ];
nat = {
enable = config.system.wireguard.server.enable;
externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "${config.ips.wgInt}" ];
};
wireguard.interfaces = {
"wgc" = lib.mkIf config.system.wireguard.client.enable {
# Define IP of client in per device config
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # NixOS Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "${config.ips.wgSpan}.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
"wgs" = lib.mkIf config.system.wireguard.server.enable {
ips = [ "${config.ips.wgSpan}.1/24" ];
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
peers = [
{ # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "${config.ips.wgSpan}.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "${config.ips.wgSpan}.2/32" ];
}
];
};
};
};
};
}

View file

@ -1,22 +0,0 @@
{ config, ... }:
{
networking = {
firewall.allowedUDPPorts = [ 51820 ];
wireguard.interfaces = {
"${config.ips.wgInt}" = {
# Define IP of client in per device config
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # NixOS Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "${config.ips.wgSpan}.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
};
};
}

View file

@ -1,30 +0,0 @@
{ config, ... }:
{
networking = {
nat = {
enable = true;
externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "${config.ips.wgInt}" ];
};
firewall.allowedUDPPorts = [ 51820 ];
wireguard.interfaces = {
"${config.ips.wgInt}" = {
ips = [ "${config.ips.wgSpan}.1/24" ];
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
peers = [
{ # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "${config.ips.wgSpan}.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "${config.ips.wgSpan}.2/32" ];
}
];
};
};
};
}

View file

@ -1,12 +1,22 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
networking = {
wireless.iwd.enable = true;
enableB43Firmware = true;
options.system.wireless = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable Wifi with iwd";
};
};
environment = {
persistence."/persist".directories = [ "/var/lib/iwd/" ];
systemPackages = with pkgs; [ unstable.impala ];
config = lib.mkIf config.system.wireless.enable {
networking = {
wireless.iwd.enable = true;
enableB43Firmware = true;
};
environment = {
systemPackages = with pkgs; [ unstable.impala ];
persistence."/persist".directories = [ "/var/lib/iwd/" ];
};
};
}

View file

@ -1,19 +1,19 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
services = {
printing = {
enable = true;
drivers = with pkgs; [ hplip ];
webInterface = false;
config = lib.mkIf config.system.desktop.enable {
services = {
printing = {
enable = true;
drivers = with pkgs; [ hplip ];
webInterface = false;
};
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
environment.systemPackages = with pkgs; [
system-config-printer
];
environment.systemPackages = with pkgs; [ system-config-printer ];
};
}

View file

@ -1,12 +1,12 @@
{ pkgs, ... }:
{
services.udev = let
oculusRules = pkgs.writeTextFile {
name = "10-oculus.rules";
text = ''KERNEL=="hidraw*", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0184", MODE="0660", TAG+="uaccess"'';
destination = "/etc/udev/rules.d/10-oculus.rules";
};
in {
packages = [ oculusRules ];
services.udev = {
packages = [
(pkgs.writeTextFile {
name = "10-oculus.rules";
text = ''KERNEL=="hidraw*", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0184", MODE="0660", TAG+="uaccess"'';
destination = "/etc/udev/rules.d/10-oculus.rules";
})
];
};
}

View file

@ -1,12 +1,12 @@
{ pkgs, ... }:
{
services.udev = let
pdpRules = pkgs.writeTextFile {
name = "10-pdp.rules";
text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"'';
destination = "/etc/udev/rules.d/10-pdp.rules";
};
in {
packages = [ pdpRules ];
services.udev = {
packages = [
(pkgs.writeTextFile {
name = "10-pdp.rules";
text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"'';
destination = "/etc/udev/rules.d/10-pdp.rules";
})
];
};
}

View file

@ -1,7 +1,9 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
imports = [ ./nvidia ];
hardware.opengl = {
enable = true;
enable = config.system.desktop.enable;
driSupport32Bit = true;
extraPackages = with pkgs; [
vulkan-loader

View file

@ -1,4 +0,0 @@
{ config, lib, ... }:
{
services.xserver.videoDrivers = [ "nouveau" ];
}

View file

@ -1,10 +1,35 @@
{ pkgs, config, lib, ... }:
{ lib, pkgs, config, ... }:
{
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
nvidiaSettings = false;
package = config.boot.kernelPackages.nvidiaPackages.beta;
open = false;
options.system.video = {
nvidia = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the proprietary Nvidia stack";
};
};
nouveau = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the open-source Nouveau driver";
};
};
};
config = {
# Conditionally set video drivers based on the options
services.xserver.videoDrivers =
if config.system.video.nvidia.enable then [ "nvidia" ]
else if config.system.video.nouveau.enable then [ "nouveau" ]
else [];
# Configure Nvidia settings if Nvidia is enabled
hardware.nvidia = lib.mkIf config.system.video.nvidia.enable {
modesetting.enable = true;
nvidiaSettings = false;
package = config.boot.kernelPackages.nvidiaPackages.beta;
open = false;
};
};
}

View file

@ -0,0 +1,18 @@
{ lib, ... }:
with lib; {
options = {
system = {
desktop.enable = mkOption {
type = types.bool;
default = true;
description = "Enable desktop apps and services?";
};
server.enable = mkOption {
type = types.bool;
default = false;
description = "Enable server services?";
};
};
};
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
programs.appimage = {
enable = true;
binfmt = true;
enable = config.system.desktop.enable;
binfmt = config.system.desktop.enable;
};
}

View file

@ -0,0 +1,7 @@
{ config, ... }:
{
programs = {
light.enable = config.system.desktop.enable;
kbdlight.enable = config.system.desktop.enable;
};
}

View file

@ -0,0 +1,4 @@
{ config, ... }:
{
programs.dconf.enable = config.system.desktop.enable;
}

View file

@ -2,8 +2,13 @@
{
imports = [
./appimage
./backlights
./dconf
./gaming
./git
./qt
./security
./shells
./sway
];
}

View file

@ -1,9 +1,9 @@
{ ... }:
{ config, ... }:
{
programs.gamemode = {
enable = true;
enable = config.system.desktop.enable;
settings.general.renice = 10;
};
hardware.steam-hardware.enable = true;
hardware.steam-hardware.enable = config.system.desktop.enable;
}

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
./gpg
];
imports = [ ./gpg ];
programs.git = {
enable = true;

View file

@ -5,7 +5,5 @@
enableSSHSupport = true;
};
environment.systemPackages = with pkgs; [
git-crypt
];
environment.systemPackages = with pkgs; [ git-crypt ];
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
qt = {
enable = true;
enable = config.system.desktop.enable;
style = "gtk2";
platformTheme = "gtk2";
};

View file

@ -0,0 +1,4 @@
{ ... }:
{
programs.zsh.enable = true;
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
imports = [
./greetd
@ -6,11 +6,11 @@
];
programs.sway = {
enable = true;
enable = config.system.desktop.enable;
package = pkgs.unstable.sway;
extraPackages = with pkgs; [ swaylock ];
};
# Allow swaylock to function
services.dbus.enable = config.system.desktop.enable;
security.pam.services.swaylock = {};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
# Configure greetd for login directly to Sway
services.greetd = let
@ -17,7 +17,7 @@
sway --unsupported-gpu
'';
in {
enable = true;
enable = config.system.desktop.enable;
restart = true;
settings = {
terminal = {

View file

@ -1,16 +1,13 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
xdg.portal = {
wlr = {
enable = true;
enable = config.system.desktop.enable;
settings.screencast = {
max_fps = 60;
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099";
};
};
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
};
}

View file

@ -1,6 +1,7 @@
{ ... }:
{
imports = [
./keyd
./ssh
];
}

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
./fail2ban
];
imports = [ ./fail2ban ];
services.openssh = {
enable = true;

View file

@ -3,5 +3,6 @@
imports = [
./common
./pc
#./server
];
}

View file

@ -3,9 +3,9 @@
imports = [
./gnome-keyring
./gvfs
./keyd
./libvirtd
./mpd
./polkit
./snapper
./sunshine
];
}

View file

@ -1,4 +1,4 @@
{ ... }:
{ config, ... }:
{
services.gnome.gnome-keyring.enable = true;
services.gnome.gnome-keyring.enable = config.system.desktop.enable;
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
services = {
gvfs.enable = true;
udisks2.enable = true;
gvfs.enable = config.system.desktop.enable;
udisks2.enable = config.system.desktop.enable;
};
}

View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
{
options.system.libvirtd = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable libvirtd and such";
};
};
config = lib.mkIf config.system.libvirtd.enable {
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd
];
};
swtpm.enable = true;
};
};
};
environment.systemPackages = with pkgs; [
virt-manager
virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
];
# Needed to make NAT work
networking.firewall.trustedInterfaces = [
"virbr0"
"virbr1"
];
systemd.tmpfiles.rules = [ "f /dev/shm/looking-glass 0660 jimbo libvirtd -" ];
};
}

View file

@ -1,22 +1,24 @@
{ config, ... }:
{ config, lib, ... }:
{
services.mpd = {
enable = true;
user = "jimbo";
group = "users";
musicDirectory = "/home/jimbo/JimboNFS/Music/Synced";
playlistDirectory = "/home/jimbo/JimboNFS/Music/Synced/Playlists";
extraConfig = ''
audio_output {
type "pipewire"
name "Local Pipewire"
}
'';
};
config = lib.mkIf config.system.desktop.enable {
services.mpd = {
enable = true;
user = "jimbo";
group = "users";
musicDirectory = "/home/jimbo/JimboNFS/Music/Synced";
playlistDirectory = "/home/jimbo/JimboNFS/Music/Synced/Playlists";
extraConfig = ''
audio_output {
type "pipewire"
name "Local Pipewire"
}
'';
};
systemd.services.mpd.environment = {
XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.jimbo.uid}";
};
systemd.services.mpd.environment = {
XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.jimbo.uid}";
};
environment.persistence."/persist".directories = [ "/var/lib/mpd" ];
environment.persistence."/persist".directories = [ "/var/lib/mpd" ];
};
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
services.sunshine = {
enable = true;
enable = config.system.desktop.enable;
autoStart = false;
};
}

View file

@ -1,40 +0,0 @@
{ config, pkgs, ... }:
{
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd
];
};
swtpm.enable = true;
};
};
spiceUSBRedirection.enable = true;
};
environment.systemPackages = with pkgs; [
virt-manager
virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
];
# Needed to make NAT work
networking.firewall.trustedInterfaces = [
"virbr0"
"virbr1"
];
# Allow Looking-Glass permissions
systemd.tmpfiles.rules = [
"f /dev/shm/looking-glass 0660 jimbo libvirtd -"
];
}

View file

@ -1,4 +0,0 @@
{ config, lib, ... }:
{
virtualisation.waydroid.enable = true;
}

View file

@ -9,9 +9,9 @@
./minecraft
./misc
./mysql
./nginx
./social
./transmission
./vaultwarden
./webhost
];
}

View file

@ -5,13 +5,11 @@
exports = ''
/export/JimboNFS/Downloads *(rw,sync,no_subtree_check)
/export/JimboNFS/Documents *(rw,sync,no_subtree_check)
/export/JimboNFS/Photos *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos/Random *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos/Media *(rw,sync,no_subtree_check)
/export/JimboNFS/Music/Synced *(rw,sync,no_subtree_check)
/export/JimboNFS/Music/Unsynced *(rw,sync,no_subtree_check)
/export/JimboNFS/Projects *(rw,sync,no_subtree_check)
/export/JimboNFS/School *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos *(rw,sync,no_subtree_check)
/export/JimboNFS/Music *(rw,sync,no_subtree_check)
'';
};
}

View file

@ -1,12 +1,10 @@
{ pkgs, config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.nextcloud = {
enable = true;
package = pkgs.nextcloud29;
package = pkgs.nextcloud30;
hostName = "cloud.${config.domains.jim1}";
datadir = "/mnt/nextcloud";
https = true;

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ config, ... }:
{
services.nginx.virtualHosts."cloud.${config.domains.jim1}" = {
enableACME = true;

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
photoprism = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
forgejo = {

View file

@ -30,6 +30,16 @@
<type>application/ogg</type>
<subtype>vorbis</subtype>
</mount>
<mount type="normal">
<mount-name>/jimscrap.opus</mount-name>
<stream-name>Jimbo's Scrap</stream-name>
<stream-description>Music canned from the main radio.</stream-description>
<stream-url>https://icecast.jimbosfiles.com/jimscrap.opus</stream-url>
<genre>Scrapped</genre>
<type>application/ogg</type>
<subtype>vorbis</subtype>
</mount>
'';
};
}

View file

@ -1,30 +1,7 @@
{ pkgs, config, ... }:
{ ... }:
{
services.liquidsoap.streams = {
jimbops = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
settings.decoder.file_extensions.mp4.set(["m4a", "m4b", "m4p", "m4v", "m4r", "3gp", "mp4"])
# Define the source with random playlist
jimbops = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Synced"))
# Ensure the stream never stops
jimbops_fallback = fallback([jimbops, jimbops])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimbops.opus",
encoding = "UTF-8",
jimbops_fallback
)
'';
};
imports = [
./jimbops
./jimscrap
];
}

View file

@ -0,0 +1,29 @@
{ pkgs, config, ... }:
{
services.liquidsoap.streams = {
jimbops = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
# Define the source with random playlist
jimbops = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Synced"))
# Ensure the stream never stops
jimbops_fallback = fallback([jimbops, jimbops])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimbops.opus",
encoding = "UTF-8",
jimbops_fallback
)
'';
};
}

View file

@ -0,0 +1,29 @@
{ pkgs, config, ... }:
{
services.liquidsoap.streams = {
jimscrap = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
# Define the source with random playlist
jimscrap = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Unsynced"))
# Ensure the stream never stops
jimscrap_fallback = fallback([jimscrap, jimscrap])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimscrap.opus",
encoding = "UTF-8",
jimscrap_fallback
)
'';
};
}

View file

@ -1,5 +1,10 @@
{ pkgs, config, ... }:
{
imports = [
./rtmp
./virtualhosts
];
services.nginx = {
enable = true;
recommendedTlsSettings = true;
@ -9,6 +14,7 @@
};
networking.firewall.allowedTCPPorts = [
80 443
80
443
];
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ config, ... }:
{
services.nginx.virtualHosts = {
"${config.domains.jim1}" = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.lemmy = {
enable = true;

View file

@ -1,8 +1,6 @@
{ pkgs, config, ... }:
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
nixpkgs.config.element-web.conf = {
default_server_config = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
coturn = {

View file

@ -6,8 +6,8 @@
SYNCV3_SERVER = "https://matrix.${config.domains.jim1}";
SYNCV3_BINDADDR = "0.0.0.0:8009";
};
environmentFile = "${pkgs.writeText "matrixsecret" ''
environmentFile = pkgs.writeText "matrixsecret" ''
SYNCV3_SECRET=${config.secrets.matrixSecret}
''}";
'';
};
}

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.owncast = {
enable = true;

View file

@ -1,8 +1,6 @@
{ pkgs, config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.transmission = {
enable = true;

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.vaultwarden = {
enable = true;

View file

@ -1,7 +0,0 @@
{ ... }:
{
imports = [
./nginx
./virtualhosts
];
}

View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./documentation
./fonts
./nix
];
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
documentation = {
nixos.enable = false;
info.enable = false;
};
}

View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
console = {
font = "${pkgs.terminus_font}/share/consolefonts/ter-u22n.psf.gz";
packages = with pkgs; [ terminus_font ];
};
}

View file

@ -0,0 +1,19 @@
{ ... }:
{
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
};
nixpkgs.config.allowUnfree = true;
}