From 5111fcc4a49bcef1c336e03f5279d053bae3806c Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Fri, 29 May 2020 21:59:17 +0100 Subject: move various hardware configs around --- nixos/modules/hardware/keyboard.nix | 24 +++++++++++++++++++ nixos/modules/hardware/linode.nix | 38 ++++++++++++++++++++++++++++++ nixos/modules/hardware/yubikey.nix | 47 +++++++++++++++++++++++++++++++++++++ nixos/modules/keyboard.nix | 24 ------------------- nixos/modules/linode.nix | 38 ------------------------------ nixos/modules/module-list.nix | 6 ++--- nixos/modules/yubikey.nix | 47 ------------------------------------- 7 files changed, 112 insertions(+), 112 deletions(-) create mode 100644 nixos/modules/hardware/keyboard.nix create mode 100644 nixos/modules/hardware/linode.nix create mode 100644 nixos/modules/hardware/yubikey.nix delete mode 100644 nixos/modules/keyboard.nix delete mode 100644 nixos/modules/linode.nix delete mode 100644 nixos/modules/yubikey.nix diff --git a/nixos/modules/hardware/keyboard.nix b/nixos/modules/hardware/keyboard.nix new file mode 100644 index 0000000..69ab14a --- /dev/null +++ b/nixos/modules/hardware/keyboard.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: +with lib; + +let + cfg = config.eth.keyboard; + +in { + + options.eth.keyboard = { + enable = mkEnableOption "Eth's keyboard preferences"; + }; + + config = mkIf cfg.enable { + + console.useXkbConfig = true; + + services.xserver = { + layout = "us"; + xkbVariant = "colemak"; + xkbOptions = "caps:escape"; + }; + + }; +} diff --git a/nixos/modules/hardware/linode.nix b/nixos/modules/hardware/linode.nix new file mode 100644 index 0000000..d70c929 --- /dev/null +++ b/nixos/modules/hardware/linode.nix @@ -0,0 +1,38 @@ +{ config, pkgs, lib, ... }: +with lib; + +# from https://www.linode.com/docs/tools-reference/custom-kernels-distros/install-nixos-on-linode/. + +let + cfg = config.eth.linode; + +in { + + options.eth.linode = { + enable = mkEnableOption "good defaults for Linodes"; + }; + + config = mkIf cfg.enable { + + # Enable LISH serial console. + boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.loader.grub.extraConfig = '' + serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1; + terminal_input serial; + terminal_output serial; + ''; + + # GRUB has issues with Linode, + # so this ignores the warnings. + boot.loader.grub.forceInstall = true; + + # A long timeout to cope with LISH delays. + boot.loader.timeout = 10; + + boot.loader.grub = { + enable = true; + version = 2; + device = "nodev"; # "nodev" for EFI. + }; + }; +} diff --git a/nixos/modules/hardware/yubikey.nix b/nixos/modules/hardware/yubikey.nix new file mode 100644 index 0000000..0c16807 --- /dev/null +++ b/nixos/modules/hardware/yubikey.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: +with lib; + +let + cfg = config.eth.yubikey; + +in { + + options.eth.yubikey = { + enable = mkEnableOption "Set up Yubikey"; + }; + + config = mkIf cfg.enable { + + hardware.u2f.enable = true; + + programs.ssh.startAgent = false; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "curses"; + }; + + services.pcscd.enable = true; + + services.udev.packages = with pkgs; [ + libu2f-host + yubikey-personalization + ]; + + environment.systemPackages = with pkgs; [ + gnupg + pinentry-curses + ]; + + environment.shellInit = '' + gpg-connect-agent /bye + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + ''; + programs.fish.shellInit = '' + gpg-connect-agent /bye + set -Ux SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket) + ''; + + }; +} diff --git a/nixos/modules/keyboard.nix b/nixos/modules/keyboard.nix deleted file mode 100644 index 69ab14a..0000000 --- a/nixos/modules/keyboard.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; - -let - cfg = config.eth.keyboard; - -in { - - options.eth.keyboard = { - enable = mkEnableOption "Eth's keyboard preferences"; - }; - - config = mkIf cfg.enable { - - console.useXkbConfig = true; - - services.xserver = { - layout = "us"; - xkbVariant = "colemak"; - xkbOptions = "caps:escape"; - }; - - }; -} diff --git a/nixos/modules/linode.nix b/nixos/modules/linode.nix deleted file mode 100644 index d70c929..0000000 --- a/nixos/modules/linode.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; - -# from https://www.linode.com/docs/tools-reference/custom-kernels-distros/install-nixos-on-linode/. - -let - cfg = config.eth.linode; - -in { - - options.eth.linode = { - enable = mkEnableOption "good defaults for Linodes"; - }; - - config = mkIf cfg.enable { - - # Enable LISH serial console. - boot.kernelParams = [ "console=ttyS0,19200n8" ]; - boot.loader.grub.extraConfig = '' - serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1; - terminal_input serial; - terminal_output serial; - ''; - - # GRUB has issues with Linode, - # so this ignores the warnings. - boot.loader.grub.forceInstall = true; - - # A long timeout to cope with LISH delays. - boot.loader.timeout = 10; - - boot.loader.grub = { - enable = true; - version = 2; - device = "nodev"; # "nodev" for EFI. - }; - }; -} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index e8f27d8..2ae236d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1,6 +1,7 @@ [ - ./keyboard.nix - ./linode.nix + ./hardware/keyboard.nix + ./hardware/linode.nix + ./hardware/yubikey.nix ./overlays.nix ./programs/dwm.nix ./services/catbus-bridge-snapcast.nix @@ -11,5 +12,4 @@ ./services/ssh.nix ./services/upmpdcli.nix ./users/eth.nix - ./yubikey.nix ] diff --git a/nixos/modules/yubikey.nix b/nixos/modules/yubikey.nix deleted file mode 100644 index 0c16807..0000000 --- a/nixos/modules/yubikey.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; - -let - cfg = config.eth.yubikey; - -in { - - options.eth.yubikey = { - enable = mkEnableOption "Set up Yubikey"; - }; - - config = mkIf cfg.enable { - - hardware.u2f.enable = true; - - programs.ssh.startAgent = false; - - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - pinentryFlavor = "curses"; - }; - - services.pcscd.enable = true; - - services.udev.packages = with pkgs; [ - libu2f-host - yubikey-personalization - ]; - - environment.systemPackages = with pkgs; [ - gnupg - pinentry-curses - ]; - - environment.shellInit = '' - gpg-connect-agent /bye - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - ''; - programs.fish.shellInit = '' - gpg-connect-agent /bye - set -Ux SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket) - ''; - - }; -} -- cgit v1.2.3