Include hardware configuration in repository

This avoids surprises when nixos-generate-config is used on a running
system and an overlayfs for docker that is unavailable in stage 1 is
added to /etc/fstab (because it forces me to read what was changed).
This commit is contained in:
Simon Bruder 2020-08-30 10:03:48 +02:00
parent 5e94daa953
commit 28a74043c4
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
3 changed files with 39 additions and 7 deletions

View file

@ -57,11 +57,11 @@ Add a symlink as the global configuration
sudo mkdir -p /mnt/etc/nixos/ sudo mkdir -p /mnt/etc/nixos/
sudo ln -s /mnt/home/simon/nixos/machines/nunotaba/configuration.nix /mnt/etc/nixos/configuration.nix sudo ln -s /mnt/home/simon/nixos/machines/nunotaba/configuration.nix /mnt/etc/nixos/configuration.nix
Generate hardware configuration and link it to the installation system Generate hardware configuration and copy hardware configuration to machine
(symlinking required because of absolute paths) configuration
sudo nixos-generate-config --root /mnt/ sudo nixos-generate-config --root /mnt/
sudo ln -s /mnt/etc/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix sudo cp /mnt/etc/nixos/hardware-configuration.nix /mnt/home/simon/nixos/machines/nunotaba/hardware-configuration.nix
Install NixOS and reboot (if you do not have another machine, omit Install NixOS and reboot (if you do not have another machine, omit
`--no-root-passwd`) `--no-root-passwd`)
@ -74,12 +74,11 @@ didnt work, first open the luks partition like in the setup script, run `sudo
vgchange -ay` to scan for LVM VGs and then mount the other filesystems like in vgchange -ay` to scan for LVM VGs and then mount the other filesystems like in
the script. the script.
SSH into the machine (or login locally if you set a root password), fix the SSH into the machine (or login locally if you set a root password), set a user
`configuration.nix` symlink, set a user password and clone the dotfiles password and clone the dotfiles
ssh root@machine ssh root@machine
rm /etc/nixos/configuration.nix rm /etc/nixos/configuration.nix
ln -s /home/simon/nixos/machines/nunotaba/configuration.nix /etc/nixos/configuration.nix
passwd simon passwd simon
^D ^D
ssh simon@machine ssh simon@machine

View file

@ -3,7 +3,7 @@
{ {
imports = imports =
[ [
/etc/nixos/hardware-configuration.nix ./hardware-configuration.nix
../../modules/restic.nix ../../modules/restic.nix
../../modules/texlive.nix ../../modules/texlive.nix
../../profiles/base.nix ../../profiles/base.nix

View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
imports =
[
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/8937d1ac-23cb-456f-9c16-e348acc66bb7";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/da2e90cc-1e0c-4691-8807-5d2f4858df6e";
fsType = "ext2";
};
swapDevices =
[
{ device = "/dev/disk/by-uuid/b9ad2d56-fee0-49df-98c1-00d93d991b9f"; }
];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}