diff --git a/hosts/curve/configuration.nix b/hosts/curve/configuration.nix new file mode 100755 index 00000000..9013da7b --- /dev/null +++ b/hosts/curve/configuration.nix @@ -0,0 +1,79 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + # Define on which hard drive you want to install Grub. + boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only + + # Minimal list of modules to use the EFI system partition and the YubiKey + boot.initrd.kernelModules = [ "vfat" "nls_cp437" "nls_iso8859-1" "usbhid" ]; + + # Enable support for the YubiKey PBA + boot.initrd.luks.yubikeySupport = true; + + # Configuration to use your Luks device + boot.initrd.luks.devices = { + "crypthome" = { + device = "/dev/sda2"; + preLVM = true; # You may want to set this to false if you need to start a network service first + yubikey = { + slot = 2; + twoFactor = true; # Set to false if you did not set up a user password. + storage = { + device = "/dev/sda1"; + }; + }; + }; + }; + + # nix = { + # package = pkgs.nixUnstable; + # extraOptions = "experimental-features = nix-command flakes"; + # }; + + networking.hostName = "curve"; # Define your hostname. + networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + time.timeZone = "Australia/Brisbane"; + + networking.useDHCP = false; + networking.interfaces.enp0s31f6.useDHCP = true; + networking.interfaces.wlp3s0.useDHCP = true; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + services.xserver.layout = "us,dvorak"; + + sound.enable = true; + hardware.pulseaudio.enable = true; + + services.xserver.libinput.enable = true; + + users.users.anish = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "21.05"; # Did you read the comment? +} + diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix new file mode 100644 index 00000000..eea22bda --- /dev/null +++ b/hosts/curve/default.nix @@ -0,0 +1,128 @@ +{ pkgs, config, lib, ... }: +{ + imports = [ + ../home.nix + ./hardware-configuration.nix + ./configuration.nix + ]; + + ## Modules + modules = { + desktop = { + bspwm.enable = true; + apps = { + discord.enable = true; + rofi.enable = true; + # godot.enable = true; + signal.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; + + + ## Personal backups + # Syncthing is a bit heavy handed for my needs, so rsync to my NAS instead. + systemd = { + services.backups = { + description = "Backup /usr/store to NAS"; + wants = [ "usr-drive.mount" ]; + path = [ pkgs.rsync ]; + environment = { + SRC_DIR = "/usr/store"; + DEST_DIR = "/usr/drive"; + }; + script = '' + rcp() { + if [[ -d "$1" && -d "$2" ]]; then + echo "---- BACKUPING UP $1 TO $2 ----" + rsync -rlptPJ --chmod=go= --delete --delete-after \ + --exclude=lost+found/ \ + --exclude=@eaDir/ \ + --include=.git/ \ + --filter=':- .gitignore' \ + --filter=':- $XDG_CONFIG_HOME/git/ignore' \ + "$1" "$2" + fi + } + rcp "$HOME/projects/" "$DEST_DIR/projects" + rcp "$SRC_DIR/" "$DEST_DIR" + ''; + serviceConfig = { + Type = "oneshot"; + Nice = 19; + IOSchedulingClass = "idle"; + User = config.user.name; + Group = config.user.group; + }; + }; + timers.backups = { + wantedBy = [ "timers.target" ]; + partOf = [ "backups.service" ]; + timerConfig.OnCalendar = "*-*-* 00,12:00:00"; + timerConfig.Persistent = true; + }; + }; +} diff --git a/hosts/curve/hardware-configuration.nix b/hosts/curve/hardware-configuration.nix new file mode 100644 index 00000000..9b8a0228 --- /dev/null +++ b/hosts/curve/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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 = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6ee9d430-1b1b-4e39-bced-606145570a78"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/6ee9d430-1b1b-4e39-bced-606145570a78"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/AD0C-92EF"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/5486bd9f-6826-4ac7-b09b-8768a35c331f"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +}