From 77f72ac939387a4b4d13abec212fac49800a31a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:27:08 +0200 Subject: [PATCH 01/16] Add common directory --- common/main.nix | 6 ++++++ xeon07/configuration.nix | 1 + 2 files changed, 7 insertions(+) create mode 100644 common/main.nix diff --git a/common/main.nix b/common/main.nix new file mode 100644 index 0000000..7a0ec5c --- /dev/null +++ b/common/main.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ]; +} diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 11916ca..282c5dd 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -2,6 +2,7 @@ { imports = [ + ../common/main.nix ./hardware-configuration.nix ./boot.nix -- GitLab From 9e3bdaabb6d72dd5ba72eedde615d80fb2e8ce4e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:28:37 +0200 Subject: [PATCH 02/16] Move disk selection to configuration.nix --- xeon07/boot.nix | 3 --- xeon07/configuration.nix | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xeon07/boot.nix b/xeon07/boot.nix index 56a2a31..bd8f5a4 100644 --- a/xeon07/boot.nix +++ b/xeon07/boot.nix @@ -5,9 +5,6 @@ boot.loader.grub.enable = true; boot.loader.grub.version = 2; - # Select the this using the ID to avoid mismatches - boot.loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSC2BB240G7_PHDV6462004Y240AGN"; - # Enable GRUB2 serial console boot.loader.grub.extraConfig = '' serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 282c5dd..a2fc393 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -19,6 +19,9 @@ ]; + # Select the this using the ID to avoid mismatches + boot.loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSC2BB240G7_PHDV6462004Y240AGN"; + systemd.services."serial-getty@ttyS0" = { enable = true; wantedBy = [ "getty.target" ]; -- GitLab From b043ee3b1dd6a9a6d48ab0180f4e8f3ab5125eb7 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:30:02 +0200 Subject: [PATCH 03/16] Move boot.nix to common --- {xeon07 => common}/boot.nix | 0 common/main.nix | 1 + xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/boot.nix (100%) diff --git a/xeon07/boot.nix b/common/boot.nix similarity index 100% rename from xeon07/boot.nix rename to common/boot.nix diff --git a/common/main.nix b/common/main.nix index 7a0ec5c..a5308a3 100644 --- a/common/main.nix +++ b/common/main.nix @@ -2,5 +2,6 @@ { imports = [ + ./boot.nix ]; } diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index a2fc393..d0827e4 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -5,7 +5,6 @@ ../common/main.nix ./hardware-configuration.nix - ./boot.nix ./fs.nix ./gitlab-runner.nix ./monitoring.nix -- GitLab From 57ed0cf319f81efcdd74259ac275c165dd351174 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:31:35 +0200 Subject: [PATCH 04/16] Move fs.nix to common --- {xeon07 => common}/fs.nix | 0 common/main.nix | 1 + xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/fs.nix (100%) diff --git a/xeon07/fs.nix b/common/fs.nix similarity index 100% rename from xeon07/fs.nix rename to common/fs.nix diff --git a/common/main.nix b/common/main.nix index a5308a3..7cc9fac 100644 --- a/common/main.nix +++ b/common/main.nix @@ -3,5 +3,6 @@ { imports = [ ./boot.nix + ./fs.nix ]; } diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index d0827e4..e9e55af 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -5,7 +5,6 @@ ../common/main.nix ./hardware-configuration.nix - ./fs.nix ./gitlab-runner.nix ./monitoring.nix ./net.nix -- GitLab From 7e82885d845c3d39ad10504301c2e85142d3ac58 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:34:27 +0200 Subject: [PATCH 05/16] Use partition labels for / and swap --- xeon07/hardware-configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xeon07/hardware-configuration.nix b/xeon07/hardware-configuration.nix index c69f868..b14b375 100644 --- a/xeon07/hardware-configuration.nix +++ b/xeon07/hardware-configuration.nix @@ -14,12 +14,12 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/289f78d9-b339-47de-b321-0a6796b9a79b"; + { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/disk/by-uuid/2bac02f9-7ea1-4868-9536-23710f19baca"; } + [ { device = "/dev/disk/by-label/swap"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking -- GitLab From 9528fab3ef5f712ef0cd8751717f39a4203840bf Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:35:58 +0200 Subject: [PATCH 06/16] Move filesystems config to common/fs.nix --- common/fs.nix | 9 +++++++++ xeon07/hardware-configuration.nix | 18 ------------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/common/fs.nix b/common/fs.nix index 7d8e36d..60fccef 100644 --- a/common/fs.nix +++ b/common/fs.nix @@ -1,6 +1,15 @@ { ... }: { + fileSystems."/" = + { device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-label/swap"; } + ]; + # Mount the home via NFS fileSystems."/home" = { device = "10.0.40.30:/home"; diff --git a/xeon07/hardware-configuration.nix b/xeon07/hardware-configuration.nix index b14b375..7c7a591 100644 --- a/xeon07/hardware-configuration.nix +++ b/xeon07/hardware-configuration.nix @@ -13,24 +13,6 @@ boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - }; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } - ]; - - # 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.eth0.useDHCP = lib.mkDefault true; - # networking.interfaces.eth1.useDHCP = lib.mkDefault true; - # networking.interfaces.ib0.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; -- GitLab From b44afdaaa178ed79bcdd6617ba8dc392feedd920 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:37:01 +0200 Subject: [PATCH 07/16] Move boot config to common/boot.nix --- common/boot.nix | 5 +++++ xeon07/hardware-configuration.nix | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/boot.nix b/common/boot.nix index bd8f5a4..cf85951 100644 --- a/common/boot.nix +++ b/common/boot.nix @@ -26,4 +26,9 @@ HWLAT_TRACER = yes; }; }; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "ehci_pci" "nvme" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; } diff --git a/xeon07/hardware-configuration.nix b/xeon07/hardware-configuration.nix index 7c7a591..7e4112c 100644 --- a/xeon07/hardware-configuration.nix +++ b/xeon07/hardware-configuration.nix @@ -8,11 +8,6 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "ehci_pci" "nvme" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -- GitLab From 79bd4398f33eca7b8305b7efd4165cb12ffb1275 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:38:08 +0200 Subject: [PATCH 08/16] Move the remaining hw config to common --- xeon07/hardware-configuration.nix => common/hw.nix | 0 common/main.nix | 1 + xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename xeon07/hardware-configuration.nix => common/hw.nix (100%) diff --git a/xeon07/hardware-configuration.nix b/common/hw.nix similarity index 100% rename from xeon07/hardware-configuration.nix rename to common/hw.nix diff --git a/common/main.nix b/common/main.nix index 7cc9fac..3a766b4 100644 --- a/common/main.nix +++ b/common/main.nix @@ -4,5 +4,6 @@ imports = [ ./boot.nix ./fs.nix + ./hw.nix ]; } diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index e9e55af..4c9d09f 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -3,7 +3,6 @@ { imports = [ ../common/main.nix - ./hardware-configuration.nix ./gitlab-runner.nix ./monitoring.nix -- GitLab From 8f66ba824ae65b3de2f8d7026861c14bc4dcb76d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:43:23 +0200 Subject: [PATCH 09/16] Move common options from configuration.nix --- common/main.nix | 41 ++++++++++++++++++++++++++++++++++++++++ xeon07/configuration.nix | 38 ------------------------------------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/common/main.nix b/common/main.nix index 3a766b4..690ae75 100644 --- a/common/main.nix +++ b/common/main.nix @@ -6,4 +6,45 @@ ./fs.nix ./hw.nix ]; + + environment.systemPackages = with pkgs; [ + vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option + nix-diff ipmitool freeipmi ethtool lm_sensors + ]; + + systemd.services."serial-getty@ttyS0" = { + enable = true; + wantedBy = [ "getty.target" ]; + serviceConfig.Restart = "always"; + }; + + time.timeZone = "Europe/Madrid"; + i18n.defaultLocale = "en_DK.UTF-8"; + + environment.variables = { + EDITOR = "vim"; + VISUAL = "vim"; + }; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.sandbox = "relaxed"; + nix.settings.trusted-users = [ "@wheel" ]; + nix.gc.automatic = true; + nix.gc.dates = "weekly"; + + programs.zsh.enable = true; + programs.zsh.histSize = 100000; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + system.copySystemConfiguration = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # 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 = "22.11"; # Did you read the comment? } diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 4c9d09f..3406db5 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -19,45 +19,7 @@ # Select the this using the ID to avoid mismatches boot.loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSC2BB240G7_PHDV6462004Y240AGN"; - systemd.services."serial-getty@ttyS0" = { - enable = true; - wantedBy = [ "getty.target" ]; - serviceConfig.Restart = "always"; - }; - - time.timeZone = "Europe/Madrid"; - i18n.defaultLocale = "en_DK.UTF-8"; - environment.systemPackages = with pkgs; [ - vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option - nix-diff ipmitool freeipmi ethtool lm_sensors (pkgs.callPackage {}) ]; - - environment.variables = { - EDITOR = "vim"; - VISUAL = "vim"; - }; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nix.settings.sandbox = "relaxed"; - nix.settings.trusted-users = [ "@wheel" ]; - nix.gc.automatic = true; - nix.gc.dates = "weekly"; - - programs.zsh.enable = true; - programs.zsh.histSize = 100000; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - system.copySystemConfiguration = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # 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 = "22.11"; # Did you read the comment? } -- GitLab From dfab84b0ba12883e2c799b923d44d7e966ce543b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:45:10 +0200 Subject: [PATCH 10/16] Move users.nix to common --- common/main.nix | 1 + {xeon07 => common}/users.nix | 0 xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/users.nix (100%) diff --git a/common/main.nix b/common/main.nix index 690ae75..84217f8 100644 --- a/common/main.nix +++ b/common/main.nix @@ -5,6 +5,7 @@ ./boot.nix ./fs.nix ./hw.nix + ./users.nix ]; environment.systemPackages = with pkgs; [ diff --git a/xeon07/users.nix b/common/users.nix similarity index 100% rename from xeon07/users.nix rename to common/users.nix diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 3406db5..2236f06 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -11,7 +11,6 @@ ./overlays.nix ./slurm.nix ./ssh.nix - ./users.nix ]; -- GitLab From 55f784e6b742565ab5d8b8e5bc4872ac05a35f51 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:46:01 +0200 Subject: [PATCH 11/16] Move overlays.nix to common --- common/main.nix | 1 + {xeon07 => common}/overlays.nix | 0 xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/overlays.nix (100%) diff --git a/common/main.nix b/common/main.nix index 84217f8..fb1b4a4 100644 --- a/common/main.nix +++ b/common/main.nix @@ -5,6 +5,7 @@ ./boot.nix ./fs.nix ./hw.nix + ./overlays.nix ./users.nix ]; diff --git a/xeon07/overlays.nix b/common/overlays.nix similarity index 100% rename from xeon07/overlays.nix rename to common/overlays.nix diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 2236f06..45367d0 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -8,7 +8,6 @@ ./monitoring.nix ./net.nix ./nfs.nix - ./overlays.nix ./slurm.nix ./ssh.nix -- GitLab From b568bb36d4f0104c6e9ee2c36e3369a22cf988f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:46:53 +0200 Subject: [PATCH 12/16] Move ssh.nix to common --- common/main.nix | 1 + {xeon07 => common}/ssh.nix | 0 xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/ssh.nix (100%) diff --git a/common/main.nix b/common/main.nix index fb1b4a4..abe1426 100644 --- a/common/main.nix +++ b/common/main.nix @@ -6,6 +6,7 @@ ./fs.nix ./hw.nix ./overlays.nix + ./ssh.nix ./users.nix ]; diff --git a/xeon07/ssh.nix b/common/ssh.nix similarity index 100% rename from xeon07/ssh.nix rename to common/ssh.nix diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 45367d0..0715162 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -9,7 +9,6 @@ ./net.nix ./nfs.nix ./slurm.nix - ./ssh.nix ]; -- GitLab From c3a2766bb738bbac9da94e89acc748c30f1f41f5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:49:54 +0200 Subject: [PATCH 13/16] Remove host specific network options from net.nix --- xeon07/configuration.nix | 12 ++++++++++++ xeon07/net.nix | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 0715162..faafe0b 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -16,6 +16,18 @@ # Select the this using the ID to avoid mismatches boot.loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSC2BB240G7_PHDV6462004Y240AGN"; + networking = { + hostName = "xeon07"; + interfaces.eno1.ipv4.addresses = [ { + address = "10.0.40.7"; + prefixLength = 24; + } ]; + interfaces.ibp5s0.ipv4.addresses = [ { + address = "10.0.42.7"; + prefixLength = 24; + } ]; + }; + environment.systemPackages = with pkgs; [ (pkgs.callPackage {}) ]; diff --git a/xeon07/net.nix b/xeon07/net.nix index c9e5ccc..6e5d5bf 100644 --- a/xeon07/net.nix +++ b/xeon07/net.nix @@ -6,22 +6,10 @@ boot.kernelModules = [ "ib_umad" "ib_ipoib" ]; networking = { - hostName = "xeon07"; - enableIPv6 = false; useDHCP = false; #defaultGateway = "10.0.40.30"; nameservers = ["8.8.8.8"]; - interfaces.eno1.ipv4.addresses = [ { - address = "10.0.40.7"; - prefixLength = 24; - } ]; - - interfaces.ibp5s0.ipv4.addresses = [ { - address = "10.0.42.7"; - prefixLength = 24; - } ]; - proxy = { default = "http://localhost:23080/"; noProxy = "127.0.0.1,localhost,internal.domain"; -- GitLab From ae31b546e7683319dfe55fca9b72bbe2de9fd7fb Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:50:44 +0200 Subject: [PATCH 14/16] Move net.nix to common --- common/main.nix | 1 + {xeon07 => common}/net.nix | 0 xeon07/configuration.nix | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename {xeon07 => common}/net.nix (100%) diff --git a/common/main.nix b/common/main.nix index abe1426..ef16e0c 100644 --- a/common/main.nix +++ b/common/main.nix @@ -5,6 +5,7 @@ ./boot.nix ./fs.nix ./hw.nix + ./net.nix ./overlays.nix ./ssh.nix ./users.nix diff --git a/xeon07/net.nix b/common/net.nix similarity index 100% rename from xeon07/net.nix rename to common/net.nix diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index faafe0b..df63508 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -6,7 +6,6 @@ ./gitlab-runner.nix ./monitoring.nix - ./net.nix ./nfs.nix ./slurm.nix -- GitLab From 096e407571eee756a8216a495c94469f3afac19b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:55:07 +0200 Subject: [PATCH 15/16] Load overlays from /config --- common/overlays.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/overlays.nix b/common/overlays.nix index 30cc381..23fd4c6 100644 --- a/common/overlays.nix +++ b/common/overlays.nix @@ -16,7 +16,7 @@ in # Prepend default nixPath values. options.nix.nixPath.default ++ # Append our nixpkgs-overlays. - [ "nixpkgs-overlays=/etc/nixos/overlays-compat/" ] + [ "nixpkgs-overlays=/config/overlays-compat/" ] ; nixpkgs.overlays = [ -- GitLab From cfe37640ea05ba113f0088cd2d2d93bdeb489e46 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 18:56:31 +0200 Subject: [PATCH 16/16] Add configuration for xeon01 --- xeon01/configuration.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 xeon01/configuration.nix diff --git a/xeon01/configuration.nix b/xeon01/configuration.nix new file mode 100644 index 0000000..3bf8bba --- /dev/null +++ b/xeon01/configuration.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../common/main.nix + ]; + + # Select the this using the ID to avoid mismatches + boot.loader.grub.device = "/dev/disk/by-id/wwn-0x55cd2e414d53566c"; + + networking = { + hostName = "xeon01"; + interfaces.eno1.ipv4.addresses = [ { + address = "10.0.40.1"; + prefixLength = 24; + } ]; + interfaces.ibp5s0.ipv4.addresses = [ { + address = "10.0.42.1"; + prefixLength = 24; + } ]; + }; +} -- GitLab