From 8579155fab5a199f892f132dce81c6958d001d37 Mon Sep 17 00:00:00 2001 From: Carsten Kragelund Date: Mon, 16 Jan 2023 14:49:16 +0100 Subject: [PATCH] Add laptop host --- flake.nix | 13 ++++ hosts/eagle/default.nix | 125 +++++++++++++++++++++++++++++++++++++++ hosts/eagle/hardware.nix | 39 ++++++++++++ hosts/eagle/pkgs.nix | 25 ++++++++ 4 files changed, 202 insertions(+) create mode 100644 hosts/eagle/default.nix create mode 100644 hosts/eagle/hardware.nix create mode 100644 hosts/eagle/pkgs.nix diff --git a/flake.nix b/flake.nix index 1a7f712..83ebcc6 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,19 @@ modules = [ ./hosts/falcon + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "bak"; + } + ]; + }; + nixosConfigurations.eagle = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/eagle + home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/hosts/eagle/default.nix b/hosts/eagle/default.nix new file mode 100644 index 0000000..37abe79 --- /dev/null +++ b/hosts/eagle/default.nix @@ -0,0 +1,125 @@ +{ config +, modulesPath +, pkgs +, ... +}: { + imports = [ + ./hardware.nix + + ../../users/carsten + ../common.nix + + ./pkgs.nix + ]; + + # Enable non-free packages + nixpkgs.config.allowUnfree = true; + + boot.loader = { + systemd-boot = { + enable = true; + }; + + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; + }; + + # Configure nix itself + nix = { + # Enable nix flakes + package = pkgs.nixFlakes; + + settings = { + # Maximum number of concurrent tasks during one build + build-cores = 12; + + # Maximum number of jobs that Nix will try to build in parallel + max-jobs = "auto"; + + # Perform builds in a sandboxed environment + sandbox = true; + + # Enable flakes + experimental-features = [ "nix-command" "flakes" ]; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/Copenhagen"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.utf8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Configure console keymap + console.keyMap = "us"; + + # Audio + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Pinentry / GPG + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "gtk2"; + enableSSHSupport = true; + }; + + security.pam.loginLimits = [ + # Unlimited amount of processes for root + { + domain = "root"; + item = "nproc"; + value = "unlimited"; + } + # Unlimited open file descriptors + { + domain = "*"; + item = "nofile"; + value = "unlimited"; + } + ]; + + networking = { + networkmanager.enable = true; + hostName = "eagle"; + nameservers = [ "192.168.1.1" "87.62.97.64" ]; + }; + + services.xserver = { + enable = true; + + layout = "us"; + xkbVariant = ""; + + displayManager.gdm.enable = true; + desktopManager.gnome.enable = 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/hosts/eagle/hardware.nix b/hosts/eagle/hardware.nix new file mode 100644 index 0000000..332aa2f --- /dev/null +++ b/hosts/eagle/hardware.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 = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/46f02208-9100-454f-8946-8a02190fcd9c"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = + { device = "/dev/disk/by-uuid/541D-6B1B"; + fsType = "vfat"; + }; + + 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.eno2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.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; +} diff --git a/hosts/eagle/pkgs.nix b/hosts/eagle/pkgs.nix new file mode 100644 index 0000000..34f3e1c --- /dev/null +++ b/hosts/eagle/pkgs.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + imports = [ ]; + + environment.systemPackages = with pkgs; [ + (firefox-devedition-bin.override { wmClass = "firefox-aurora"; }) + dconf + git + git-lfs + gnomeExtensions.color-picker + gnomeExtensions.just-perfection + gnomeExtensions.unite + gnupg + home-manager + ntfsprogs + pinentry-gtk2 + pipewire + pulseaudio + unzip + vim + wget + wireplumber + ]; +}