From 01c963d7df3afb7b719541d1ea94d49274fe8679 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Tue, 18 Jul 2023 14:24:10 -0600 Subject: [PATCH] weatherzero: add initial config bits for running on a raspi0 --- flake.nix | 18 ++++++- hosts/weatherzero/default.nix | 56 ++++++++++++++++++++ hosts/weatherzero/hardware-configuration.nix | 14 +++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 hosts/weatherzero/default.nix create mode 100644 hosts/weatherzero/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 3ed9d17..97715fd 100644 --- a/flake.nix +++ b/flake.nix @@ -238,6 +238,22 @@ ]; }; + weatherzero = buildSys "armv6l" unstable [ + "${unstable}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" + { + nixpkgs = { + buildPlatform = { + system = "x86_64-linux"; + config = "x86_64-unknown-linux-gnu"; + }; + hostPlatform = { + system = "armv6l-linux"; + config = "armv6l-unknown-linux-gnueabihf"; + }; + }; + } + ] "weatherzero"; + isoInstall = stable.lib.nixosSystem { system = "x86_64-linux"; @@ -338,7 +354,7 @@ }; checks = let - buildList = ["europa" "stan" "h" "box" "faf"]; + buildList = ["europa" "stan" "h" "box" "faf" "weatherzero"]; in with unstable.lib; foldl' recursiveUpdate {} (mapAttrsToList (name: system: { diff --git a/hosts/weatherzero/default.nix b/hosts/weatherzero/default.nix new file mode 100644 index 0000000..4a8d985 --- /dev/null +++ b/hosts/weatherzero/default.nix @@ -0,0 +1,56 @@ +{ + config, + pkgs, + lib, + ... +}: let + pubKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7v+/xS8832iMqJHCWsxUZ8zYoMWoZhjj++e26g1fLT europa" + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBB/V8N5fqlSGgRCtLJMLDJ8Hd3JcJcY8skI0l+byLNRgQLZfTQRxlZ1yymRs36rXj+ASTnyw5ZDv+q2aXP7Lj0= hosts@secretive.plq.local" + ]; + userBase = { + openssh.authorizedKeys.keys = pubKeys ++ config.myconf.managementPubKeys; + }; +in { + _module.args.isUnstable = true; + imports = [ + ./hardware-configuration.nix + ]; + + defaultUsers.enable = false; + + boot = { + initrd.availableKernelModules = lib.mkForce [ + "mmc_block" + "usbhid" + "hid_generic" + "hid_microsoft" + ]; + + supportedFilesystems = lib.mkForce ["vfat"]; + + kernelPackages = lib.mkForce pkgs.linuxPackages_rpi0; + }; + + networking = { + hostName = "wzero"; + networkmanager = {enable = true;}; + wireless.userControlled.enable = true; + hosts."100.120.151.126" = ["graph.tapenet.org"]; + }; + + users.users.weather = { + shell = pkgs.zsh; + isNormalUser = true; + description = "Weather"; + extraGroups = ["wheel"]; + }; + + preDNS.enable = false; + users.users.root = userBase; + + #environment.systemPackages = with pkgs; [ + #]; + + system.stateVersion = "21.11"; +} diff --git a/hosts/weatherzero/hardware-configuration.nix b/hosts/weatherzero/hardware-configuration.nix new file mode 100644 index 0000000..6696d91 --- /dev/null +++ b/hosts/weatherzero/hardware-configuration.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + hardware = { + deviceTree = { + enable = true; + overlays = ["${pkgs.device-tree_rpi.overlays}/hifiberry-dac.dtbo"]; + }; + + enableRedistributableFirmware = true; + i2c.enable = true; + firmware = with pkgs; [ + raspberrypiWirelessFirmware + ]; + }; +}