From c22d68423e57f37f72e71077ccd0698b7f16c319 Mon Sep 17 00:00:00 2001 From: Veneficium <85629831+veneficium42@users.noreply.github.com> Date: Sat, 27 Jul 2024 15:21:18 +0200 Subject: [PATCH] update: initial homelab commit --- flake.lock | 87 ++++++++++++++++--- flake.nix | 10 +++ hosts/main-homelab/configuration.nix | 55 +++++++++++- hosts/main-homelab/hardware-configuration.nix | 39 +++++++++ 4 files changed, 178 insertions(+), 13 deletions(-) create mode 100644 hosts/main-homelab/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 81a974b..5722429 100644 --- a/flake.lock +++ b/flake.lock @@ -34,6 +34,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -41,11 +59,11 @@ ] }, "locked": { - "lastModified": 1719827439, - "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=", + "lastModified": 1722067813, + "narHash": "sha256-nxpzoKXwn+8RsxpxwD86mtEscOMw64ZD/vGSNWzGMlA=", "owner": "nix-community", "repo": "home-manager", - "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d", + "rev": "975b83ca560d17db51a66cb2b0dc0e44213eab27", "type": "github" }, "original": { @@ -61,11 +79,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1719797603, - "narHash": "sha256-Bw9K0LgCwuBKg0534d0Ss71prBKzUR/b1SqWyRqOSzg=", + "lastModified": 1722043670, + "narHash": "sha256-MiPeYwr+BjSlQqAhEWvZQGBCZFcKrPBaaobTTcEGMfU=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "bec5bcb9503603a84f92d8801e304f7acdd89c86", + "rev": "b435250a94728e8b07828570cb29fc5fc79b604f", "type": "github" }, "original": { @@ -92,11 +110,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1719690277, - "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", + "lastModified": 1721924956, + "narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", + "rev": "5ad6a14c6bf098e98800b091668718c336effc95", "type": "github" }, "original": { @@ -106,11 +124,26 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1682134069, + "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "root": { "inputs": { "home-manager": "home-manager", "nix-vscode-extensions": "nix-vscode-extensions", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "vscode-server": "vscode-server" } }, "systems": { @@ -127,6 +160,40 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "vscode-server": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1713958148, + "narHash": "sha256-8PDNi/dgoI2kyM7uSiU4eoLBqUKoA+3TXuz+VWmuCOc=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "fc900c16efc6a5ed972fb6be87df018bcf3035bc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 36d5f72..036f056 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + vscode-server.url = "github:nix-community/nixos-vscode-server"; }; outputs = inputs@{ self, nixpkgs, home-manager, ... }: @@ -39,6 +40,15 @@ ]; }; + veneficium-main-homelab-nixos = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = { pkgs = (pkgs system); }; + modules = [ + inputs.vscode-server.nixosModules.default + ./hosts/main-homelab/configuration.nix + ]; + }; + }; }; } diff --git a/hosts/main-homelab/configuration.nix b/hosts/main-homelab/configuration.nix index c27e803..8aa81fc 100644 --- a/hosts/main-homelab/configuration.nix +++ b/hosts/main-homelab/configuration.nix @@ -1,12 +1,51 @@ { pkgs, ... }: { + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + services.vscode-server = { + enable = true; + enableFHS = true; + installPath = "$HOME/.vscodium-server"; + }; + programs.nix-ld.enable = true; + boot.kernelPackages = pkgs.linuxPackages_latest; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "fedfer-main-homelab-nixos"; + networking.hostName = "veneficium-main-homelab-nixos"; - systemd.network.enable = true; + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Rome"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "it_IT.UTF-8"; + LC_IDENTIFICATION = "it_IT.UTF-8"; + LC_MEASUREMENT = "it_IT.UTF-8"; + LC_MONETARY = "it_IT.UTF-8"; + LC_NAME = "it_IT.UTF-8"; + LC_NUMERIC = "it_IT.UTF-8"; + LC_PAPER = "it_IT.UTF-8"; + LC_TELEPHONE = "it_IT.UTF-8"; + LC_TIME = "it_IT.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "it"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "it2"; environment.systemPackages = with pkgs; [ nano @@ -15,8 +54,18 @@ parted ]; + users.users.veneficium = { + isNormalUser = true; + description = "Veneficium"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + programs.zsh.enable = true; + services.openssh.enable = true; + # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -24,6 +73,6 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; #DO NOT CHANGE THIS! IMPORTANT! DO NOT CHANGE THIS! - system.stateVersion = "23.11"; #DO NOT CHANGE THIS! + system.stateVersion = "24.05"; #DO NOT CHANGE THIS! } diff --git a/hosts/main-homelab/hardware-configuration.nix b/hosts/main-homelab/hardware-configuration.nix new file mode 100644 index 0000000..31d4ea0 --- /dev/null +++ b/hosts/main-homelab/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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 = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/58d4396b-d87c-419b-ac35-c4d282ef05b1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F5D9-1046"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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.enp4s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}