From 1b659e1fbe9d2b96216e48c50dd43bdd800d1f91 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 29 Sep 2023 15:59:42 +0200 Subject: [PATCH] hosts.garp: init --- flake.nix | 3 +- hosts/garp/default.nix | 115 ++++++++++++++++++++++++++ hosts/garp/hardware-configuration.nix | 38 +++++++++ 3 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 hosts/garp/default.nix create mode 100644 hosts/garp/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 4ffade7..7f49335 100644 --- a/flake.nix +++ b/flake.nix @@ -139,7 +139,8 @@ bolle = mkConfig "bolle" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]); nord = mkConfig "nord" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ]); sopp = mkConfig "sopp" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]); - garp = mkConfig "garp" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia ]); + #garp = mkConfig "garp" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]); + garp = mkConfig "garp" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]); #gomperud smattkuken skrytebiffen skalkesnerken }; diff --git a/hosts/garp/default.nix b/hosts/garp/default.nix new file mode 100644 index 0000000..34f1bda --- /dev/null +++ b/hosts/garp/default.nix @@ -0,0 +1,115 @@ +{ config, pkgs, lib, ... }: +{ + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "pbsds"; + # tmp: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 + systemd.services."getty@tty1".enable = false; + systemd.services."autovt@tty1".enable = false; + + #boot.kernelPackages = pkgs.linuxPackages_latest; + #hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest; + #hardware.nvidia.modesetting.enable = false; # makes atom behave, but mpv refuses to start + + # PRIME: (lspci) + #hardware.nvidia.prime.intelBusId = "PCI:0:02:0"; + #hardware.nvidia.prime.nvidiaBusId = "PCI:1:00:0"; + + imports = [ + ./hardware-configuration.nix + #../../hardware/gpu/cuda.nix + ../../hardware/gpu/intel.nix + ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix + ../../profiles/sshd.nix + ../../profiles/no-suspend.nix + ../../profiles/podman.nix + ../../profiles/docker.nix + + ../../users # home-manager + ../../users/pbsds + + ../../profiles/shell/base.nix + ../../profiles/shell/archives.nix + ../../profiles/shell/nix-utils.nix + #../../profiles/shell/binfmt-emu.nix # qemu won't compile... + + ../../profiles/desktop/base.nix + ../../profiles/desktop/gnome # configures gdm + #../../profiles/desktop/sound/alsa.nix + #../../profiles/desktop/sound/pulseaudio.nix + ../../profiles/desktop/sound/pipewire.nix + + ]; + + networking.firewall.allowedTCPPorts = [ 57621 ]; # spotify local discovery + + # Networking + networking.networkmanager.enable = true; + + + # Installed system packages + environment.systemPackages = with pkgs; [ + cage + weston + ]; + + # TODO: remove? Move? + programs.dconf.enable = true; + + # System fonts + fonts.fontDir.enable = true; # creates /run/current-system/sw/share/X11/fonts + fonts.enableDefaultFonts = true; # dejavu, freefont, gyre, liberation, unifont, noto-fonts-emoji + fonts.fonts = with pkgs; [ + noto-fonts # includes Cousine + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + ]; + + # nvidia bad + #nixpkgs.config.packageOverrides = lib.mkIf (!config.hardware.nvidia.prime.offload.enable) (pkgs: { + nixpkgs.config.packageOverrides = (pkgs: { + teams = pkgs.teams.overrideAttrs (old: rec { + postInstall = (old.postInstall or "") + '' + substituteInPlace $out/share/applications/teams.desktop \ + --replace 'Exec=teams' 'Exec=teams --disable-gpu' + ''; + }); + discord = pkgs.discord.overrideAttrs (old: rec { + desktopItem = old.desktopItem.override (old: { + #exec = "${pkgs.coreutils}/bin/env NIXOS_OZONE_WL=1 ${old.exec}"; + exec = "${pkgs.coreutils-full}/bin/env NIXOS_OZONE_WL=1 Discord"; + }); + postInstall = '' + ln -sf "${desktopItem}/share/applications" $out/share/ + '' + old.postInstall; + }); + slack = pkgs.slack.overrideAttrs (old: { + postInstall = old.postInstall or "" + '' + substituteInPlace $out/share/applications/slack.desktop \ + --replace "$out/bin/slack " "$out/bin/slack --disable-gpu --in-process-gpu " + ''; + }); + element-desktop = pkgs.element-desktop.overrideAttrs (old: { + desktopItem = old.desktopItem.override (old: { + exec = "element-desktop --disable-gpu --in-process-gpu %u"; + }); + }); + }); + + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.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 = "23.05"; # Did you read the comment? +} diff --git a/hosts/garp/hardware-configuration.nix b/hosts/garp/hardware-configuration.nix new file mode 100644 index 0000000..0ac171e --- /dev/null +++ b/hosts/garp/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" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a489fe59-1f67-46a0-8c7a-91adbac021e0"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2663-B2BA"; + 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"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}