create sd image for pi 4
This commit is contained in:
parent
ea74b4294f
commit
9722448eed
2 changed files with 145 additions and 0 deletions
21
flake.nix
21
flake.nix
|
@ -110,6 +110,27 @@
|
|||
./hosts/rico1
|
||||
];
|
||||
};
|
||||
PiInstaller =
|
||||
let
|
||||
hostname = "PiInstaller";
|
||||
system = "aarch64-linux";
|
||||
username = "adtya";
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
pkgs = packages system;
|
||||
specialArgs = { inherit inputs username; };
|
||||
modules = [
|
||||
{
|
||||
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
|
||||
networking.hostName = lib.mkDefault hostname;
|
||||
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||
}
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
./common/nix.nix
|
||||
./sdimage/piinstaller
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
// flake-utils.lib.eachDefaultSystem (system:
|
||||
|
|
124
sdimage/piinstaller/default.nix
Normal file
124
sdimage/piinstaller/default.nix
Normal file
|
@ -0,0 +1,124 @@
|
|||
{ lib, pkgs, modulesPath, username, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: super: {
|
||||
makeModulesClosure = x:
|
||||
super.makeModulesClosure (x // { allowMissing = true; });
|
||||
})
|
||||
];
|
||||
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi4;
|
||||
boot.supportedFilesystems = lib.mkForce [ "vfat" "ext4" "btrfs" ];
|
||||
hardware = {
|
||||
deviceTree = {
|
||||
enable = true;
|
||||
};
|
||||
raspberry-pi."4" = {
|
||||
apply-overlays-dtmerge.enable = true;
|
||||
poe-plus-hat.enable = true;
|
||||
xhci.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
git.enable = true;
|
||||
zsh = {
|
||||
enable = true;
|
||||
autosuggestions.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
libraspberrypi
|
||||
raspberrypi-eeprom
|
||||
];
|
||||
sdImage.compressImage = false;
|
||||
|
||||
networking = {
|
||||
nameservers = [
|
||||
"2620:fe::fe#dns.quad9.net"
|
||||
"9.9.9.9#dns.quad9.net"
|
||||
"2620:fe::9#dns.quad9.net"
|
||||
"149.112.112.112#dns.quad9.net"
|
||||
];
|
||||
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
dhcp = "dhcpcd";
|
||||
dns = "systemd-resolved";
|
||||
wifi = {
|
||||
backend = "iwd";
|
||||
powersave = false;
|
||||
};
|
||||
};
|
||||
|
||||
useDHCP = lib.mkDefault false;
|
||||
|
||||
wireless.iwd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
General = {
|
||||
AddressRandomization = "network";
|
||||
EnableNetworkConfiguration = false;
|
||||
};
|
||||
Settings = {
|
||||
AutoConnect = "yes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.resolved = {
|
||||
enable = true;
|
||||
dnssec = "true";
|
||||
dnsovertls = "true";
|
||||
domains = [ "~." ];
|
||||
fallbackDns = [ ];
|
||||
};
|
||||
|
||||
services.openssh.enable = true;
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPxDgoV9yf+yPnp4pt5EWgo7uC25W66ehoL/rlshVW+8 Skipper"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPodFFNUK16y9bjHVMhr+Ykro3v1FVLbmqKg7mjMv3Wz Kowalski"
|
||||
];
|
||||
};
|
||||
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
extraLocaleSettings = {
|
||||
LC_ADDRESS = "en_US.UTF-8";
|
||||
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||
LC_MEASUREMENT = "en_US.UTF-8";
|
||||
LC_MONETARY = "en_US.UTF-8";
|
||||
LC_NAME = "en_US.UTF-8";
|
||||
LC_NUMERIC = "en_US.UTF-8";
|
||||
LC_PAPER = "en_US.UTF-8";
|
||||
LC_TELEPHONE = "en_US.UTF-8";
|
||||
LC_TIME = "en_US.UTF-8";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
};
|
||||
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
|
||||
};
|
||||
|
||||
time.timeZone = "Asia/Kolkata";
|
||||
system = {
|
||||
switch = {
|
||||
enable = false;
|
||||
enableNg = true;
|
||||
};
|
||||
stateVersion = "24.11";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue