From 15dfc5c9b770f16575b42f37fa9f96ef40941bf9 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Sat, 30 Jul 2022 19:41:50 -0700 Subject: [PATCH] organize configuration by hardware machine --- nix/system/{ => framework}/configuration.nix | 4 +- .../framework/hardware-configuration.nix | 33 +++++++++++++++ .../{ => worktop}/darwin-configuration.nix | 0 .../configuration.nix} | 4 +- nix/system/xps11/glibc-locale-paths.nix | 39 +++++++++++++++++ nix/system/xps11/hardware-configuration.nix | 42 +++++++++++++++++++ 6 files changed, 118 insertions(+), 4 deletions(-) rename nix/system/{ => framework}/configuration.nix (99%) create mode 100644 nix/system/framework/hardware-configuration.nix rename nix/system/{ => worktop}/darwin-configuration.nix (100%) rename nix/system/{nas-configuration.nix => xps11/configuration.nix} (98%) create mode 100644 nix/system/xps11/glibc-locale-paths.nix create mode 100644 nix/system/xps11/hardware-configuration.nix diff --git a/nix/system/configuration.nix b/nix/system/framework/configuration.nix similarity index 99% rename from nix/system/configuration.nix rename to nix/system/framework/configuration.nix index 8491bde..8ca3f4f 100644 --- a/nix/system/configuration.nix +++ b/nix/system/framework/configuration.nix @@ -8,7 +8,7 @@ imports = [ # Include the results of the hardware scan. - /etc/nixos/hardware-configuration.nix + ./hardware-configuration.nix ]; # Use the systemd-boot EFI boot loader. @@ -57,7 +57,7 @@ # $ nix search wget environment.systemPackages = with pkgs; [ cachix - nixops + nixopsUnstable vim wget zsh diff --git a/nix/system/framework/hardware-configuration.nix b/nix/system/framework/hardware-configuration.nix new file mode 100644 index 0000000..dba33be --- /dev/null +++ b/nix/system/framework/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3c1098ea-7cfd-4285-9d26-6a5d121d1205"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4904-4E9E"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/97c769a2-55da-475a-8dc0-d74d8bbde514"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/nix/system/darwin-configuration.nix b/nix/system/worktop/darwin-configuration.nix similarity index 100% rename from nix/system/darwin-configuration.nix rename to nix/system/worktop/darwin-configuration.nix diff --git a/nix/system/nas-configuration.nix b/nix/system/xps11/configuration.nix similarity index 98% rename from nix/system/nas-configuration.nix rename to nix/system/xps11/configuration.nix index 83f83ae..42a2727 100644 --- a/nix/system/nas-configuration.nix +++ b/nix/system/xps11/configuration.nix @@ -8,8 +8,8 @@ imports = [ # Include the results of the hardware scan. - /etc/nixos/hardware-configuration.nix - /etc/nixos/glibc-locale-paths.nix + ./hardware-configuration.nix + ./glibc-locale-paths.nix ]; # Use the systemd-boot EFI boot loader. diff --git a/nix/system/xps11/glibc-locale-paths.nix b/nix/system/xps11/glibc-locale-paths.nix new file mode 100644 index 0000000..2f9caf1 --- /dev/null +++ b/nix/system/xps11/glibc-locale-paths.nix @@ -0,0 +1,39 @@ +{ config, pkgs, ... }: # multi-glibc-locale-paths.nix + +/* + * Provide version-specific LOCALE_ARCHIVE environment variables to mitigate + * the effects of https://github.com/NixOS/nixpkgs/issues/38991. + */ + +let + + # A random Nixpkgs revision *before* the default glibc + # was switched to version 2.27.x. + oldpkgsSrc = pkgs.fetchFromGitHub { + owner = "nixos"; + repo = "nixpkgs"; + rev = "0252e6ca31c98182e841df494e6c9c4fb022c676"; + sha256 = "1sr5a11sb26rgs1hmlwv5bxynw2pl5w4h5ic0qv3p2ppcpmxwykz"; + }; + + oldpkgs = import oldpkgsSrc {}; + + # A random Nixpkgs revision *after* the default glibc + # was switched to version 2.27.x. + newpkgsSrc = pkgs.fetchFromGitHub { + owner = "nixos"; + repo = "nixpkgs"; + rev = "1d0a71879dac0226272212df7a2463d8eeb8f75b"; + sha256 = "0nh6wfw50lx6wkzyiscfqg6fl6rb17wmncj8jsdvbgmsd6rm95rg"; + }; + + newpkgs = import newpkgsSrc {}; + +in + +{ + environment.sessionVariables = { + LOCALE_ARCHIVE_2_11 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; + LOCALE_ARCHIVE_2_27 = "${newpkgs.glibcLocales}/lib/locale/locale-archive"; + }; +} diff --git a/nix/system/xps11/hardware-configuration.nix b/nix/system/xps11/hardware-configuration.nix new file mode 100644 index 0000000..21b6125 --- /dev/null +++ b/nix/system/xps11/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "nvme" "usbhid" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0c611a53-c0a2-44e9-bfcb-b1eb5a0eb091"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/CD83-9304"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/6383cc5e-aa54-4d75-a7f2-1368df9b6ecf"; } + ]; + + # 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.wlp58s0.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; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +}