From 2404862e0a0fe7025bd17a430977c22202382f78 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Thu, 6 Apr 2023 20:12:43 -0700 Subject: [PATCH] Introduced node system --- modules/user/default.nix | 5 +++ systems/x86_64-linux/gospel/default.nix | 7 ---- systems/x86_64-linux/node/default.nix | 35 ++++++++++++++++++ .../node/hardware-configuration.nix | 37 +++++++++++++++++++ systems/x86_64-linux/node/zfs.nix | 6 +++ 5 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 systems/x86_64-linux/node/default.nix create mode 100644 systems/x86_64-linux/node/hardware-configuration.nix create mode 100644 systems/x86_64-linux/node/zfs.nix diff --git a/modules/user/default.nix b/modules/user/default.nix index e4545cc..8a4d0dc 100644 --- a/modules/user/default.nix +++ b/modules/user/default.nix @@ -37,6 +37,11 @@ in { }; config = { + # Required when setting shell to zsh + # There is a separate module that configures zsh for make + # Refer to modules/tools/zsh/default.nix + programs.zsh.enable = true; + users.users.${cfg.name} = { isNormalUser = true; diff --git a/systems/x86_64-linux/gospel/default.nix b/systems/x86_64-linux/gospel/default.nix index 94dfc64..8b6e1bd 100644 --- a/systems/x86_64-linux/gospel/default.nix +++ b/systems/x86_64-linux/gospel/default.nix @@ -1,13 +1,9 @@ -# 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, ... }: { imports = [ - # Include the results of the hardware scan. ./hardware-configuration.nix ./zfs.nix ]; @@ -43,10 +39,7 @@ }; boot.binfmt.emulatedSystems = ["aarch64-linux" "armv6l-linux"]; - networking.hostName = "gospel"; - - # Set your time zone. time.timeZone = "America/Los_Angeles"; # List packages installed in system profile. To search, run: diff --git a/systems/x86_64-linux/node/default.nix b/systems/x86_64-linux/node/default.nix new file mode 100644 index 0000000..6bdded2 --- /dev/null +++ b/systems/x86_64-linux/node/default.nix @@ -0,0 +1,35 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./hardware-configuration.nix + ./zfs.nix + ]; + + aa = { + nix.enable = true; + + services.openssh.enable = true; + system.zfs.enable = true; + system.monitoring.enable = true; + }; + + boot.loader.systemd-boot.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + ]; + + # 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/systems/x86_64-linux/node/hardware-configuration.nix b/systems/x86_64-linux/node/hardware-configuration.nix new file mode 100644 index 0000000..f12a22b --- /dev/null +++ b/systems/x86_64-linux/node/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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.enp7s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/x86_64-linux/node/zfs.nix b/systems/x86_64-linux/node/zfs.nix new file mode 100644 index 0000000..33490cc --- /dev/null +++ b/systems/x86_64-linux/node/zfs.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + boot.supportedFilesystems = [ "zfs" ]; + networking.hostId = "db616c9e"; +}