mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
module moving mostly done
This commit is contained in:
parent
a9de747c25
commit
e78a971b9b
33 changed files with 455 additions and 447 deletions
|
|
@ -1,170 +1,84 @@
|
|||
inputs: {
|
||||
pkgs,
|
||||
settings,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# (import ../imports/boot.nix inputs)
|
||||
#(import ../../imports/dwm.nix inputs)
|
||||
(import ./refreshrate.nix inputs)
|
||||
(import ./vfio.nix inputs)
|
||||
(import ./parrot.nix inputs)
|
||||
(import ./spicetify.nix inputs)
|
||||
#(import ./mining.nix inputs)
|
||||
(import ./zfs inputs)
|
||||
|
||||
(import ../../imports/fonts.nix inputs)
|
||||
(import ../../imports/git.nix inputs)
|
||||
(import ../../imports/packages.nix inputs)
|
||||
(import ../../imports/parrot.nix inputs)
|
||||
(import ../../imports/picom.nix inputs)
|
||||
(import ../../imports/refreshrate.nix inputs)
|
||||
(import ../../imports/shells.nix inputs)
|
||||
(import ../../imports/theme.nix inputs)
|
||||
(import ../../imports/vfio.nix inputs)
|
||||
# (import ../../imports/mining.nix inputs)
|
||||
(import ../../imports/spicetify.nix inputs)
|
||||
];
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
localModules = {
|
||||
sxhkd.enable = true;
|
||||
dwm.enable = true;
|
||||
lightdm.enable = true;
|
||||
autoLogin.enable = true;
|
||||
X11Programs = {
|
||||
sxhkd.enable = true;
|
||||
picom.enable = true;
|
||||
};
|
||||
DE.dwm.enable = true;
|
||||
DM = {
|
||||
lightdm.enable = true;
|
||||
autoLogin = true;
|
||||
};
|
||||
};
|
||||
services.xserver.videoDrivers = ["amdgpu"];
|
||||
|
||||
services.gvfs.enable = true; #gvfs for pcmanfm
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
webcord # talk to people (gross)
|
||||
bitwarden #store stuff
|
||||
qbittorrent #steal stuff
|
||||
networkmanagerapplet #gui connection control
|
||||
vlc #play stuff
|
||||
environment.systemPackages = [
|
||||
pkgs.webcord # talk to people (gross)
|
||||
pkgs.bitwarden #store stuff
|
||||
pkgs.qbittorrent #steal stuff
|
||||
pkgs.networkmanagerapplet #gui connection control
|
||||
pkgs.pavucontrol #gui volume control
|
||||
pkgs.pcmanfm #file manager
|
||||
pkgs.librewolf #best browser
|
||||
#pointless stuff
|
||||
pkgs.cava #pretty audio
|
||||
pkgs.pipes-rs # more fun things
|
||||
pkgs.vlc #play stuff
|
||||
];
|
||||
networking = {
|
||||
hostName = settings.hostname;
|
||||
hostId = "288b56db";
|
||||
};
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
#user managment
|
||||
users = {
|
||||
users."${settings.username}" = {
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "audio" "networkmanager"];
|
||||
};
|
||||
};
|
||||
boot = {
|
||||
zfs.devNodes = "/dev/disk/by-id/";
|
||||
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"];
|
||||
supportedFilesystems = ["zfs" "vfat"];
|
||||
initrd = {
|
||||
kernelModules = ["amdgpu" "dm_mod"];
|
||||
availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" "hid_generic"];
|
||||
includeDefaultModules = false;
|
||||
};
|
||||
loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = false;
|
||||
useDHCP = false;
|
||||
dhcpcd.enable = false;
|
||||
networkmanager.enable = false;
|
||||
nameservers = ["1.1.1.1" "1.0.0.1"];
|
||||
defaultGateway = "192.168.1.1";
|
||||
interfaces = {
|
||||
"enp11s0" = {
|
||||
name = "eth0";
|
||||
};
|
||||
generationsDir.copyKernels = true;
|
||||
systemd-boot.enable = false;
|
||||
grub = {
|
||||
enable = true;
|
||||
efiInstallAsRemovable = true;
|
||||
version = 2;
|
||||
copyKernels = true;
|
||||
efiSupport = true;
|
||||
zfsSupport = true;
|
||||
mirroredBoots = [
|
||||
"bridge0" = {
|
||||
name = "bridge0";
|
||||
ipv4.addresses = [
|
||||
{
|
||||
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E";
|
||||
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"];
|
||||
}
|
||||
{
|
||||
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22";
|
||||
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"];
|
||||
address = "192.168.1.4";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
bridges."bridge0".interfaces = ["eth0"];
|
||||
};
|
||||
systemd.services.zfs-mount.enable = false;
|
||||
services.zfs = {
|
||||
autoScrub.enable = true;
|
||||
trim.enable = true;
|
||||
#user managment
|
||||
users.users."${settings.username}" = {
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "audio"];
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "rpool/nixos/root";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
boot = {
|
||||
initrd = {
|
||||
kernelModules = ["amdgpu"];
|
||||
availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"];
|
||||
includeDefaultModules = false;
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "rpool/nixos/home";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/var" = {
|
||||
device = "rpool/nixos/var";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib" = {
|
||||
device = "rpool/nixos/var/lib";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/var/log" = {
|
||||
device = "rpool/nixos/var/log";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "bpool/nixos/root";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E" = {
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part2";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"X-mount.mkdir"
|
||||
"x-systemd.idle-timout=1min"
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"nofail"
|
||||
];
|
||||
};
|
||||
fileSystems."/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22" = {
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part2";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"X-mount.mkdir"
|
||||
"x-systemd.idle-timout=1min"
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"nofail"
|
||||
];
|
||||
};
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part4";
|
||||
discardPolicy = "both";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
allowDiscards = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part4";
|
||||
discardPolicy = "both";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
allowDiscards = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
27
systems/gerg-desktop/mining.nix
Normal file
27
systems/gerg-desktop/mining.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
_: {
|
||||
pkgs,
|
||||
settings,
|
||||
...
|
||||
}: {
|
||||
boot = {
|
||||
kernelModules = ["msr"];
|
||||
kernelParams = ["iomem=relaxed" "msr.allow_writes=on"];
|
||||
};
|
||||
systemd.services.mining = {
|
||||
enable = true;
|
||||
path = with pkgs; [t-rex-miner afk-cmds st zsh dbus xmrig];
|
||||
wantedBy = ["multi-user.target"];
|
||||
wants = ["graphical.target"];
|
||||
script = ''
|
||||
afk-cmds -c /home/${settings.username}/saveme/afk-cmds.json
|
||||
'';
|
||||
environment = {
|
||||
# PATH="/run/current-system/sw/bin"; missing something with dbus
|
||||
XAUTHORITY = "/home/${settings.username}/.Xauthority";
|
||||
DISPLAY = ":0";
|
||||
XDG_DATA_DIRS = "/nix/var/nix/profiles/default/share:/run/current-system/sw/share";
|
||||
DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/1000/bus";
|
||||
NO_AT_BRIDGE = "1";
|
||||
};
|
||||
};
|
||||
}
|
||||
20
systems/gerg-desktop/parrot.nix
Normal file
20
systems/gerg-desktop/parrot.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
_: {
|
||||
pkgs,
|
||||
settings,
|
||||
...
|
||||
}: {
|
||||
#discord bot stuff
|
||||
systemd.services.parrot = {
|
||||
enable = true;
|
||||
path = with pkgs; [parrot yt-dlp ffmpeg];
|
||||
wantedBy = ["multi-user.target"];
|
||||
wants = ["NetworkManager-wait-online.service"];
|
||||
after = ["NetworkManager-wait-online.service"];
|
||||
script = "parrot";
|
||||
serviceConfig = {
|
||||
EnvironmentFile = "/home/${settings.username}/saveme/.env";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "30s";
|
||||
};
|
||||
};
|
||||
}
|
||||
24
systems/gerg-desktop/refreshrate.nix
Normal file
24
systems/gerg-desktop/refreshrate.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
_: {
|
||||
services.xserver = {
|
||||
#fix nasty screen tearing
|
||||
screenSection = ''
|
||||
Option "TearFree" "true"
|
||||
'';
|
||||
#set monitor as primary
|
||||
#set refreshrate to 144 instead of default(60)
|
||||
#disable DPMS(screen turning off)
|
||||
monitorSection = ''
|
||||
Option "Primary" "true"
|
||||
Modeline "1920x1080_144" 332.75 1920 1952 2016 2080 1080 1084 1089 1111 +HSync +VSync
|
||||
Option "PreferredMode" "1920x1080_144"
|
||||
Option "DPMS" "false"
|
||||
'';
|
||||
#disable screen blanking in total
|
||||
serverFlagsSection = ''
|
||||
Option "StandbyTime" "0"
|
||||
Option "SuspendTime" "0"
|
||||
Option "OffTime" "0"
|
||||
Option "BlankTime" "0"
|
||||
'';
|
||||
};
|
||||
}
|
||||
37
systems/gerg-desktop/spicetify.nix
Normal file
37
systems/gerg-desktop/spicetify.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{spicetify-nix, ...}: {pkgs, ...}: let
|
||||
sp-nix = spicetify-nix;
|
||||
spicePkgs = sp-nix.packages.${pkgs.system}.default;
|
||||
in {
|
||||
nixpkgs.allowedUnfree = ["spotify"];
|
||||
imports = [sp-nix.nixosModule];
|
||||
programs.spicetify = {
|
||||
spotifyPackage = pkgs.spotify-unwrapped;
|
||||
spicetifyPackage = pkgs.spicetify-cli;
|
||||
enable = true;
|
||||
enabledExtensions = with spicePkgs.extensions; [
|
||||
adblock
|
||||
hidePodcasts
|
||||
shuffle
|
||||
];
|
||||
theme = spicePkgs.themes.Dribbblish;
|
||||
colorScheme = "custom";
|
||||
customColorScheme = {
|
||||
text = "f8f8f8";
|
||||
subtext = "f8f8f8";
|
||||
sidebar-text = "79dac8";
|
||||
main = "000000";
|
||||
sidebar = "323437";
|
||||
player = "000000";
|
||||
card = "000000";
|
||||
shadow = "000000";
|
||||
selected-row = "7c8f8f";
|
||||
button = "74b2ff";
|
||||
button-active = "74b2ff";
|
||||
button-disabled = "555169";
|
||||
tab-active = "80a0ff";
|
||||
notification = "80a0ff";
|
||||
notification-error = "e2637f";
|
||||
misc = "282a36";
|
||||
};
|
||||
};
|
||||
}
|
||||
71
systems/gerg-desktop/vfio.nix
Normal file
71
systems/gerg-desktop/vfio.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
_: {
|
||||
pkgs,
|
||||
settings,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
boot = {
|
||||
kernelParams = ["amd_iommu=on" "iommu=pt" "vfio_iommu_type1.allow_unsafe_interrupts=1" "kvm.ignore_msrs=1"];
|
||||
kernelModules = ["kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio"];
|
||||
initrd.kernelModules = ["vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio"];
|
||||
extraModprobeConfig = ''
|
||||
options vfio-pci ids=10de:228e,10de:2504
|
||||
'';
|
||||
};
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
runAsRoot = true;
|
||||
ovmf.enable = true;
|
||||
verbatimConfig = ''
|
||||
user = "${settings.username}"
|
||||
group = "kvm"
|
||||
namespaces = []
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
environment = {
|
||||
systemPackages = [pkgs.virt-manager];
|
||||
shellAliases = {
|
||||
vm-start = "virsh start Windows";
|
||||
vm-stop = "virsh shutdown Windows";
|
||||
};
|
||||
};
|
||||
|
||||
users.users."${settings.username}".extraGroups = ["kvm" "libvirtd"];
|
||||
|
||||
systemd.services.libvirtd.preStart = let
|
||||
xml = pkgs.writeText "Windows.xml" (builtins.readFile "${self}/misc/Windows.xml");
|
||||
qemuHook = pkgs.writeScript "qemu-hook" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
GUEST_NAME="$1"
|
||||
OPERATION="$2"
|
||||
SUB_OPERATION="$3"
|
||||
|
||||
if [ "$GUEST_NAME" == "Windows" ]; then
|
||||
if [ "$OPERATION" == "start" ]; then
|
||||
systemctl set-property --runtime -- user.slice AllowedCPUs=8-15,24-31
|
||||
systemctl set-property --runtime -- system.slice AllowedCPUs=8-15,24-31
|
||||
systemctl set-property --runtime -- init.scope AllowedCPUs=8-15,24-31
|
||||
fi
|
||||
|
||||
if [ "$OPERATION" == "stopped" ]; then
|
||||
systemctl set-property --runtime -- user.slice AllowedCPUs=0-31
|
||||
systemctl set-property --runtime -- system.slice AllowedCPUs=0-31
|
||||
systemctl set-property --runtime -- init.scope AllowedCPUs=0-31
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
in ''
|
||||
mkdir -p /var/lib/libvirt/hooks
|
||||
chmod 755 /var/lib/libvirt/hooks
|
||||
|
||||
# Copy hook files
|
||||
ln -sf ${qemuHook} /var/lib/libvirt/hooks/qemu
|
||||
|
||||
mkdir -p /var/lib/libvirt/qemu/
|
||||
ln -sf ${xml} /var/lib/libvirt/qemu/Windows.xml
|
||||
'';
|
||||
}
|
||||
122
systems/gerg-desktop/zfs/default.nix
Normal file
122
systems/gerg-desktop/zfs/default.nix
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
_: {config, ...}: {
|
||||
boot = {
|
||||
zfs.devNodes = "/dev/disk/by-id/";
|
||||
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"];
|
||||
supportedFilesystems = ["zfs" "vfat"];
|
||||
initrd = {
|
||||
kernelModules = ["dm_mod"];
|
||||
availableKernelModules = ["hid_generic"];
|
||||
};
|
||||
plymouth.enable = false;
|
||||
loader = {
|
||||
generationsDir.copyKernels = true;
|
||||
|
||||
#override defaults
|
||||
systemd-boot.enable = false;
|
||||
efi.canTouchEfiVariables = false;
|
||||
|
||||
grub = {
|
||||
enable = true;
|
||||
efiInstallAsRemovable = true;
|
||||
version = 2;
|
||||
copyKernels = true;
|
||||
efiSupport = true;
|
||||
zfsSupport = true;
|
||||
mirroredBoots = [
|
||||
{
|
||||
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E";
|
||||
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"];
|
||||
}
|
||||
{
|
||||
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22";
|
||||
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.services.zfs-mount.enable = false;
|
||||
services.zfs = {
|
||||
autoScrub.enable = true;
|
||||
trim.enable = true;
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "rpool/nixos/root";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/home" = {
|
||||
device = "rpool/nixos/home";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/var" = {
|
||||
device = "rpool/nixos/var";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/var/lib" = {
|
||||
device = "rpool/nixos/var/lib";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/var/log" = {
|
||||
device = "rpool/nixos/var/log";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
device = "bpool/nixos/root";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E" = {
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part2";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"X-mount.mkdir"
|
||||
"x-systemd.idle-timout=1min"
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"nofail"
|
||||
];
|
||||
};
|
||||
"/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22" = {
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part2";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"X-mount.mkdir"
|
||||
"x-systemd.idle-timout=1min"
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"nofail"
|
||||
];
|
||||
};
|
||||
};
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part4";
|
||||
discardPolicy = "both";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
allowDiscards = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part4";
|
||||
discardPolicy = "both";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
allowDiscards = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue