diff --git a/flake.nix b/flake.nix index 925b43c..5f5aec2 100644 --- a/flake.nix +++ b/flake.nix @@ -157,7 +157,7 @@ modules = [ disko.nixosModules.disko sops-nix.nixosModules.sops - ./hosts/hades + ./hosts/hades/configuration.nix ]; }; diff --git a/hosts/hades/configuration.nix b/hosts/hades/configuration.nix new file mode 100644 index 0000000..d1259df --- /dev/null +++ b/hosts/hades/configuration.nix @@ -0,0 +1,145 @@ +# 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 + ./default.nix + ]; + +boot.kernelPackages = pkgs.linuxPackages_latest; + boot.supportedFilesystems = [ "btrfs" ]; + hardware.enableAllFirmware = true; + nixpkgs.config.allowUnfree = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub = { + enable = true; + version = 2; + device = "nodev"; + efiSupport = true; + enableCryptodisk = true; + }; + boot.initrd.luks.devices = { + root = { + # Use https://nixos.wiki/wiki/Full_Disk_Encryption + device = "/dev/disk/by-uuid/5526aab7-b779-4fc8-95bd-9452bc3a9232"; + preLVM = true; + }; + }; + + networking.hostName = "hades"; # 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; + + + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.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. + # hardware.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; [ + # firefox + # tree + # ]; + # }; + + # 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 + # ]; + + # 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 = "24.05"; # Did you read the comment? + +} + diff --git a/hosts/hades/hardware-configuration.nix b/hosts/hades/hardware-configuration.nix new file mode 100644 index 0000000..e177778 --- /dev/null +++ b/hosts/hades/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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" "ehci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ad648423-7aa4-4f0f-b157-2f6b458130f7"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/552D-851F"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b7ccf8c3-3641-4035-b91f-f7e54c6dd380"; } + ]; + + # 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.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp8s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/hades/modules/default.nix b/hosts/hades/modules/default.nix index e0a4dc0..9b87253 100644 --- a/hosts/hades/modules/default.nix +++ b/hosts/hades/modules/default.nix @@ -6,7 +6,7 @@ ## Selected host modules for import ./network.nix # network configuration - ./extra.nix # configuration.nix substitute + #./extra.nix # configuration.nix substitute #./zfs.nix # zfs configuration ## Selected core modules for import diff --git a/hosts/hades/modules/extra.nix b/hosts/hades/modules/extra.nix index 1f4c6c3..379d8d2 100644 --- a/hosts/hades/modules/extra.nix +++ b/hosts/hades/modules/extra.nix @@ -8,6 +8,7 @@ imports = [ # Include the results of the hardware scan. ./hardware.nix + ../default.nix ]; # Bootloader. @@ -22,8 +23,25 @@ boot.loader.grub.enableCryptodisk = true; - boot.initrd.luks.devices."luks-34a5d7fd-7f3a-4778-8d3a-c7bdec52e96c".keyFile = "/boot/crypto_keyfile.bin"; + boot.initrd.luks.devices."luks-f9de3a25-6f75-4e75-b885-160b58634006".keyFile = "/boot/crypto_keyfile.bin"; + # Install firefox. + programs.firefox.enable = true; + programs.neovim.enable = true; + programs.git.enable = true; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + nix.settings = { + cores = 0; + experimental-features = [ "flakes" "nix-command" ]; + }; + + # 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 = "24.05"; # Did you read the comment? } diff --git a/hosts/hades/modules/hardware.nix b/hosts/hades/modules/hardware.nix index c6e0b08..4b1213b 100644 --- a/hosts/hades/modules/hardware.nix +++ b/hosts/hades/modules/hardware.nix @@ -14,11 +14,11 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/d67a9243-b1d6-47a7-8ae6-bac5c63e7d0e"; + { device = "/dev/disk/by-uuid/efa84ce5-ecd1-46c6-8207-5434919d9f72"; fsType = "ext4"; }; - boot.initrd.luks.devices."luks-34a5d7fd-7f3a-4778-8d3a-c7bdec52e96c".device = "/dev/disk/by-uuid/34a5d7fd-7f3a-4778-8d3a-c7bdec52e96c"; + boot.initrd.luks.devices."luks-f9de3a25-6f75-4e75-b885-160b58634006".device = "/dev/disk/by-uuid/f9de3a25-6f75-4e75-b885-160b58634006"; swapDevices = [ ];