From c0767193c9ba3ff49f75d122ee6a307c8586d8c9 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Mon, 23 Jan 2023 17:30:09 +0100 Subject: [PATCH] added nuc --- flake.nix | 8 +++ hosts/nuc/default.nix | 62 +++++++++++++++++++ hosts/nuc/hardware-configuration.nix | 56 +++++++++++++++++ keys/ssh/{rouven@pixel-4a => rouven-pixel} | 0 ...en@openpgp-0xE7980120 => rouven-smartcard} | 0 keys/ssh/rouven-thinkpad | 1 + keys/ssh/rouven@thinkpad | 1 - 7 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 hosts/nuc/default.nix create mode 100644 hosts/nuc/hardware-configuration.nix rename keys/ssh/{rouven@pixel-4a => rouven-pixel} (100%) rename keys/ssh/{rouven@openpgp-0xE7980120 => rouven-smartcard} (100%) create mode 100644 keys/ssh/rouven-thinkpad delete mode 100644 keys/ssh/rouven@thinkpad diff --git a/flake.nix b/flake.nix index a883bb0..3e739a8 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,14 @@ } ]; }; + nuc = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs.inputs = attrs; + modules = [ + ./hosts/nuc + sops-nix.nixosModules.sops + ]; + }; }; }; } diff --git a/hosts/nuc/default.nix b/hosts/nuc/default.nix new file mode 100644 index 0000000..cbecb38 --- /dev/null +++ b/hosts/nuc/default.nix @@ -0,0 +1,62 @@ +# 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, ... }: + +{ + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + imports = + [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../shared/vim.nix + # ../../shared/sops.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + supportedFilesystems = [ "zfs" ]; + }; + + networking.hostName = "nuc"; # Define your hostname. + networking.hostId = "795a4952"; + + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "dvorak"; + }; + + environment.systemPackages = with pkgs; [ + vim + wget + htop + ]; + programs.git = { + enable = true; + config = { + user.name = "Rouven Seifert"; + user.email = "rouven@rfive.de"; + }; + }; + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keyFiles = [ + ../../keys/ssh/rouven-thinkpad + ../../keys/ssh/rouven-pixel + # ../../keys/ssh/rouven-smartcard + ]; + + system.stateVersion = "22.11"; # Did you read the comment? + +} + diff --git a/hosts/nuc/hardware-configuration.nix b/hosts/nuc/hardware-configuration.nix new file mode 100644 index 0000000..7df90da --- /dev/null +++ b/hosts/nuc/hardware-configuration.nix @@ -0,0 +1,56 @@ +# 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 = [ "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "rpool/nixos/root"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var/lib" = + { + device = "rpool/nixos/var/lib"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var/log" = + { + device = "rpool/nixos/var/log"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/7026-251E"; + fsType = "vfat"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/a861a381-3a9d-4fc7-a4d0-facbe130c219"; }]; + + # 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; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/keys/ssh/rouven@pixel-4a b/keys/ssh/rouven-pixel similarity index 100% rename from keys/ssh/rouven@pixel-4a rename to keys/ssh/rouven-pixel diff --git a/keys/ssh/rouven@openpgp-0xE7980120 b/keys/ssh/rouven-smartcard similarity index 100% rename from keys/ssh/rouven@openpgp-0xE7980120 rename to keys/ssh/rouven-smartcard diff --git a/keys/ssh/rouven-thinkpad b/keys/ssh/rouven-thinkpad new file mode 100644 index 0000000..012cadb --- /dev/null +++ b/keys/ssh/rouven-thinkpad @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILkxTuzjS3EswMfj+wSKu9ciRyStvjDlDUXzkqEUGDaP rouven@thinkpad diff --git a/keys/ssh/rouven@thinkpad b/keys/ssh/rouven@thinkpad deleted file mode 100644 index b0f503e..0000000 --- a/keys/ssh/rouven@thinkpad +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDGP2m7ccMts/y/PFtYQraFQ7P7GEJlSGueM+9WS9UeT rouven@thinkpad