about summary refs log tree commit diff
path: root/nix/hosts/pi1
diff options
context:
space:
mode:
authorEmile <git@emile.space>2024-06-09 00:29:00 +0200
committerEmile <git@emile.space>2024-06-09 00:29:00 +0200
commit9995ba6aaa25d377a686753f0f92da35e7895fe5 (patch)
treeb9074ec9c6253b25bc827353ed31a9d022e7c659 /nix/hosts/pi1
parent4734e0a6debaf1ba48ad106dde05bfec2fb0ccdf (diff)
playing around with building images for the pi1s
Diffstat (limited to 'nix/hosts/pi1')
-rw-r--r--nix/hosts/pi1/build.sh14
-rw-r--r--nix/hosts/pi1/configuration.nix50
2 files changed, 64 insertions, 0 deletions
diff --git a/nix/hosts/pi1/build.sh b/nix/hosts/pi1/build.sh
new file mode 100644
index 0000000..bb4fd1d
--- /dev/null
+++ b/nix/hosts/pi1/build.sh
@@ -0,0 +1,14 @@
+# # export NIX_PATH=nixpkgs=/home/jane/local_nixpkgs_checkout
+# nix-build --cores 0 '<nixpkgs/nixos>' \
+#   -I nixos-config=configuration.nix \
+#   -A config.system.build.sdImage \
+#   -o result-cross \
+#   --keep-going
+
+nix-build \
+	--cores 0 \
+	'<nixpkgs/nixos>' \
+	-I nixos-config=configuration.nix \
+	-A config.system.build.sdImage \
+	-o result-cross \
+	--show-trace
diff --git a/nix/hosts/pi1/configuration.nix b/nix/hosts/pi1/configuration.nix
new file mode 100644
index 0000000..9ee73e5
--- /dev/null
+++ b/nix/hosts/pi1/configuration.nix
@@ -0,0 +1,50 @@
+# Heavily based on https://gist.github.com/sorki/548de08f621b066c94f0c36a7a78cc41#file-configuration-nix-L9
+{ config, lib, ... }:
+
+{
+  imports = [
+    <nixpkgs/nixos/modules/installer/sd-card/sd-image-raspberrypi-installer.nix>
+    # ./wireless.nix # Just contains the PSK config of my wifi
+  ];
+
+  # Keep it ready for `dd`ing it on the SD card
+  sdImage = {
+    compressImage = false;
+  };
+
+  nixpkgs = {
+    crossSystem = {
+      system = "armv6l-linux";
+      platform = lib.systems.platforms.raspberrypi;
+    };
+
+    overlays = [
+      (self: super: {
+        mailutils = null; # Does not cross-compile. Missing binary breaks sendmail functionality of smartd
+      })
+    ];
+  };
+
+  # closure minification
+  environment.noXlibs = true;
+  services.xserver.enable = false;
+  services.xserver.desktopManager.xterm.enable = lib.mkForce false;
+  
+  # this pulls too much graphical stuff
+  services.udisks2.enable = lib.mkForce false;
+  # this pulls spidermonkey and firefox
+  security.polkit.enable = false;
+
+  boot.supportedFilesystems = lib.mkForce { "vfat" = true; };
+  i18n.supportedLocales = lib.mkForce [ (config.i18n.defaultLocale + "/UTF-8") ];
+
+  documentation.enable = false;
+  documentation.man.enable = false;
+  documentation.nixos.enable = false;
+
+	nixpkgs.config.allowUnsupportedSystem = true;
+
+  ## Combats the default setting of wpa_supplicant not starting on installation devices
+  ## https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/installation-device.nix#L74
+  # systemd.services.wpa_supplicant.wantedBy = lib.mkOverride 49 [ "multi-user.target" ];
+}