From 4e807b5759990deb0f18e4abc6402a52cee36202 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 24 Oct 2020 10:03:34 -0500 Subject: [PATCH] More nix modules --- env/nix/machines/third.nix | 97 ++----------------- env/nix/modules/bash.nix | 3 + env/nix/modules/bluetooth.nix | 3 + env/nix/modules/de/base.nix | 15 +++ env/nix/modules/de/sway.nix | 17 ++++ env/nix/modules/docker.nix | 3 + env/nix/modules/fish.nix | 5 + env/nix/modules/intel.nix | 11 ++- env/nix/modules/neovim.nix | 3 + env/nix/modules/network-manager.nix | 7 +- env/nix/modules/pulseaudio.nix | 8 ++ env/nix/modules/systemd-boot-efi.nix | 4 +- env/nix/modules/tmux.nix | 4 + env/nix/modules/users/daniel.nix | 38 ++++++++ env/nix/modules/users/valerie.nix | 7 ++ env/nix/personal-machine.nix | 133 --------------------------- env/nix/pkgs/home.nix | 5 +- env/nix/profiles/base.nix | 36 ++++++-- env/nix/profiles/laptop.nix | 8 +- 19 files changed, 157 insertions(+), 250 deletions(-) create mode 100644 env/nix/modules/bash.nix create mode 100644 env/nix/modules/bluetooth.nix create mode 100644 env/nix/modules/de/base.nix create mode 100644 env/nix/modules/de/sway.nix create mode 100644 env/nix/modules/docker.nix create mode 100644 env/nix/modules/fish.nix create mode 100644 env/nix/modules/neovim.nix create mode 100644 env/nix/modules/pulseaudio.nix create mode 100644 env/nix/modules/tmux.nix create mode 100644 env/nix/modules/users/daniel.nix create mode 100644 env/nix/modules/users/valerie.nix delete mode 100644 env/nix/personal-machine.nix diff --git a/env/nix/machines/third.nix b/env/nix/machines/third.nix index 56ef8a4..45e79cc 100644 --- a/env/nix/machines/third.nix +++ b/env/nix/machines/third.nix @@ -1,96 +1,17 @@ -{ config, pkgs, ... }: - -{ +{ config, pkgs, ... }: { imports = [ ../profiles/laptop.nix ../modules/systemd-boot-efi.nix ../modules/intel.nix + ../modules/docker.nix + ../modules/network-manager.nix + ../modules/bluetooth.nix + ../modules/pulseaudio.nix + ../modules/de/sway.nix + ../modules/users/daniel.nix + ../modules/users/valerie.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.hostName = "third.lyte.dev"; 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/bash.nix b/env/nix/modules/bash.nix new file mode 100644 index 0000000..1ad937e --- /dev/null +++ b/env/nix/modules/bash.nix @@ -0,0 +1,3 @@ +{ config, pkgs, ... }: { + environment.systemPackages = [ pkgs.bash ]; +} diff --git a/env/nix/modules/bluetooth.nix b/env/nix/modules/bluetooth.nix new file mode 100644 index 0000000..1a80e13 --- /dev/null +++ b/env/nix/modules/bluetooth.nix @@ -0,0 +1,3 @@ +{ config, pkgs, ... }: { + hardware.bluetooth.enable = true; +} diff --git a/env/nix/modules/de/base.nix b/env/nix/modules/de/base.nix new file mode 100644 index 0000000..1b5f7ce --- /dev/null +++ b/env/nix/modules/de/base.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: { + fonts.fonts = with pkgs; [ iosevka ]; + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + environment = { + systemPackages = with pkgs; [ + firefox-devedition-bin + pavucontrol + brightnessctl + ]; + }; +} diff --git a/env/nix/modules/de/sway.nix b/env/nix/modules/de/sway.nix new file mode 100644 index 0000000..abf884d --- /dev/null +++ b/env/nix/modules/de/sway.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: { + imports = [ ./base.nix ]; + programs.sway = { + enable = true; + extraPackages = with pkgs; [ + swaylock + swayidle + xwayland + waybar + mako + kanshi + wl-clipboard + slurp + grim + ]; + }; +} diff --git a/env/nix/modules/docker.nix b/env/nix/modules/docker.nix new file mode 100644 index 0000000..8092545 --- /dev/null +++ b/env/nix/modules/docker.nix @@ -0,0 +1,3 @@ +{ config, pkgs, ... }: { + imports = [ /etc/nixos/hardware-configuration.nix ]; +} diff --git a/env/nix/modules/fish.nix b/env/nix/modules/fish.nix new file mode 100644 index 0000000..65f35dc --- /dev/null +++ b/env/nix/modules/fish.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: { + environment.systemPackages = [ pkgs.fish ]; + programs.fish.enable = true; +} + diff --git a/env/nix/modules/intel.nix b/env/nix/modules/intel.nix index e9bb96d..9072b7d 100644 --- a/env/nix/modules/intel.nix +++ b/env/nix/modules/intel.nix @@ -1,10 +1,15 @@ -{ config, pkgs, ... }: - -{ +{ config, pkgs, ... }: { nixpkgs.config = { allowUnfree = true; packageOverrides = pkgs: { vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; }; }; + hardware.opengl = { + extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + }; } diff --git a/env/nix/modules/neovim.nix b/env/nix/modules/neovim.nix new file mode 100644 index 0000000..0f3b2f7 --- /dev/null +++ b/env/nix/modules/neovim.nix @@ -0,0 +1,3 @@ +{ config, pkgs, ... }: { + environment.systemPackages = [ pkgs.neovim ]; +} diff --git a/env/nix/modules/network-manager.nix b/env/nix/modules/network-manager.nix index f0a2d3d..3bf4d09 100644 --- a/env/nix/modules/network-manager.nix +++ b/env/nix/modules/network-manager.nix @@ -1,5 +1,4 @@ -{ config, pkgs, ... }: - -{ - networkmanager.enable = true; +{ config, pkgs, ... }: { + networking.networkmanager.enable = true; + environment.systemPackages = [ pkgs.networkmanager ]; } diff --git a/env/nix/modules/pulseaudio.nix b/env/nix/modules/pulseaudio.nix new file mode 100644 index 0000000..20ae008 --- /dev/null +++ b/env/nix/modules/pulseaudio.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: { + hardware.pulseaudio = { + enable = true; + support32Bit = true; + package = pkgs.pulseaudioFull; + }; + sound.enable = true; +} diff --git a/env/nix/modules/systemd-boot-efi.nix b/env/nix/modules/systemd-boot-efi.nix index aee64f6..813a8af 100644 --- a/env/nix/modules/systemd-boot-efi.nix +++ b/env/nix/modules/systemd-boot-efi.nix @@ -1,6 +1,4 @@ -{ config, pkgs, ... }: - -{ +{ config, pkgs, ... }: { boot = { loader = { systemd-boot.enable = true; diff --git a/env/nix/modules/tmux.nix b/env/nix/modules/tmux.nix new file mode 100644 index 0000000..ea9ad57 --- /dev/null +++ b/env/nix/modules/tmux.nix @@ -0,0 +1,4 @@ +{ config, pkgs, ... }: { + environment.systemPackages = [ pkgs.tmux ]; +} + diff --git a/env/nix/modules/users/daniel.nix b/env/nix/modules/users/daniel.nix new file mode 100644 index 0000000..921cbd0 --- /dev/null +++ b/env/nix/modules/users/daniel.nix @@ -0,0 +1,38 @@ +{ config, pkgs, ... }: { + users.users.daniel = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; + shell = pkgs.fish; + home = "/home/daniel/.home"; + packages = with pkgs; [ + fortune + steam + pulsemixer + file + appimage-run + kitty + 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 + unzip + automake + autoconf + ncurses + ]; + }; +} diff --git a/env/nix/modules/users/valerie.nix b/env/nix/modules/users/valerie.nix new file mode 100644 index 0000000..73005e2 --- /dev/null +++ b/env/nix/modules/users/valerie.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: { + users.users.valerie = { + isNormalUser = true; + shell = pkgs.fish; + home = "/home/valerie"; + }; +} diff --git a/env/nix/personal-machine.nix b/env/nix/personal-machine.nix deleted file mode 100644 index d075727..0000000 --- a/env/nix/personal-machine.nix +++ /dev/null @@ -1,133 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ /etc/nixos/hardware-configuration.nix ]; - - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - }; - - nixpkgs.config = { - allowUnfree = true; - packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; - }; - }; - - networking = { - networkmanager.enable = true; - hostName = "third.lyte.dev"; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - console.keyMap = "us"; - - time.timeZone = "America/Chicago"; - - environment = { - systemPackages = with pkgs; [ - fish bash tmux - vim neovim - networkmanager - wget curl w3m - git - pciutils usbutils binutils - ripgrep sd - nodejs python3 - rsync - ]; - variables = { - EDITOR = "nvim"; - }; - }; - - 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 - ]; - }; - - system.stateVersion = "20.03"; -} diff --git a/env/nix/pkgs/home.nix b/env/nix/pkgs/home.nix index a4bf7f8..cb99cae 100644 --- a/env/nix/pkgs/home.nix +++ b/env/nix/pkgs/home.nix @@ -1,7 +1,4 @@ -{ config, pkgs, ... }: - -{ +{ config, pkgs, ... }: { programs.home-manager.enable = true; - home.stateVersion = "20.03"; } diff --git a/env/nix/profiles/base.nix b/env/nix/profiles/base.nix index 5d6bd15..ba9e6da 100644 --- a/env/nix/profiles/base.nix +++ b/env/nix/profiles/base.nix @@ -1,27 +1,45 @@ -{ config, pkgs, ... }: - -{ +{ config, pkgs, ... }: { + imports = [ + ../modules/fish.nix + ../modules/bash.nix + ../modules/tmux.nix + ../modules/neovim.nix + ]; i18n.defaultLocale = "en_US.UTF-8"; console.keyMap = "us"; time.timeZone = "America/Chicago"; environment = { systemPackages = with pkgs; [ - fish bash - tmux - neovim - networkmanager + less wget curl rsync w3m git pciutils usbutils binutils ripgrep sd fd + unzip ]; variables = { EDITOR = "nvim"; - PAGER = "nvim"; - VISUAL = "nvim"; + PAGER = "less"; + VISUAL = "less"; + }; + shellAliases = { + vim = "neovim"; + vi = "neovim"; }; }; + + programs = { + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "curses"; + }; + }; + + services = { + openssh.enable = true; + }; } diff --git a/env/nix/profiles/laptop.nix b/env/nix/profiles/laptop.nix index 6647721..64d8d9d 100644 --- a/env/nix/profiles/laptop.nix +++ b/env/nix/profiles/laptop.nix @@ -1,7 +1,3 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./base.nix - ]; +{ config, pkgs, ... }: { + imports = [ ./base.nix ]; }