From 213430704f89c8ee3d0207ac9bce4ea973b8c37e Mon Sep 17 00:00:00 2001 From: arcnmx Date: Tue, 21 May 2024 12:58:05 -0700 Subject: [PATCH] feat(logistics): autologin --- systems/logistics/hardware-configuration.nix | 49 +++++------ systems/logistics/nixos.nix | 85 ++------------------ 2 files changed, 32 insertions(+), 102 deletions(-) diff --git a/systems/logistics/hardware-configuration.nix b/systems/logistics/hardware-configuration.nix index dfc6566e..bfcb5b21 100644 --- a/systems/logistics/hardware-configuration.nix +++ b/systems/logistics/hardware-configuration.nix @@ -1,21 +1,18 @@ -# 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/nixos.nix instead. { config, - lib, pkgs, - modulesPath, + lib, ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; +}: let + inherit (lib.modules) mkIf; + opengl32 = false; + opencl = false; +in { + boot = { + initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + kernelModules = ["kvm-intel"]; + extraModulePackages = []; + }; fileSystems."/" = { device = "/dev/disk/by-uuid/3331f9a0-6b86-411c-8574-63de28046cf2"; @@ -30,14 +27,18 @@ 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.enp0s31f6.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = "x86_64-linux"; + hardware = { + enableRedistributableFirmware = true; + cpu.intel.updateMicrocode = true; + opengl = { + extraPackages = [ + pkgs.intel-media-driver + (mkIf opencl pkgs.intel-compute-runtime) + ]; + extraPackages32 = mkIf opengl32 [ + pkgs.driversi686Linux.intel-media-driver + ]; + }; + }; } diff --git a/systems/logistics/nixos.nix b/systems/logistics/nixos.nix index b271aa09..d2f65b09 100644 --- a/systems/logistics/nixos.nix +++ b/systems/logistics/nixos.nix @@ -1,9 +1,5 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the nixos.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). { config, - pkgs, meta, lib, ... @@ -19,38 +15,18 @@ in { ./hardware-configuration.nix ]; - # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking networking.networkmanager.enable = true; - # Enable the X11 windowing system. services.xserver.enable = true; - - # Enable the XFCE Desktop Environment. services.xserver.displayManager.lightdm.enable = true; services.xserver.desktopManager.xfce.enable = true; + programs.firefox.enable = true; - # Configure keymap in X11 - services.xserver = { - xkb = { - layout = "us"; - variant = ""; - }; - }; - - # Enable CUPS to print documents. services.printing.enable = true; - # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; @@ -59,62 +35,21 @@ in { alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; }; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.logistics = { uid = 1000; isNormalUser = true; description = "Logistics"; - extraGroups = ["networkmanager" "wheel"]; + extraGroups = ["networkmanager"]; hashedPasswordFile = config.sops.secrets.logistics-user-password.path; - packages = with pkgs; [ - # thunderbird - ]; }; - - # Install firefox. - programs.firefox.enable = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit nixos.nix! The Nano editor is also installed by default. - # wget - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - services.barcodebuddy-scanner.user = "logistics"; - - # Enable the OpenSSH daemon. - services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; + services.displayManager.autoLogin = { + enable = true; + user = "logistics"; + }; sops = { defaultSopsFile = ./secrets.yaml; @@ -129,11 +64,5 @@ in { }; }; - # 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 nixos.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? + system.stateVersion = "23.11"; }