From 4f0185bc89f7ba707808eecd926635e4b3fa1834 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 24 Oct 2020 09:06:34 -0500 Subject: [PATCH] Work on modularizing nix config --- env/laptop/hardware.nix | 12 +--- env/nix/machines/third.nix | 96 ++++++++++++++++++++++++++++ env/nix/modules/intel.nix | 10 +++ env/nix/modules/network-manager.nix | 5 ++ env/nix/modules/systemd-boot-efi.nix | 10 +++ env/nix/personal-machine.nix | 4 ++ env/nix/profiles/base.nix | 27 ++++++++ env/nix/profiles/laptop.nix | 7 ++ 8 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 env/nix/machines/third.nix create mode 100644 env/nix/modules/intel.nix create mode 100644 env/nix/modules/network-manager.nix create mode 100644 env/nix/modules/systemd-boot-efi.nix create mode 100644 env/nix/profiles/base.nix create mode 100644 env/nix/profiles/laptop.nix diff --git a/env/laptop/hardware.nix b/env/laptop/hardware.nix index 2b0f5b8..eb893b0 100644 --- a/env/laptop/hardware.nix +++ b/env/laptop/hardware.nix @@ -8,12 +8,10 @@ [ ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernelParams = [ "resume=/swapfile" "resume_offset=874496" ]; - boot.resumeDevice = "/dev/disk/by-uuid/d1d92974-c0c0-4566-8131-c3dda9b21122"; fileSystems."/" = { device = "/dev/disk/by-uuid/d1d92974-c0c0-4566-8131-c3dda9b21122"; @@ -25,13 +23,7 @@ fsType = "vfat"; }; - swapDevices = [ - { - device = "/swapfile"; - priority = 0; - size = 16000; - } - ]; + swapDevices = [ ]; nix.maxJobs = lib.mkDefault 4; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; diff --git a/env/nix/machines/third.nix b/env/nix/machines/third.nix new file mode 100644 index 0000000..56ef8a4 --- /dev/null +++ b/env/nix/machines/third.nix @@ -0,0 +1,96 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../profiles/laptop.nix + ../modules/systemd-boot-efi.nix + ../modules/intel.nix + ]; + + networking.hostName "third.lyte.dev"; + + fonts.fonts = with pkgs; [ iosevka ]; + + virtualisation.docker.enable = true; + + hardware = { + bluetooth = { + enable = true; + }; + pulseaudio = { + enable = true; + support32Bit = true; + package = pkgs.pulseaudioFull; + # extraConfig = " + # load-module module-switch-on-connect + # "; + }; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + }; + }; + + programs = { + fish.enable = true; + mtr.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "curses"; + }; + }; + + services = { + openssh.enable = true; + }; + + networking.firewall.enable = false; + + sound.enable = true; + + users.users.daniel = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; + shell = pkgs.fish; + home = "/home/daniel/.home"; + packages = with pkgs; [ + steam + pulsemixer + file + appimage-run + kitty + sway waybar mako wl-clipboard + firefox-devedition-bin + fzf + fortune + dmenu + ranger + pass + brightnessctl + vulkan-tools # TODO: vulkan? + rustup + clang + pavucontrol + pamixer + strongswan + gnumake + elixir + docker docker-compose + postgresql + htop + google-cloud-sdk + slurp grim + unzip + automake + autoconf + ncurses + ]; + }; +} diff --git a/env/nix/modules/intel.nix b/env/nix/modules/intel.nix new file mode 100644 index 0000000..e9bb96d --- /dev/null +++ b/env/nix/modules/intel.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + nixpkgs.config = { + allowUnfree = true; + packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + }; +} diff --git a/env/nix/modules/network-manager.nix b/env/nix/modules/network-manager.nix new file mode 100644 index 0000000..f0a2d3d --- /dev/null +++ b/env/nix/modules/network-manager.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: + +{ + networkmanager.enable = true; +} diff --git a/env/nix/modules/systemd-boot-efi.nix b/env/nix/modules/systemd-boot-efi.nix new file mode 100644 index 0000000..aee64f6 --- /dev/null +++ b/env/nix/modules/systemd-boot-efi.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; +} diff --git a/env/nix/personal-machine.nix b/env/nix/personal-machine.nix index ae4321f..d075727 100644 --- a/env/nix/personal-machine.nix +++ b/env/nix/personal-machine.nix @@ -122,6 +122,10 @@ htop google-cloud-sdk slurp grim + unzip + automake + autoconf + ncurses ]; }; diff --git a/env/nix/profiles/base.nix b/env/nix/profiles/base.nix new file mode 100644 index 0000000..5d6bd15 --- /dev/null +++ b/env/nix/profiles/base.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +{ + i18n.defaultLocale = "en_US.UTF-8"; + console.keyMap = "us"; + time.timeZone = "America/Chicago"; + + environment = { + systemPackages = with pkgs; [ + fish bash + tmux + neovim + networkmanager + wget curl + rsync + w3m + git + pciutils usbutils binutils + ripgrep sd fd + ]; + variables = { + EDITOR = "nvim"; + PAGER = "nvim"; + VISUAL = "nvim"; + }; + }; +} diff --git a/env/nix/profiles/laptop.nix b/env/nix/profiles/laptop.nix new file mode 100644 index 0000000..6647721 --- /dev/null +++ b/env/nix/profiles/laptop.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./base.nix + ]; +}