From b2cb274c0dd673f8d602665ab114c3ed886f1e07 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 26 Jul 2024 19:59:54 -0400 Subject: [PATCH] thelio76: factor out system conf --- .gitignore | 1 + config/hosts/nixos76/default.nix | 6 +- config/hosts/thelio76/default.nix | 69 ++++++++++++------- .../hosts/thelio76/hardware-configuration.nix | 49 ------------- config/modules/system76-pc.nix | 13 ---- result | 1 - 6 files changed, 49 insertions(+), 90 deletions(-) create mode 100644 .gitignore delete mode 100644 config/hosts/thelio76/hardware-configuration.nix delete mode 120000 result diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2f5dd2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result \ No newline at end of file diff --git a/config/hosts/nixos76/default.nix b/config/hosts/nixos76/default.nix index 16b4f23..07466cb 100644 --- a/config/hosts/nixos76/default.nix +++ b/config/hosts/nixos76/default.nix @@ -1,8 +1,6 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running `nixos-help`). +# This file merged the original configuration.nix and hardware-configuration.nix files, refactoring common system config out -{ config, pkgs, ... }: +{ config, lib, pkgs, modulesPath, ... }: { imports = diff --git a/config/hosts/thelio76/default.nix b/config/hosts/thelio76/default.nix index 3da3ff0..8866188 100644 --- a/config/hosts/thelio76/default.nix +++ b/config/hosts/thelio76/default.nix @@ -1,37 +1,61 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, ... }: +# This file merged the original configuration.nix and hardware-configuration.nix files, refactoring common system config out +{ config, lib, pkgs, modulesPath, ... }: { imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix + (modulesPath + "/installer/scan/not-detected.nix") ../../modules/system76-pc.nix ]; networking.hostName = "thelio76"; # Define your hostname. - # 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; - # }; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; - # List services that you want to enable: + boot.initrd.luks.devices."luks-b748a776-5e2c-4809-927e-1f4c051b9460".device = "/dev/disk/by-uuid/b748a776-5e2c-4809-927e-1f4c051b9460"; + boot.initrd.luks.devices."luks-7d758c82-9079-46a6-8bb2-05d5016ed623".device = "/dev/disk/by-uuid/7d758c82-9079-46a6-8bb2-05d5016ed623"; - # Enable the OpenSSH daemon. - # services.openssh.enable = true; + environment.etc.crypttab.text = '' + luks-9870176e-53f3-493e-94d8-560994fa8f35 UUID=9870176e-53f3-493e-94d8-560994fa8f35 /luks-9870176e-53f3-493e-94d8-560994fa8f35 nofail + ''; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/5b17c208-6c1b-4317-b59c-6596b1857f1f"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/EB52-074B"; + fsType = "vfat"; + }; + + "/run/media/alex/External" = { + device = "/dev/disk/by-uuid/5057a0e6-649f-487f-a17c-11e379f9af19"; + fsType = "auto"; + }; + + "/home/alex/Documents" = { + device = "/run/media/alex/External/Documents"; + options = [ "bind" ]; + }; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/19de8142-e695-4425-a8cc-27e062204882"; }]; + + # 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; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions @@ -40,5 +64,4 @@ # 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 = "24.05"; # Did you read the comment? - } diff --git a/config/hosts/thelio76/hardware-configuration.nix b/config/hosts/thelio76/hardware-configuration.nix deleted file mode 100644 index f1e4ad7..0000000 --- a/config/hosts/thelio76/hardware-configuration.nix +++ /dev/null @@ -1,49 +0,0 @@ -# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { - device = "/dev/disk/by-uuid/5b17c208-6c1b-4317-b59c-6596b1857f1f"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-b748a776-5e2c-4809-927e-1f4c051b9460".device = "/dev/disk/by-uuid/b748a776-5e2c-4809-927e-1f4c051b9460"; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/EB52-074B"; - fsType = "vfat"; - }; - - swapDevices = - [{ device = "/dev/disk/by-uuid/19de8142-e695-4425-a8cc-27e062204882"; }]; - - fileSystems."/run/media/alex/External" = - { - device = "/dev/disk/by-uuid/5057a0e6-649f-487f-a17c-11e379f9af19"; - fsType = "auto"; - }; - # 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.enp9s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/config/modules/system76-pc.nix b/config/modules/system76-pc.nix index d83bdcb..ba28e16 100644 --- a/config/modules/system76-pc.nix +++ b/config/modules/system76-pc.nix @@ -19,19 +19,6 @@ boot.plymouth.enable = true; boot.plymouth.theme = "fade-in"; - boot.initrd.luks.devices."luks-7d758c82-9079-46a6-8bb2-05d5016ed623".device = "/dev/disk/by-uuid/7d758c82-9079-46a6-8bb2-05d5016ed623"; - environment.etc.crypttab.text = '' - luks-9870176e-53f3-493e-94d8-560994fa8f35 UUID=9870176e-53f3-493e-94d8-560994fa8f35 /luks-9870176e-53f3-493e-94d8-560994fa8f35 nofail - ''; - - - fileSystems."/home/alex/Documents" = { - device = "/run/media/alex/External/Documents"; - options = [ "bind" ]; - }; - - # networking.hostName = "thelio76"; # Define your hostname. - # Enable networking networking.networkmanager.enable = true; diff --git a/result b/result deleted file mode 120000 index 9d064da..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/pxvalw02c9k1jmr43d6xk12wqyriqn72-nixos-system-thelio76-24.11.20240716.ad0b5ee \ No newline at end of file