From 9f102bdc9e6041f39be01d96f782ac4ecc8d43d9 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 12 Jan 2024 23:31:01 +0100 Subject: [PATCH] feat: add xps config --- flake.lock | 35 +++++++++---- flake.nix | 31 +++++++++++- machines/xps/configuration.nix | 7 +++ machines/xps/hardware-configuration.nix | 66 +++++++++++++++++++++++++ machines/xps/home-mandlm.nix | 11 +++++ 5 files changed, 140 insertions(+), 10 deletions(-) create mode 100644 machines/xps/configuration.nix create mode 100644 machines/xps/hardware-configuration.nix create mode 100644 machines/xps/home-mandlm.nix diff --git a/flake.lock b/flake.lock index 4472ee2..5bc5549 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1704099619, - "narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=", + "lastModified": 1704980875, + "narHash": "sha256-IPZmMjk5f4TBbEpzUFBc3OC1W6OwDNEXk2w/0uVXX1o=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851", + "rev": "5f0ab0eedc6ede69beb8f45561ffefa54edc6e65", "type": "github" }, "original": { @@ -21,13 +21,29 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1705072780, + "narHash": "sha256-PDUkKRjy27NZdCdqcr4wh7in/AqqsHUeILGikwEcbTc=", + "owner": "mandlm", + "repo": "nixos-hardware", + "rev": "9343249680cbaafb7221c12960b9b2985ffceb3b", + "type": "github" + }, + "original": { + "owner": "mandlm", + "ref": "p330", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1704420045, - "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", + "lastModified": 1704874635, + "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", + "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", "type": "github" }, "original": { @@ -39,11 +55,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1704538339, - "narHash": "sha256-1734d3mQuux9ySvwf6axRWZRBhtcZA9Q8eftD6EZg6U=", + "lastModified": 1704722960, + "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46ae0210ce163b3cba6c7da08840c1d63de9c701", + "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d", "type": "github" }, "original": { @@ -56,6 +72,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index c9c58b6..d38e12d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,13 +3,15 @@ nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11; nixpkgs-unstable.url = github:NixOS/nixpkgs/nixos-unstable; + nixos-hardware.url = github:mandlm/nixos-hardware/p330; + home-manager = { url = github:nix-community/home-manager/release-23.11; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, home-manager }: + outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager }: let user = "mandlm"; theme = "dark"; # dark or light @@ -83,6 +85,7 @@ ./users.nix ./machines/p330/configuration.nix ./machines/p330/hardware-configuration.nix + nixos-hardware.nixosModules.lenovo-thinkstation-p330 home-manager.nixosModules.home-manager { @@ -124,6 +127,32 @@ } ]; }; + + xps = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ./greetd.nix + ./users.nix + ./machines/xps/configuration.nix + ./machines/xps/hardware-configuration.nix + nixos-hardware.nixosModules.dell-xps-13-9320 + + home-manager.nixosModules.home-manager + { + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user theme; }; + home-manager.users.${user} = { + imports = [ + ./home-${user}.nix + ./machines/xps/home-${user}.nix + ]; + nixpkgs.config = nixpkgs-config; + nixpkgs.overlays = [ overlay-unstable ]; + }; + } + ]; + }; }; }; } diff --git a/machines/xps/configuration.nix b/machines/xps/configuration.nix new file mode 100644 index 0000000..05e01de --- /dev/null +++ b/machines/xps/configuration.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + networking.hostName = "xps"; + boot.loader.grub.enableCryptodisk = true; +} + diff --git a/machines/xps/hardware-configuration.nix b/machines/xps/hardware-configuration.nix new file mode 100644 index 0000000..bd4ae76 --- /dev/null +++ b/machines/xps/hardware-configuration.nix @@ -0,0 +1,66 @@ +# 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" "thunderbolt" "vmd" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + boot.initrd.luks.devices = { + nixos = { + device = "/dev/disk/by-uuid/1d5f812e-300f-4858-a136-3dc85ac0e0c4"; + preLVM = true; + }; + }; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/058b1bb0-c825-48e6-b951-9b93b6035ca9"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { + device = "/dev/disk/by-uuid/cd7339d9-c5fb-47ff-bff0-38cd1f725241"; + fsType = "ext4"; + }; + + fileSystems."/var/lib/docker" = + { + device = "/dev/disk/by-uuid/b8c81698-4410-4b16-9293-f076772ce4f9"; + fsType = "ext4"; + }; + + fileSystems."/nix" = + { + device = "/dev/disk/by-uuid/ba748b3f-178c-4e3c-9314-66cd5d070e1c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/EE44-9788"; + fsType = "vfat"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/028125a3-2772-4aad-b901-d08783b85f83"; }]; + + # 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.enp0s13f0u1u4u4.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/xps/home-mandlm.nix b/machines/xps/home-mandlm.nix new file mode 100644 index 0000000..6ba273d --- /dev/null +++ b/machines/xps/home-mandlm.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, user, ... }: + +{ + wayland.windowManager.sway.config = { + output = { + eDP-1 = { + scale = "1.3"; + }; + }; + }; +}