diff options
| author | Caroline Larimore <caroline@larimo.re> | 2024-07-18 23:39:42 -0700 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2024-07-18 23:39:42 -0700 |
| commit | 65174b4b5c05bb143e6681a4cbcd0a95f04987e2 (patch) | |
| tree | 35383af43f2aa972b316dd12e1d5d1bd5df84086 /hosts/c-pc | |
| parent | 15c5050590415fd64e984e994ec77186918cf7b7 (diff) | |
Begin modularization!
Diffstat (limited to 'hosts/c-pc')
| -rw-r--r-- | hosts/c-pc/configuration.nix | 139 | ||||
| -rw-r--r-- | hosts/c-pc/hardware-configuration.nix | 51 | ||||
| -rw-r--r-- | hosts/c-pc/home.nix | 130 | ||||
| -rw-r--r-- | hosts/c-pc/networking.nix | 27 |
4 files changed, 347 insertions, 0 deletions
diff --git a/hosts/c-pc/configuration.nix b/hosts/c-pc/configuration.nix new file mode 100644 index 0000000..73797ea --- /dev/null +++ b/hosts/c-pc/configuration.nix @@ -0,0 +1,139 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./networking.nix + ../../roles + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + fileSystems."/persist".neededForBoot = true; + environment.persistence."/persist/system" = { + hideMounts = true; + directories = [ + "/etc/nixos" + "/var/log" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + #"/var/lib/bluetooth" + ]; + files = [ + "/etc/machine-id" + ]; + }; + + programs.fuse.userAllowOther = true; + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + "c" = import ./home.nix; + }; + }; + + environment = { + localBinInPath = true; + + interactiveShellInit = '' + alias kitty-ssh="kitty +kitten ssh" + + alias lsa="ls -lAsh" + alias c="codium ." + alias p="nix-shell -p" + + mkcd() { + mkdir -p "$1" + cd "$1" + } + ''; + + variables = { + EDITOR = "${pkgs.vim}/bin/vim"; + }; + }; + + time.timeZone = "America/Los_Angeles"; + + users.users = { + root.hashedPasswordFile = "/persist/secrets/passwords/root"; + + "c" = { + isNormalUser = true; + hashedPasswordFile = "/persist/secrets/passwords/c"; + extraGroups = [ "wheel" ]; + }; + }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-run" + ]; + + roles = { + desktop.enable = true; + }; + + programs = { + steam.enable = true; + + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + dconf.enable = true; + }; + + services = { + pcscd.enable = true; + printing.enable = true; + }; + + environment.systemPackages = with pkgs; [ + (writeShellScriptBin "rb" "sudo nixos-rebuild switch --flake /etc/nixos#default") + (writeShellScriptBin "rbf" "sudo nixos-rebuild switch --flake path:/etc/nixos#default") + (writeShellScriptBin "toys" "nix-shell -p cmatrix asciiquarium pipes cowsay figlet neofetch") + + git + vim + wget + firefox + wineWowPackages.stable + winetricks + + pulseaudio + playerctl + + ffmpeg + jellyfin + + killall + + go + jdk21 + + lutris + libGL + ]; + + # 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. + # + # 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 = "23.11"; # Did you read the comment? 🤨 +} + diff --git a/hosts/c-pc/hardware-configuration.nix b/hosts/c-pc/hardware-configuration.nix new file mode 100644 index 0000000..c268ff8 --- /dev/null +++ b/hosts/c-pc/hardware-configuration.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot = { + loader.grub = { + enable = true; + + zfsSupport = true; + efiSupport = true; + efiInstallAsRemovable = true; + mirroredBoots = [ + { devices = [ "nodev" ]; path = "/boot"; } + ]; + }; + + initrd = { + availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + kernelModules = [ "amdgpu" ]; + + postDeviceCommands = lib.mkAfter '' + zfs rollback -r zpool/root@blank && zfs rollback -r zpool/home@blank + ''; + }; + + kernelModules = [ "kvm-amd" ]; + extraModulePackages = [ ]; + + supportedFilesystems = [ "ntfs" ]; + }; + + fileSystems = { + "/" = { fsType = "zfs"; device = "zpool/root"; }; + "/home" = { fsType = "zfs"; device = "zpool/home"; }; + "/persist" = { fsType = "zfs"; device = "zpool/persist"; }; + "/nix" = { fsType = "zfs"; device = "zpool/nix"; }; + + "/boot" = { fsType = "vfat"; device = "/dev/disk/by-uuid/12CE-A600"; }; + + "/mnt/4tb" = { fsType = "ext4"; device = "/dev/disk/by-label/4tb"; }; + "/mnt/ssd" = { fsType = "ext4"; device = "/dev/disk/by-label/ssd-256"; }; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/c-pc/home.nix b/hosts/c-pc/home.nix new file mode 100644 index 0000000..9ee1988 --- /dev/null +++ b/hosts/c-pc/home.nix @@ -0,0 +1,130 @@ +{ lib, pkgs, inputs, config, ...}: + +{ + imports = [ + inputs.impermanence.nixosModules.home-manager.impermanence + + ../../home + ]; + + # theme.nix is an untracked symlink to a theme under ./themes/ + # This lets me switch out my theme without making changes in git + theme = import ../../theme.nix; + + home.stateVersion = "23.11"; + + home.persistence."/persist/home" = { + directories = [ + "Downloads" + "Documents" + "Pictures" + "Videos" + "Music" + "Games" + "Persist" + + "code" + + ".gnupg" + ".ssh" + + ".local/bin" + ".local/share/applications" + + ".mozilla" + ".wine" + + ".irssi" + ".config/discord" + ".config/Vencord" + ".config/vesktop" + + ".config/Obsidian" + + ".config/cmus" + + ".config/fcitx" + ".config/fcitx5" + + { + directory = ".local/share/Steam"; + method = "symlink"; + } + + ".config/qBittorrent" + ".local/share/qBittorrent" + ".cache/qBittorrent" + + ".config/jellyfin" + ".local/share/jellyfin" + ".cache/jellyfin" + + ".local/share/Anki2" + ".local/share/lutris" + ".local/share/PrismLauncher" + + ".config/nicotine" + ".local/share/nicotine" + ]; + files = [ + ".Xresources" + ]; + allowOther = true; + }; + + programs = { + feh.enable = true; + btop.enable = true; + tmux.enable = true; + + zoxide.enable = true; + }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "discord" + "obsidian" + ]; + + home.packages = with pkgs; [ + (writeShellScriptBin "switch-theme" '' + #!/usr/bin/env bash + + cd /etc/nixos + + rm theme.nix + ln -s ./themes/$1.nix theme.nix + + sudo nixos-rebuild switch --flake /etc/nixos#default + + i3-msg restart + '') + + pfetch + + kdePackages.breeze + + irssi + + qbittorrent + nicotine-plus + jellyfin-media-player + mkvtoolnix + + gimp + + anki-bin + + obsidian + prismlauncher + + #TODO: latest update broke + # jetbrains.idea-community + + cloc + cmus + ]; + + home.file = { + ".0b".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/share/PrismLauncher/instances/0b/.minecraft"; + }; +} diff --git a/hosts/c-pc/networking.nix b/hosts/c-pc/networking.nix new file mode 100644 index 0000000..31632c1 --- /dev/null +++ b/hosts/c-pc/networking.nix @@ -0,0 +1,27 @@ +{ ... }: + +{ + networking = { + hostName = "c-pc"; + hostId = "23ce94ff"; + + useDHCP = true; + + wireless = { + enable = true; + + environmentFile = "/persist/secrets/wireless.env"; + networks = { + "The Dwyers".psk = "@PSK@"; + }; + }; + + firewall = { + enable = false; + + allowedTCPPorts = [ 8096 50000 ]; + allowedUDPPorts = [ ]; + }; + }; +} + |