Initialize quasar

This commit is contained in:
Invariantspace 2024-12-09 04:12:16 +00:00
parent 60579facc7
commit 211af9bd61
15 changed files with 616 additions and 72 deletions

View file

@ -0,0 +1,46 @@
# 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`).
{pkgs, ...}: {
# Configure boot
boot = {
initrd.systemd.enable = true;
loader = {
efi.canTouchEfiVariables = true;
grub = let
yorha = pkgs.yorha-grub-theme;
in {
enable = true;
device = "nodev";
efiSupport = true;
splashImage = "${yorha}/background.png";
theme = yorha;
};
};
plymouth = {
enable = true;
extraConfig = "DeviceScale=1";
theme = "target_2";
themePackages = [pkgs.adi1090x-plymouth-themes];
};
};
# 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 = "24.11"; # Did you read the comment?
}

26
linux/quasar/default.nix Normal file
View file

@ -0,0 +1,26 @@
{inputs, ...}: {
imports =
[
inputs.disko.nixosModules.default
../../common
./configuration.nix
./device.nix
./disko.nix
./gui.nix
./hardware-configuration.nix
./network.nix
./syncthing.nix
./tailscale.nix
./zfs.nix
]
++ (with inputs.hardware.nixosModules; [
common-cpu-amd
common-cpu-amd-pstate
common-cpu-amd-raphael-igpu
common-cpu-amd-zenpower
common-gpu-amd
common-hidpi
common-pc
common-pc-ssd
]);
}

61
linux/quasar/device.nix Normal file
View file

@ -0,0 +1,61 @@
{
config,
pkgs,
...
}: let
userName = config.constants.userName;
in {
hardware = {
bluetooth.enable = true;
graphics = {
enable = true;
extraPackages = [
pkgs.rocmPackages.clr.icd
];
};
keyboard.qmk.enable = true;
openrazer = {
enable = true;
users = [userName];
};
};
programs = {
adb.enable = true;
kdeconnect.enable = true;
noisetorch.enable = true;
};
security.rtkit.enable = true;
services = {
automatic-timezoned.enable = true;
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
fwupd.enable = true;
hardware.openrgb.enable = true;
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
};
printing.enable = true;
udev.packages = [pkgs.via];
};
users.users.${userName}.extraGroups = ["adbusers" "cdrom"];
virtualisation = {
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
};
};
}

113
linux/quasar/disko.nix Normal file
View file

@ -0,0 +1,113 @@
{...}: {
disko.devices = {
# Partition the physical disk
disk = {
active = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
esp = {
size = "2G";
type = "ef00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["umask=0077"];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zactive";
};
};
};
};
};
archive = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions.zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zarchive";
};
};
};
};
};
# Declare zfs pools for this system.
zpool = let
options = {
ashift = "12";
autotrim = "on";
listsnapshots = "on";
};
rootFsOptions = {
acltype = "posix";
atime = "off";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
xattr = "sa";
};
in {
zactive = {
type = "zpool";
inherit options rootFsOptions;
datasets = {
# Encrypt main dataset
main = {
type = "zfs_fs";
options = {
encryption = "on";
keyformat = "passphrase";
};
};
# Create dataset for home
"main/home" = {
type = "zfs_fs";
mountpoint = "/home";
};
# Create dataset for nix store
"main/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
};
# Create dataset for root
"main/root" = {
type = "zfs_fs";
mountpoint = "/";
};
# Reserve space for performance
reservation = {
type = "zfs_fs";
options.refreservation = "256G";
};
};
};
zarchive = {
type = "zpool";
inherit options rootFsOptions;
datasets = {
snapshot.type = "zfs_fs";
# Reserve space for performance
reservation = {
type = "zfs_fs";
options.refreservation = "512G";
};
};
};
};
};
}

152
linux/quasar/gui.nix Normal file
View file

@ -0,0 +1,152 @@
{
config,
pkgs,
...
}: let
userName = config.constants.userName;
in {
home-manager.users.${userName} = {
config,
pkgs,
...
}: let
xdgCfg = config.xdg;
in {
home.packages = with pkgs; [
element-desktop
feishin
jellyfin-mpv-shim
joplin-desktop
lutris
nvtopPackages.amd
picard
qbittorrent
razergenie
ryujinx
telegram-desktop
thunderbird
via
winetricks
wineWowPackages.stagingFull
];
programs = {
# git.signing = {
# key = "0x6A815D4CB1637AAC";
# signByDefault = true;
# };
gpg = {
enable = true;
homedir = "${xdgCfg.dataHome}/gnupg";
};
mpv = {
enable = true;
config = {
osd-bar = "no";
border = "no";
};
scripts = with pkgs.mpvScripts; [
mpris
thumbfast
uosc
vr-reversal
];
};
obs-studio.enable = true;
zathura = {
enable = true;
options = {
completion-bg = "#504945";
completion-fg = "#ebdbb2";
completion-group-bg = "#3c3836";
completion-group-fg = "#928374";
completion-highlight-bg = "#83a598";
completion-highlight-fg = "#504945";
default-bg = "#1d2021";
default-fg = "#ebdbb2";
highlight-active-color = "#fe8019";
highlight-color = "#fabd2f";
index-active-bg = "#83a598";
index-active-fg = "#504945";
index-bg = "#504945";
index-fg = "#ebdbb2";
inputbar-bg = "#1d2021";
inputbar-fg = "#ebdbb2";
notification-bg = "#1d2021";
notification-error-bg = "#1d2021";
notification-error-fg = "#fb4934";
notification-fg = "#b8bb26";
notification-warning-bg = "#1d2021";
notification-warning-fg = "#fabd2f";
recolor = "true";
recolor-darkcolor = "#ebdbb2";
recolor-keephue = "true";
recolor-lightcolor = "#1d2021";
render-loading = "true";
render-loading-bg = "#1d2021";
render-loading-fg = "#ebdbb2";
selection-clipboard = "clipboard";
statusbar-bg = "#504945";
statusbar-fg = "#ebdbb2";
};
};
};
services = {
easyeffects.enable = true;
gpg-agent = {
enable = true;
pinentryPackage = pkgs.pinentry-qt;
};
xsettingsd = {
enable = true;
settings = {
"Gdk/UnscaledDPI" = 98304;
"Gdk/WindowScalingFactor" = 2;
"Gtk/EnableAnimations" = 1;
"Gtk/DecorationLayout" = "icon:minimize,maximize,close";
"Net/ThemeName" = "Sweet-Ambar-Blue";
"Gtk/PrimaryButtonWarpsSlider" = 1;
"Gtk/ToolbarStyle" = 3;
"Gtk/MenuImages" = 1;
"Gtk/ButtonImages" = 1;
"Gtk/CursorThemeSize" = 96;
"Gtk/CursorThemeName" = "Sweet-cursors";
"Net/SoundThemeName" = "yorha";
"Net/IconThemeName" = "Sweet-Rainbow";
"Gtk/FontName" = "Noto Sans, 10";
};
};
};
};
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [fcitx5-nord fcitx5-rime];
};
programs = {
dconf.enable = true;
# TODO: Enable when it's fixed
kde-pim = {
enable = true;
merkuro = true;
};
partition-manager.enable = true;
steam.enable = true;
};
services = {
desktopManager.plasma6.enable = true;
displayManager = {
autoLogin.user = userName;
sddm = {
enable = true;
wayland.enable = true;
};
};
xserver = {
enable = true;
videoDrivers = ["amdgpu"];
};
};
}

View file

@ -0,0 +1,30 @@
# 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")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "uas" "usbhid" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp10s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

11
linux/quasar/network.nix Normal file
View file

@ -0,0 +1,11 @@
{...}: {
networking = {
hostId = "d8999277";
networkmanager = {
enable = true;
wifi.backend = "iwd";
};
nftables.enable = true;
wireless.iwd.enable = true;
};
}

View file

@ -0,0 +1,21 @@
{...}: {
services.syncthing = {
enable = true;
settings.folders = {
# game-data = {
# devices = ["protostar"];
# path = "~/Game/data";
# type = "sendonly";
# };
# game-save = {
# devices = ["protostar"];
# path = "~/Game/save";
# };
# music = {
# devices = ["nebula"];
# path = "~/Music";
# type = "sendonly";
# };
};
};
}

View file

@ -0,0 +1,7 @@
{...}: {
services.tailscale = {
enable = true;
port = 62662;
useRoutingFeatures = "client";
};
}

76
linux/quasar/zfs.nix Normal file
View file

@ -0,0 +1,76 @@
{
config,
lib,
...
}: {
boot.loader.grub.zfsSupport = true;
services.zfs = {
autoScrub.enable = true;
trim.enable = true;
};
services.zrepl = {
enable = true;
settings = {
global = {
logging = [
{
type = "syslog";
level = "info";
format = "human";
}
];
};
jobs = let
listener_name = "archive";
in [
{
type = "push";
name = "snapshot";
connect = {
inherit listener_name;
type = "local";
client_identity = config.networking.hostName;
};
filesystems."zactive/main/home" = true;
send.encrypted = true;
snapshotting = {
type = "periodic";
prefix = "zrepl-";
interval = "1h";
};
pruning = {
keep_sender = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
}
];
keep_receiver = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "30x1d" "52x1w"];
}
];
};
replication.protection = {
initial = "guarantee_resumability";
incremental = "guarantee_incremental";
};
}
{
type = "sink";
name = "archive";
serve = {
inherit listener_name;
type = "local";
};
root_fs = "zarchive";
}
];
};
};
}