From 6215ce2961248df6ab0d08d7aae214900c582197 Mon Sep 17 00:00:00 2001 From: Jaculabilis Date: Thu, 3 Aug 2023 21:52:49 -0700 Subject: [PATCH] Add unfolder machine configs --- flake.nix | 7 ++ machine/unfolder/default.nix | 94 +++++++++++++++++++++ machine/unfolder/hardware-configuration.nix | 34 ++++++++ 3 files changed, 135 insertions(+) create mode 100644 machine/unfolder/default.nix create mode 100644 machine/unfolder/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index e7cc434..a9ed476 100644 --- a/flake.nix +++ b/flake.nix @@ -64,6 +64,13 @@ ./machine/stagirite ]; }; + unfolder = nixpkgs-next.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.beatific + ./machine/unfolder + ]; + }; }; }; } diff --git a/machine/unfolder/default.nix b/machine/unfolder/default.nix new file mode 100644 index 0000000..f671b2a --- /dev/null +++ b/machine/unfolder/default.nix @@ -0,0 +1,94 @@ +{ config, pkgs, lib, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + beatific.hostName = "unfolder"; + + # Bootloader. + boot.loader.grub = { + enable = true; + device = "/dev/sda"; + }; + + networking.networkmanager.enable = true; + + # Override time zone to PST + time.timeZone = "America/Los_Angeles"; + + # Enable Gnome because it has a virtual keyboard for tablet mode + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + + # keymap configuration + layout = "us"; + xkbVariant = ""; + }; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + systemd.user.services.yoga-rotate = { + enable = false; # TODO + description = "ThinkPad Yoga display rotation"; + #wantedBy = ["multi-user.target"]; + wantedBy = [ "graphical-session.target" ]; + #requires = ["display-manager.service"]; + partOf = [ "graphical-session.target" ]; + #after = ["display-manager.service"]; + path = [ pkgs.gnome-randr ]; + serviceConfig = { + #Type = "simple"; + ExecStart = "${pkgs.python3}/bin/python /home/tvb/rotate.py"; + #KillMode = "process"; + #User = "tvb"; + Restart = "on-failure"; + RestartSec = 5; + }; + #environment = { + # DISPLAY = ":0"; + # XAUTHORITY = "/home/tvb/.Xauthority"; + #}; + }; + + users.users.tvb = { + extraGroups = [ "networkmanager" ]; + packages = with pkgs; [ + gnome-randr python3 + ]; + }; + + environment.systemPackages = with pkgs; [ + firefox + file + unzip + google-chrome + ]; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "google-chrome" + ]; + + networking.firewall = { + enable = true; + }; + + # This value governs how some stateful data, like databases, are handled + # across different versions of NixOS. This should not be changed to a new + # release unless the sysadmin has determined that no services would be + # adversely affected by changing this. + system.stateVersion = "22.11"; +} diff --git a/machine/unfolder/hardware-configuration.nix b/machine/unfolder/hardware-configuration.nix new file mode 100644 index 0000000..17d6b9a --- /dev/null +++ b/machine/unfolder/hardware-configuration.nix @@ -0,0 +1,34 @@ +# 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" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3a4363d6-c437-45ab-9f35-6831eb4a2cd8"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/4a083b38-322e-4d35-9877-a8dc1cda21d5"; } + ]; + + # 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.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}