diff --git a/xeon07/boot.nix b/common/boot.nix similarity index 75% rename from xeon07/boot.nix rename to common/boot.nix index 56a2a31ec7a19685a2347310ab77d341e5b3aecd..cf85951c56e8f656c161ece9dba130f27e90b6ff 100644 --- a/xeon07/boot.nix +++ b/common/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 @@ -29,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/fs.nix b/common/fs.nix similarity index 64% rename from xeon07/fs.nix rename to common/fs.nix index 7d8e36d17bccaa9e8ea56e4ccad0b3dd652b90dd..60fcceffd17a88bf5618a516900b3ec66374e34a 100644 --- a/xeon07/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/common/hw.nix b/common/hw.nix new file mode 100644 index 0000000000000000000000000000000000000000..7e4112cd1b29f5080d54cf078d1dceb83ee1b7b4 --- /dev/null +++ b/common/hw.nix @@ -0,0 +1,14 @@ +# 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") + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/common/main.nix b/common/main.nix new file mode 100644 index 0000000000000000000000000000000000000000..ef16e0c68b832419587bb061d394870163f76e21 --- /dev/null +++ b/common/main.nix @@ -0,0 +1,54 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./boot.nix + ./fs.nix + ./hw.nix + ./net.nix + ./overlays.nix + ./ssh.nix + ./users.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/net.nix b/common/net.nix similarity index 91% rename from xeon07/net.nix rename to common/net.nix index c9e5ccc8f73dc87b5ba5017ba5323761ca10c5ae..6e5d5bfccefd9532df97322a3863899b9bd12243 100644 --- a/xeon07/net.nix +++ b/common/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"; diff --git a/xeon07/overlays.nix b/common/overlays.nix similarity index 89% rename from xeon07/overlays.nix rename to common/overlays.nix index 30cc381435dc7c8bc9b465d77b2e5619db5994b4..23fd4c67aca8bd569c5c26b503ccfd1ffdd0f29f 100644 --- a/xeon07/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 = [ 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/users.nix b/common/users.nix similarity index 100% rename from xeon07/users.nix rename to common/users.nix diff --git a/xeon01/configuration.nix b/xeon01/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..3bf8bba1d2bf356efd5487c7b1af941842923161 --- /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; + } ]; + }; +} diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index 11916cafb4b7838eda936bc0df1ee636cc4cefa6..df6350837290169d05fa8cf224dcd66afc04987d 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -2,61 +2,32 @@ { imports = [ - ./hardware-configuration.nix + ../common/main.nix - ./boot.nix - ./fs.nix ./gitlab-runner.nix ./monitoring.nix - ./net.nix ./nfs.nix - ./overlays.nix ./slurm.nix - ./ssh.nix - ./users.nix ]; - systemd.services."serial-getty@ttyS0" = { - enable = true; - wantedBy = [ "getty.target" ]; - serviceConfig.Restart = "always"; + # 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; + } ]; }; - 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? } diff --git a/xeon07/hardware-configuration.nix b/xeon07/hardware-configuration.nix deleted file mode 100644 index c69f8684a9900b84bf1f7761c562ef76651aa97e..0000000000000000000000000000000000000000 --- a/xeon07/hardware-configuration.nix +++ /dev/null @@ -1,37 +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 = [ "ahci" "xhci_pci" "ehci_pci" "nvme" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/289f78d9-b339-47de-b321-0a6796b9a79b"; - fsType = "ext4"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/2bac02f9-7ea1-4868-9536-23710f19baca"; } - ]; - - # 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; -}