From cfb4131cf3fdf46d1504456f2d1ed8c7a33b7330 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Wed, 8 Oct 2025 20:07:14 +0200 Subject: [PATCH] [nidaros] Add initial Nidaros homelab config --- flake.nix | 7 +++ hosts/nidaros/configuration.nix | 69 ++++++++++++++++++++++++++ hosts/nidaros/default.nix | 13 +++++ hosts/nidaros/hardware.nix | 55 ++++++++++++++++++++ hosts/nidaros/home-manager/default.nix | 9 ++++ 5 files changed, 153 insertions(+) create mode 100644 hosts/nidaros/configuration.nix create mode 100644 hosts/nidaros/default.nix create mode 100644 hosts/nidaros/hardware.nix create mode 100644 hosts/nidaros/home-manager/default.nix diff --git a/flake.nix b/flake.nix index 0344908..a70cced 100644 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,13 @@ address.private = common.localIpAddr 231; address.tailnet = common.tailnetAddr "admin"; } + { + hostName = "nidaros"; + wayland.enable = false; + ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMKhK/EDIDf0htrJuBogNOUSuCiOcyc/b6UuBW/i+c29"; + address.private = common.localIpAddr 228; + } + ]; defaultAttrs = { diff --git a/hosts/nidaros/configuration.nix b/hosts/nidaros/configuration.nix new file mode 100644 index 0000000..0400946 --- /dev/null +++ b/hosts/nidaros/configuration.nix @@ -0,0 +1,69 @@ +# 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’). + +{ + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Oslo"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nb_NO.UTF-8"; + LC_IDENTIFICATION = "nb_NO.UTF-8"; + LC_MEASUREMENT = "nb_NO.UTF-8"; + LC_MONETARY = "nb_NO.UTF-8"; + LC_NAME = "nb_NO.UTF-8"; + LC_NUMERIC = "nb_NO.UTF-8"; + LC_PAPER = "nb_NO.UTF-8"; + LC_TELEPHONE = "nb_NO.UTF-8"; + LC_TIME = "nb_NO.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "gb"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "uk"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # Enable automatic login for the user. + services.getty.autologinUser = "martin"; + + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + +} diff --git a/hosts/nidaros/default.nix b/hosts/nidaros/default.nix new file mode 100644 index 0000000..8273b6d --- /dev/null +++ b/hosts/nidaros/default.nix @@ -0,0 +1,13 @@ +{ lib, systemConfig, ... }: + +{ + imports = with lib.custom; [ + (relativeToBase "modules") + ./configuration.nix + ./hardware.nix + ]; + + # Temp fix to not override password until sops have been implemented + users.users.${systemConfig.username}.hashedPasswordFile = lib.mkForce null; + +} diff --git a/hosts/nidaros/hardware.nix b/hosts/nidaros/hardware.nix new file mode 100644 index 0000000..8e09a16 --- /dev/null +++ b/hosts/nidaros/hardware.nix @@ -0,0 +1,55 @@ +# 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, + 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-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/cc66d953-c0b5-449d-8790-1dd113661da3"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/E198-D3D4"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/9631df4c-632f-49ec-8c97-bb66012fa26a"; } + ]; + + # 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.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nidaros/home-manager/default.nix b/hosts/nidaros/home-manager/default.nix new file mode 100644 index 0000000..cda1801 --- /dev/null +++ b/hosts/nidaros/home-manager/default.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + imports = with lib.custom; [ + (relativeToBase "home-manager") + ]; + home.stateVersion = "25.05"; + programs.git.signing.key = "E4E751ECB68CD7BF"; +}