restructure

- users/rin/default.nix -> users/rin.nix
- users/rin/home.nix +-> users/rin.nix
- users/rin/*.nix -> modules/user/*.nix
- users/rin/scripts/ -> scripts/
- hosts/winter/default.nix -> hosts/winter.nix
- hosts/winter/*.nix -> modules/system/*.nix

- modules are dynamically imported as sets for system and user
This commit is contained in:
LavaDesu 2021-07-15 15:09:38 +07:00
parent 84f08a3a1c
commit c86be50084
Signed by: cilly
GPG key ID: 6500251E087653C9
30 changed files with 178 additions and 157 deletions

107
modules/system/audio.nix Normal file
View file

@ -0,0 +1,107 @@
{ config, ... }:
let
int = {
quantum = {
min = 512;
def = 1024;
max = 2048;
};
rate = 48000;
};
str = {
quantum = {
min = toString int.quantum.min;
def = toString int.quantum.def;
max = toString int.quantum.max;
};
rate = toString int.rate;
};
in {
sound.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
config.pipewire = {
"context.properties" = {
"link.max-buffers" = 16;
"default.clock.rate" = int.rate;
"default.clock.quantum" = int.quantum.def;
"default.clock.min-quantum" = int.quantum.min;
"default.clock.max-quantum" = int.quantum.max;
"core.daemon" = true;
"core.name" = "pipewire-0";
};
"context.modules" = [
{
name = "libpipewire-module-rtkit";
args = {
"nice.level" = -15;
"rt.prio" = 88;
"rt.time.soft" = 200000;
"rt.time.hard" = 200000;
};
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-profiler"; }
{ name = "libpipewire-module-metadata"; }
{ name = "libpipewire-module-spa-device-factory"; }
{ name = "libpipewire-module-spa-node-factory"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-client-device"; }
{
name = "libpipewire-module-portal";
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-access"; args = {}; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-link-factory"; }
{ name = "libpipewire-module-session-manager"; }
];
"stream.properties" = {
"node.latency" = "${str.quantum.min}/${str.rate}";
"resample.quality" = 1;
};
};
config.pipewire-pulse = {
"context.modules" = [
{
name = "libpipewire-module-rtkit";
args = {
"nice.level" = -15;
"rt.prio" = 88;
"rt.time.soft" = 200000;
"rt.time.hard" = 200000;
};
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-metadata"; }
{
name = "libpipewire-module-protocol-pulse";
args = {
"pulse.min.req" = "${str.quantum.min}/${str.rate}";
"pulse.default.req" = "${str.quantum.def}/${str.rate}";
"pulse.max.req" = "${str.quantum.max}/${str.rate}";
"pulse.min.quantum" = "${str.quantum.min}/${str.rate}";
"pulse.max.quantum" = "${str.quantum.max}/${str.rate}";
"server.address" = [ "unix:native" ];
};
}
];
"stream.properties" = {
"node.latency" = "${str.quantum.min}/${str.rate}";
"resample.quality" = 1;
};
};
};
}

46
modules/system/gui.nix Normal file
View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }: {
fonts = {
enableDefaultFonts = true;
fontconfig = {
defaultFonts = {
serif = ["NotoSerif"];
sansSerif = ["NotoSans"];
monospace = ["CascadiaCode"];
};
};
fonts = with pkgs; [
cascadia-code
font-awesome-ttf
font-awesome_4
hanazono
material-icons
noto-fonts
noto-fonts-cjk
noto-fonts-extra
open-sans
twemoji-color-font
unifont
];
};
services.xserver = {
enable = true;
autorun = false;
displayManager = {
lightdm.enable = lib.mkForce false;
startx.enable = true;
xserverArgs = [
"-ardelay 250"
"-arinterval 15"
];
};
desktopManager.xterm.enable = false;
libinput = {
enable = true;
mouse = {
accelSpeed = "0";
accelProfile = "flat";
};
};
xkbOptions = "caps:escape";
};
}

View file

@ -0,0 +1,69 @@
# 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 = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "rootfs";
fsType = "tmpfs";
options = [ "defaults" "size=4G" "mode=755" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/E8E8-E570";
fsType = "vfat";
};
fileSystems."/mnt/butter" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=5" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=258" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=260" ];
};
fileSystems."/home/.snapshots" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=319" ];
};
fileSystems."/root" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=261" ];
};
fileSystems."/var" =
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
fsType = "btrfs";
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=259" ];
};
fileSystems."/mnt/hdd" =
{ device = "/dev/disk/by-uuid/d5e3cfe5-c73a-4695-b81b-fc0215d4cefe";
fsType = "ext4";
};
swapDevices = [ ];
}

32
modules/system/kernel.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }: {
powerManagement.cpuFreqGovernor = "ondemand";
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
grub = {
enable = true;
efiSupport = true;
device = "nodev";
};
};
blacklistedKernelModules = ["uvcvideo"];
initrd = {
includeDefaultModules = false;
kernelModules = [ "i915" ];
};
kernel.sysctl = {
"kernel.core_pattern" = "|/bin/false";
"kernel.sysrq" = 1;
};
kernelParams = [
"amdgpu.gpu_recovery=1"
"amdgpu.si_support=1"
"radeon.si_support=0"
"intel_pstate=passive"
"msr.allow_writes=on"
];
kernelPackages = pkgs.lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-lava);
};
zramSwap.enable = true;
}

View file

@ -0,0 +1,21 @@
{ config, ... }: {
networking.wireless = {
enable = true;
interfaces = [ "wlp3s0" ];
};
networking.useDHCP = false;
networking.interfaces.eno1.useDHCP = false;
networking.interfaces.wlp3s0.useDHCP = false;
networking.interfaces.eno1.ipv4.addresses = [{
address = "10.0.0.2";
prefixLength = 24;
}];
networking.interfaces.wlp3s0.ipv4.addresses = [{
address = "192.168.100.13";
prefixLength = 24;
}];
networking.defaultGateway = "192.168.100.1";
networking.nameservers = ["192.168.100.11"];
}

View file

@ -0,0 +1,33 @@
{ config, pkgs, ...}: {
environment.systemPackages = with pkgs; [
efibootmgr
git
gparted
htop
libarchive
lf
msr-tools
ncdu
neovim
rsync
wget
gnome3.nautilus
];
environment.variables.EDITOR = "nvim";
hardware.opengl.extraPackages = with pkgs; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-ocl
rocm-opencl-icd
rocm-opencl-runtime
];
programs.light.enable = true;
hardware.opentabletdriver.enable = true;
programs.steam.enable = true;
services.dbus.packages = [ pkgs.gnome3.dconf pkgs.gcr ];
services.gnome.sushi.enable = true;
# services.ipfs.enable = true;
}

View file

@ -0,0 +1,24 @@
{ config, pkgs, ... }: {
networking.firewall.enable = false;
services.openssh = {
enable = true;
permitRootLogin = "no";
passwordAuthentication = false;
};
security = {
polkit.enable = true;
sudo.enable = false;
doas = {
enable = true;
extraRules = [
{
groups = ["wheel"];
keepEnv = true;
persist = true;
}
];
};
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, ... }: {
services.snapper = {
cleanupInterval = "1h";
configs.home = {
fstype = "btrfs";
subvolume = "/home";
extraConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k}=${v}") {
TIMELINE_CLEANUP = "yes";
TIMELINE_CREATE = "yes";
TIMELINE_MIN_AGE = "1800";
TIMELINE_LIMIT_HOURLY = "5";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_WEEKLY = "0";
TIMELINE_LIMIT_MONTHLY = "0";
TIMELINE_LIMIT_YEARLY = "0";
});
};
};
}