Skip to content

Instantly share code, notes, and snippets.

@jaen

jaen/build.sh Secret

Created January 29, 2020 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaen/babb55f20f7232ff3f1c903b09cbb6e9 to your computer and use it in GitHub Desktop.
Save jaen/babb55f20f7232ff3f1c903b09cbb6e9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage --option system aarch64-linux -I nixos-config=./default.nix
{ pkgs, config, lib, ... }:
let
users = import ../common/users.nix { pkgs = pkgs; };
in
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix>
./hardware-configuration.nix
];
sdImage = {
compressImage = false;
};
users.extraUsers = users;
networking = {
hostName = "chii";
domain = "jaen.me";
dhcpcd.enable = false;
useDHCP = false;
wireless.enable = false;
defaultGateway = "192.168.1.1";
nameservers = [ "192.168.1.2" "1.1.1.1" "8.8.8.8" "8.8.4.4" ];
interfaces = {
eth0 = {
ipv4 = {
addresses = [{
address = "192.168.1.3";
prefixLength = 24;
}];
# routes = [
# { address = "192.168.1.3/24"; prefixLength = 0; via = "192.168.1.1"; }
# ];
};
};
};
};
services.openssh = {
enable = true;
permitRootLogin = lib.mkForce "no";
passwordAuthentication = false;
listenAddresses = [{ addr = "0.0.0.0"; }];
};
systemd.services.openssh.wantedBy = lib.mkOverride 10 [
"default.target"
];
}
{ config, lib, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "usbhid" ];
boot.initrd.kernelModules = [ ];
boot.initrd.checkJournalingFS = false;
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.loader.grub.enable = false;
boot.loader.raspberryPi = {
enable = true;
version = 4;
};
hardware.enableRedistributableFirmware = true;
fileSystems."/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
swapDevices = [{
device = "/swapfile";
size = 2048;
}];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment