commit ac3f55966b81892b4e4ded1e43d2362fb7ae65f6 Author: Lucas Thelen Date: Fri Sep 26 02:11:47 2025 +0000 Initial setup diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..fc23f60 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,119 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +{ + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + # time.timeZone = "Europe/Amsterdam"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # services.pulseaudio.enable = true; + # OR + # services.pipewire = { + # enable = true; + # pulse.enable = true; + # }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # tree + # ]; + # }; + + # programs.firefox.enable = true; + + # List packages installed in system profile. + # You can use https://search.nixos.org/ to find more packages (and options). + # 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 + # ]; + + # 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; + + # 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 option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "25.05"; # Did you read the comment? + +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..af48ee2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1758589230, + "narHash": "sha256-zMTCFGe8aVGTEr2RqUi/QzC1nOIQ0N1HRsbqB4f646k=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d1d883129b193f0b495d75c148c2c3a7d95789a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a5a5782 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "My Homelab setup for NixOS"; + + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; + + outputs = { self, nixpkgs }: { + nixosConfigurations.homelab = nixpkgs.lib.nixosSystem { + modules = [ + ./configuration.nix + ./hardware-configuration.nix + ./networking/host.nix + ./packages.nix + ./users.nix + ./networking/ssh.nix + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..1fff730 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,51 @@ +# 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" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/887383a8-555c-4156-9b62-337ae007ce51"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6979-163D"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3fc91af7-13f4-4088-bb9a-7d6c8adf6d73"; } + ]; + + # 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.cni0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.flannel.1.useDHCP = lib.mkDefault true; + # networking.interfaces.veth17db2936.useDHCP = lib.mkDefault true; + # networking.interfaces.veth43e2454a.useDHCP = lib.mkDefault true; + # networking.interfaces.veth4c6fcbd9.useDHCP = lib.mkDefault true; + # networking.interfaces.veth55d9b858.useDHCP = lib.mkDefault true; + # networking.interfaces.veth61cf02b5.useDHCP = lib.mkDefault true; + # networking.interfaces.vethe8736672.useDHCP = lib.mkDefault true; + # networking.interfaces.vethf6a2e389.useDHCP = lib.mkDefault true; + # networking.interfaces.wg0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/networking/host.nix b/networking/host.nix new file mode 100644 index 0000000..5e1add1 --- /dev/null +++ b/networking/host.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: { + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + publish = { + enable = true; + userServices = true; + addresses = true; + }; + }; + + # DNS server + services.resolved.enable = true; + + networking = { + nameservers = [ "205.171.3.25" "8.8.8.8" ]; + + enableIPv6 = false; + + # Avahi port + firewall.allowedUDPPorts = [ 5353 ]; + + hostName = "homelab"; + interfaces.enp0s31f6 = { + ipv4.addresses = [{ + address = "192.168.0.10"; + prefixLength = 24; + }]; + }; + + defaultGateway = { + address = "192.168.0.1"; + interface = "enp0s31f6"; + }; + }; +} diff --git a/networking/ssh.nix b/networking/ssh.nix new file mode 100644 index 0000000..320e563 --- /dev/null +++ b/networking/ssh.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ... }: { + services.openssh.enable = true; + + networking.firewall.allowedTCPPorts = [ 22 ]; +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..429c32b --- /dev/null +++ b/packages.nix @@ -0,0 +1,8 @@ +{ config, lib, pkgs, ... }: { + environment.systemPackages = with pkgs; [ + neovim + vimPlugins.LazyVim + git + wget + ]; +} diff --git a/system.nix b/system.nix new file mode 100644 index 0000000..14187b3 --- /dev/null +++ b/system.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ... }: { + # System boots + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/users.nix b/users.nix new file mode 100644 index 0000000..a31622b --- /dev/null +++ b/users.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: { + programs.fish.enable = true; + + users.users.lucas = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + + shell = pkgs.fish; + + packages = with pkgs; [eza]; + + hashedPassword = + "$6$X.mw03yY/VFjDThj$t1I68HZz6NBihZGhiJ6Ct8ZuOufX6ZX9pydnK4puTjT1XKfMO1FY5VL1DwywJHrXOEJtohV99TmrABfjdBQY21"; + }; +}