From c298cc37e862cf5d91cf4d6c9739d25c6482ac99 Mon Sep 17 00:00:00 2001 From: David Crompton Date: Tue, 25 Jul 2023 13:25:23 -0400 Subject: [PATCH] Initial Working Configuration --- flake.nix | 10 +++ machines/kcnhub/configuration.nix | 84 ++++++++++++++++++++++ machines/kcnhub/hardware-configuration.nix | 57 +++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 flake.nix create mode 100644 machines/kcnhub/configuration.nix create mode 100644 machines/kcnhub/hardware-configuration.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..49fd82a --- /dev/null +++ b/flake.nix @@ -0,0 +1,10 @@ +{ + outputs = { self, nixpkgs, sops-nix }: { + nixosConfigurations.kcnhub = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/kcnhub/configuration.nix + ]; + }; + }; +} diff --git a/machines/kcnhub/configuration.nix b/machines/kcnhub/configuration.nix new file mode 100644 index 0000000..07a38a5 --- /dev/null +++ b/machines/kcnhub/configuration.nix @@ -0,0 +1,84 @@ +# 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 = + [ + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "kcnhub"; + + time.timeZone = "America/Toronto"; + + # 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; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + # Disable Pulseaudio -- we get its features through pipewire + hardware.pulseaudio.enable = false; + + # TODO: Define module for adding users & their ssh keys & what projects they have in their home folder + # 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 + # thunderbird + # ]; + # }; + + # TODO: Make set of themed packages for packages that are available, e.g. Python packages, Matlab, Octave, etc. + environment.systemPackages = with pkgs; [ + git + ]; + + # TODO: Make services directory for with a nix for each service that is enabled and what options it has + # 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 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/machines/kcnhub/hardware-configuration.nix b/machines/kcnhub/hardware-configuration.nix new file mode 100644 index 0000000..44094ef --- /dev/null +++ b/machines/kcnhub/hardware-configuration.nix @@ -0,0 +1,57 @@ +# 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 = [ "ahci" "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ]; + boot.initrd.kernelModules = [ + "dm-snapshot" + "dm_cache_smq" + "dm_cache" + "dm_persistent_data" + "dm_bio_prison" + "dm_bufio" + "dm_raid" + "dm_mod" + ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.initrd.services.swraid.enable = true; + + # Cache and Thin Provisioning Support + services.lvm.boot.thin.enable = true; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/4aa8d42a-e8c3-4b60-bc69-2d0333886c55"; + fsType = "xfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/BF96-6765"; + fsType = "vfat"; + }; + + fileSystems."/storage" = + { device = "/dev/disk/by-uuid/eb2170c8-236a-40d4-baa8-07ad4981a442"; + fsType = "xfs"; + }; + + 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.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.eno2.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}