From 79acd090f43421a48b5b5001a47aa4eb8d719e7b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 3 Sep 2021 23:17:07 +0200 Subject: [PATCH] feat: add hosts/aijiro config My portable desktop machine. --- hosts/aijiro/README.org | 30 +++++++++ hosts/aijiro/default.nix | 86 +++++++++++++++++++++++++ hosts/aijiro/hardware-configuration.nix | 57 ++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 hosts/aijiro/README.org create mode 100644 hosts/aijiro/default.nix create mode 100644 hosts/aijiro/hardware-configuration.nix diff --git a/hosts/aijiro/README.org b/hosts/aijiro/README.org new file mode 100644 index 00000000..04b4e810 --- /dev/null +++ b/hosts/aijiro/README.org @@ -0,0 +1,30 @@ +#+TITLE: Aijiro +#+DATE: September 3, 2021 + +* Overview +... + +* Specs ++ Intel i5-6400 ++ 8GB + +* Installation +** Set up root file system +#+BEGIN_SRC sh +parted /dev/sda -- mklabel gpt +parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB +parted /dev/sda -- mkpart primary linux-swap 512MiB 8.5GiB +parted /dev/sda -- mkpart primary 8.5GiB 100% +parted /dev/sda -- set 1 boot on +mkfs.fat -F32 -n BOOT /dev/sda1 +mkswap -L swap /dev/sda2 +mkfs.ext4 -L nixos /dev/sda3 +#+END_SRC + +** Mount drives +#+BEGIN_SRC sh +mount /dev/sda3 /mnt +mkdir -p /mnt/boot +mount /dev/sda1 /mnt/boot +swapon /dev/sda2 +#+END_SRC diff --git a/hosts/aijiro/default.nix b/hosts/aijiro/default.nix new file mode 100644 index 00000000..ca73c40d --- /dev/null +++ b/hosts/aijiro/default.nix @@ -0,0 +1,86 @@ +# Shiro -- my laptop + +{ ... }: +{ + imports = [ + ../home.nix + ./hardware-configuration.nix + ]; + + ## Modules + modules = { + desktop = { + bspwm.enable = true; + apps = { + discord.enable = true; + rofi.enable = true; + # godot.enable = true; + }; + browsers = { + default = "brave"; + brave.enable = true; + # firefox.enable = true; + # qutebrowser.enable = true; + }; + gaming = { + # steam.enable = true; + # emulators.enable = true; + # emulators.psx.enable = true; + }; + media = { + daw.enable = true; + documents.enable = true; + graphics.enable = true; + mpv.enable = true; + recording.enable = true; + spotify.enable = true; + }; + term = { + default = "xst"; + st.enable = true; + }; + vm = { + qemu.enable = true; + }; + }; + dev = { + node.enable = true; + rust.enable = true; + python.enable = true; + }; + editors = { + default = "nvim"; + emacs.enable = true; + vim.enable = true; + }; + shell = { + # adl.enable = true; + vaultwarden.enable = true; + direnv.enable = true; + git.enable = true; + gnupg.enable = true; + tmux.enable = true; + zsh.enable = true; + }; + services = { + ssh.enable = true; + docker.enable = true; + # Needed occasionally to help the parental units with PC problems + # teamviewer.enable = true; + }; + theme.active = "alucard"; + }; + + + ## Local config + programs.ssh.startAgent = true; + services.openssh.startWhenNeeded = true; + + networking.networkmanager.enable = true; + # The global useDHCP flag is deprecated, therefore explicitly set to false + # here. Per-interface useDHCP will be mandatory in the future, so this + # generated config replicates the default behaviour. + networking.useDHCP = false; + + time.timeZone = "Europe/Copenhagen"; +} diff --git a/hosts/aijiro/hardware-configuration.nix b/hosts/aijiro/hardware-configuration.nix new file mode 100644 index 00000000..3a2c0dd1 --- /dev/null +++ b/hosts/aijiro/hardware-configuration.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, inputs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" "nvme" ]; + initrd.kernelModules = [ "dm-snapshot" ]; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + kernelParams = [ + # HACK Disables fixes for spectre, meltdown, L1TF and a number of CPU + # vulnerabilities. Don't copy this blindly! And especially not for + # mission critical or server/headless builds exposed to the world. + "mitigations=off" + ]; + + # Refuse ICMP echo requests on my desktop/laptop; nobody has any business + # pinging them, unlike my servers. + kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = 1; + }; + + # Modules + modules.hardware = { + audio.enable = true; + fs = { + enable = true; + ssd.enable = true; + }; + }; + + # CPU + nix.maxJobs = lib.mkDefault 4; + hardware.cpu.intel.updateMicrocode = true; + # performance gives better battery life/perf than ondemand on sandy bridge and + # newer because of intel pstates. + powerManagement.cpuFreqGovernor = "performance"; + # Without this wpa_supplicant may fail to auto-discover wireless interfaces at + # startup (and must be restarted). + networking.wireless.interfaces = [ "wlp3s0" ]; + + # Storage + fileSystems = { + "/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + options = [ "noatime" ]; + }; + "/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + }; + }; + swapDevices = [ { device = "/dev/disk/by-label/swap"; }]; +}