From d0de6f707784cc15b734ac6d650939280618efbd Mon Sep 17 00:00:00 2001 From: Tyler Starr Date: Sun, 23 Jul 2023 14:38:24 -0700 Subject: [PATCH] create Torus config --- provision/nixos/hosts/torus/configuration.nix | 125 ++++++++++++++++++ provision/nixos/hosts/torus/flake.lock | 49 +++++++ provision/nixos/hosts/torus/flake.nix | 41 ++++++ provision/nixos/hosts/torus/hardware.nix | 62 +++++++++ .../nixos/hosts/torus/home-configuration.nix | 14 ++ 5 files changed, 291 insertions(+) create mode 100644 provision/nixos/hosts/torus/configuration.nix create mode 100644 provision/nixos/hosts/torus/flake.lock create mode 100644 provision/nixos/hosts/torus/flake.nix create mode 100644 provision/nixos/hosts/torus/hardware.nix create mode 100644 provision/nixos/hosts/torus/home-configuration.nix diff --git a/provision/nixos/hosts/torus/configuration.nix b/provision/nixos/hosts/torus/configuration.nix new file mode 100644 index 00000000..08a2a3c5 --- /dev/null +++ b/provision/nixos/hosts/torus/configuration.nix @@ -0,0 +1,125 @@ +{ config, pkgs, user, lib, ... }: +{ + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + + settings.auto-optimise-store = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + # Add non-free packages + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = import ../../lib/overlays.nix; + + # Use zen kernel + boot.kernelPackages = pkgs.linuxPackages_zen; + + # Hardware options + hardware.bluetooth.enable = true; + hardware.sensor.iio.enable = true; + hardware.opengl.enable = true; + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Set networking options + networking.hostName = "kestrel"; + networking.networkmanager.enable = true; + networking.firewall.checkReversePath = "loose"; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + + # Add fonts + fonts.fonts = with pkgs; [ + nerdfonts + ]; + + # Enable virtualisation + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; + + # Enable zsh + programs.zsh.enable = true; + + # Define user account. + users.users.${user} = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + git + killall + pciutils + syncthing + pinentry-curses + trash-cli + unzip + nnn + ]; + + # Enable user services + services = { + gvfs.enable = true; # USB automount + blueman.enable = true; + printing.enable = true; + printing.drivers = [ pkgs.hplip ]; + avahi.enable = true; + avahi.nssmdns = true; + syncthing = { + enable = true; + user = "${user}"; + dataDir = "/home/${user}/sync"; + configDir = "/home/${user}/.config/syncthing"; + }; + }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.pcscd.enable = true; + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "curses"; + enableSSHSupport = true; + }; + + # Enable modules + imports = [ ../../modules ]; + modules = { + services = { + samba.enable = true; + }; + devel = { + tooling.enable = true; + python.enable = true; + engineering.enable = true; + }; + gaming = { + steam.enable = true; + }; + desktop = { + sway.enable = true; + }; + }; + + system.stateVersion = "23.05"; # Did you read the comment? +} diff --git a/provision/nixos/hosts/torus/flake.lock b/provision/nixos/hosts/torus/flake.lock new file mode 100644 index 00000000..1aa2ea43 --- /dev/null +++ b/provision/nixos/hosts/torus/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687871164, + "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688939073, + "narHash": "sha256-jYhYjeK5s6k8QS3i+ovq9VZqBJaWbxm7awTKNhHL9d0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8df7a67abaf8aefc8a2839e0b48f92fdcf69a38b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/provision/nixos/hosts/torus/flake.nix b/provision/nixos/hosts/torus/flake.nix new file mode 100644 index 00000000..56180992 --- /dev/null +++ b/provision/nixos/hosts/torus/flake.nix @@ -0,0 +1,41 @@ +{ + description = "Flake for kestrel configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + home-manager = { + url = github:nix-community/home-manager/release-23.05; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { self, nixpkgs, home-manager, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + user = "tstarr"; + in { + nixosConfigurations = { + kestrel = lib.nixosSystem { + inherit system; + specialArgs = { inherit user; }; + modules = [ + ./configuration.nix + ./hardware.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user} = { + imports = [ ./home-configuration.nix ]; + }; + } + ]; + }; + }; + }; +} diff --git a/provision/nixos/hosts/torus/hardware.nix b/provision/nixos/hosts/torus/hardware.nix new file mode 100644 index 00000000..5d7eaad9 --- /dev/null +++ b/provision/nixos/hosts/torus/hardware.nix @@ -0,0 +1,62 @@ +# 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" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/873ccce0-c706-4ef4-b7d1-748e93e54aae"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/873ccce0-c706-4ef4-b7d1-748e93e54aae"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/873ccce0-c706-4ef4-b7d1-748e93e54aae"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/persist" = + { device = "/dev/disk/by-uuid/873ccce0-c706-4ef4-b7d1-748e93e54aae"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + }; + + fileSystems."/var/log" = + { device = "/dev/disk/by-uuid/873ccce0-c706-4ef4-b7d1-748e93e54aae"; + fsType = "btrfs"; + options = [ "subvol=log" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/37EE-81E0"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/provision/nixos/hosts/torus/home-configuration.nix b/provision/nixos/hosts/torus/home-configuration.nix new file mode 100644 index 00000000..05e3b652 --- /dev/null +++ b/provision/nixos/hosts/torus/home-configuration.nix @@ -0,0 +1,14 @@ +{ config, pkgs, user, ... }: +{ + home.username = "${user}"; + home.homeDirectory = "/home/${user}"; + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + chezmoi + rbw + zk + ]; + + home.stateVersion = "23.05"; +}