Ayo the pizza here (restructuring)

This commit is contained in:
2021-07-21 22:32:32 +05:30
parent 7dffa41ae2
commit 347c8bd00c
41 changed files with 86 additions and 126 deletions

37
hosts/satori/boot.nix Normal file
View File

@@ -0,0 +1,37 @@
{lib, config, pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
initrd={
availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "vfio-pci"];
/* preDeviceCommands = ''
DEVS="0000:01:00.0 0000:01:00.1 0000:01:00.2 0000:01:00.3"
for DEV in $DEVS; do
echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
done
modprobe -i vfio-pci
'';*/
kernelModules = [];
};
kernelParams = [ "nvidia-drm.modeset=1" "intel_pstate=active" "intel_iommu=on" ];
kernelModules = [ "kvm-intel"];
extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
# useOSProber = true;
efiSupport = true;
device = "nodev";
splashImage = ./cirno.png;
splashMode = "stretch";
configurationName = "nixbruh";
};
};
binfmt.emulatedSystems = [ "aarch64-linux" ];
};
}

BIN
hosts/satori/cirno.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

13
hosts/satori/default.nix Normal file
View File

@@ -0,0 +1,13 @@
{ lib, config, ...}:
{
imports =
[
./hardware.nix
./stuff.nix
./pkgs.nix
./networking.nix
./boot.nix
./services.nix
];
system.stateVersion = "21.05";
}

56
hosts/satori/hardware.nix Normal file
View File

@@ -0,0 +1,56 @@
{ config, lib, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/4c02ddf5-d00e-4d84-856f-c327ae44d047";
fsType = "btrfs";
options = ["compress-force=zstd:2"];
};
fileSystems."/boot/efi" =
{
device = "/dev/disk/by-uuid/58B1-4631";
fsType = "vfat";
};
fileSystems."/mnt/Stuff" =
{
device = "/dev/disk/by-uuid/843E68573E6843F0";
fsType = "ntfs";
options = ["uid=natto" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/Extra" =
{
device = "/dev/disk/by-uuid/32EE9F63EE9F1DE3";
fsType = "ntfs";
options = ["uid=natto" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/Games" =
{
device = "/dev/disk/by-uuid/A4CC66B6CC668282";
fsType = "ntfs";
options = ["uid=natto" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/Stuff2" =
{
device = "/dev/disk/by-uuid/e5be3621-8608-4ffe-bd33-5e6d22fef4ff";
fsType = "btrfs";
options = ["compress-force=zstd:1"];
};
swapDevices = [ {device = "/dev/nvme0n1p7";} ];
zramSwap = {
enable = true;
algorithm = "zstd";
memoryPercent = 50;
priority = -1;
};
powerManagement = {
enable = true;
cpuFreqGovernor = "powersave";
};
}

View File

@@ -0,0 +1,38 @@
{config, pkgs, ... }:
{
networking = {
hostName = "Satori";
wireless.enable = true;
wireless.interfaces = [ "wlp0s20f3" ];
firewall = {
allowedTCPPorts = [ 22 18172 ];
allowedUDPPorts = [ 22 17840 18172 ];
};
interfaces = {
enp7s0.useDHCP = true;
wlp0s20f3 = {
useDHCP = true;
ipv4.addresses = [ {
prefixLength = 24;
address = "192.168.0.109";
} ];
};
};
wireguard.interfaces.wg0 = {
ips = [ "10.55.0.3/32" ];
listenPort = 17840;
privateKeyFile = "/var/wg";
peers = [
{
#Oracle VM1
publicKey = "z0Y2VNEWcyVQVSqRHiwmiJ5/0MgSPM+HZfEcwIccSxM=";
allowedIPs = [ "10.55.0.0/24" ];
endpoint = "weirdnatto.in:17840";
persistentKeepalive = 25;
}
];
};
nameservers = [ "1.1.1.1" "8.8.8.8" ];
};
}

102
hosts/satori/pkgs.nix Normal file
View File

@@ -0,0 +1,102 @@
{lib, config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
bc
gnumake
pciutils
git
ntfs3g
python3
htop
nodejs
wget
ripgrep
kbd
cachix
gcc
rustc
openjdk
virtmanager
tree-sitter
];
programs = {
steam.enable = true;
gnupg = {
agent = {
enableSSHSupport = true;
enable = true;
pinentryFlavor = "curses";
};
};
zsh = {
enable = true;
promptInit = ''
RPROMPT='%B%F{cyan}%n%f@%F{red}%m%b'
function preexec() {
timer=$(date +%s%3N)
}
function precmd() {
if [ $timer ]; then
now=$(date +%s%3N)
elapsed=$(($now-$timer))
unset timer
unit="ms"
if [ $elapsed -gt 1000 ]; then
elapsed=$(echo "scale=1; $elapsed/1000" | ${pkgs.bc}/bin/bc -l)
unit="s"
fi
if (($(echo "$elapsed > 60" | bc -l ))); then
elapsed=$(echo "scale=2; $elapsed/60" | ${pkgs.bc}/bin/bc -l)
unit="m"
fi
RPROMPT='%B%F{cyan}%n%f@%F{red}%m %F{yellow}~%f %F{magenta}$elapsed $unit%f%b '
fi
}
'';
histSize = 12000;
enableCompletion = true;
enableBashCompletion = true;
syntaxHighlighting.enable = true;
autosuggestions = {
enable = true;
highlightStyle = "fg=yellow,bold";
};
ohMyZsh = {
enable = true;
theme = "awesomepanda";
};
};
dconf.enable = true;
adb.enable = true;
light.enable = true;
noisetorch.enable = true;
proxychains = {
enable = true;
chain.type = "dynamic";
proxyDNS = true;
proxies = {
remilia = {
enable = true;
type = "socks5";
host = "127.0.0.1";
port = 2217;
};
remilia4 = {
enable = true;
type = "socks4";
host = "127.0.0.1";
port = 2217;
};
};
};
};
nix = {
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command ca-references flakes
'';
trustedUsers = [ "root" "natto" ];
};
}

41
hosts/satori/services.nix Normal file
View File

@@ -0,0 +1,41 @@
{lib, config, pkgs, ... }:
{
systemd.services.nbfc = {
description = "Notebook Fancontrol";
wantedBy = lib.mkForce [];
serviceConfig = {
Type = "forking";
Restart = "on-failure";
ExecStart = "${pkgs.mono}/bin/mono-service -l:/run/nbfc.pid -m:NbfcService /opt/nbfc/NbfcService.exe";
ExecStop = "kill -SIGTERM $(cat /run/nbfc.pid)";
PIDFile = "/run/nbfc.pid";
};
};
services = {
tor.enable = true;
logmein-hamachi.enable = true;
openssh = {
enable = true;
permitRootLogin = "yes";
};
btrfs.autoScrub.enable = true;
udev.extraRules = ''
ACTION=="add|change", KERNEL=="sda", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
'';
};
systemd.services = {
tor.wantedBy = lib.mkForce [];
logmein-hamachi.wantedBy = lib.mkForce [];
openssh.wantedBy = lib.mkForce [];
#printing.wantedBy = lib.mkForce [];
#vault.wantedBy = lib.mkForce [];
};
security.pki.certificateFiles = [ ../../cert.pem ];
/* virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemuRunAsRoot = false;
};*/
}

43
hosts/satori/stuff.nix Normal file
View File

@@ -0,0 +1,43 @@
{config, agenix, pkgs, ... }:
{
time.timeZone = "Asia/Kolkata";
environment = {
sessionVariables = {
QT_X11_NO_MITSHM="1";
QT_QPA_PLATFORMTHEME = "gtk3";
};
};
security={
sudo.enable = false;
doas = {
enable = true;
extraRules = [
{
users = [ "natto" ];
keepEnv = true;
persist = true;
}
];
};
};
fonts.fonts = with pkgs; [
fira-mono
noto-fonts-cjk
lohit-fonts.devanagari
lohit-fonts.gurmukhi
nerdfonts
font-awesome
];
users.users.natto = {
isNormalUser = true;
shell = pkgs.zsh;
home = "/home/natto";
extraGroups = [ "wheel" "adbusers" "video" "libvirtd" ];
};
i18n.inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [ fcitx5-m17n fcitx5-mozc ];
enabled = "fcitx";
fcitx.engines = with pkgs.fcitx-engines; [ m17n mozc ];
};
}