From 58c11145319b9b4c83880d7ff5c8922d678ea687 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Thu, 12 Jan 2023 18:49:45 -0800 Subject: [PATCH] Configure desktop --- hosts/default.nix | 27 ++++++++++++++++ hosts/desktop/default.nix | 29 +++++++++++++++++ hosts/desktop/hardware-configuration.nix | 40 ++++++++++++++++++++++++ hosts/desktop/home.nix | 5 +++ hosts/desktop/i3.nix | 14 +++++++++ i3.nix | 4 +++ 6 files changed, 119 insertions(+) create mode 100644 hosts/desktop/default.nix create mode 100644 hosts/desktop/hardware-configuration.nix create mode 100644 hosts/desktop/home.nix create mode 100644 hosts/desktop/i3.nix diff --git a/hosts/default.nix b/hosts/default.nix index 7b9e7f6..5b258fb 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -9,6 +9,33 @@ let lib = nixpkgs.lib; in { + desktop = lib.nixosSystem { + inherit system; + specialArgs = { inherit user; }; + modules = [ + ./desktop + ./configuration.nix + ./desktop.nix + { + boot.loader.grub.gfxmodeEfi = "1920x1080"; + networking.hostName = "${user}"; + } + home-manager.nixosModules.home-manager { + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit user; }; + users.${user} = { + imports = [ + (import ./home.nix) + (import ./desktop/home.nix) + ]; + }; + }; + } + ]; + }; + + x220 = lib.nixosSystem { inherit system; specialArgs = { inherit user; }; diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix new file mode 100644 index 0000000..13ca7a7 --- /dev/null +++ b/hosts/desktop/default.nix @@ -0,0 +1,29 @@ +{ ... }: + +{ + imports = [ (import ./hardware-configuration.nix) ]; + + services.xserver = { + videoDrivers = [ "nvidia" ]; + # nvidiaXineramaInfoOrder sets primary display + # DFP-0 is default and would set left monitor, DVI-D-0, to be primary + screenSection = '' + Option "metamodes" "DVI-D-0: 1920x1080 +0+0, HDMI-0: 1920x1080 +1920+0, DP-3: 1920x1080 +1920+0" + Option "nvidiaXineramaInfoOrder" "DFP-1" + ''; + }; + + hardware.opengl.enable = true; + + boot.loader = { + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + grub = { + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + }; +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..b49d1f0 --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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 = [ ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelModules = [ "kvm-intel" "coretemp" ]; + boot.extraModulePackages = [ ]; + + hardware.enableAllFirmware = true; + hardware.enableRedistributableFirmware = true; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-label/boot"; + 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.eno2.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; +} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix new file mode 100644 index 0000000..c844f5c --- /dev/null +++ b/hosts/desktop/home.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + imports = [ (import ./i3.nix) ]; +} diff --git a/hosts/desktop/i3.nix b/hosts/desktop/i3.nix new file mode 100644 index 0000000..066d034 --- /dev/null +++ b/hosts/desktop/i3.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + xsession.windowManager.i3.config.workspaceOutputAssign = [ + { + output = "HDMI-0"; + workspace = "1"; + } + { + output = "DVI-D-0"; + workspace = "2"; + } + ]; +} diff --git a/i3.nix b/i3.nix index 8072f62..1bcb753 100644 --- a/i3.nix +++ b/i3.nix @@ -100,6 +100,10 @@ in { command = "border pixel 0"; criteria = { class = "^.*"; }; } + { + command = "floating enable"; + criteria = { class = "Nextcloud"; }; + } ]; bars = []; };