refactor to split pi versions
This commit is contained in:
parent
e911f02847
commit
b0d060cc77
4 changed files with 62 additions and 20 deletions
4
base.nix
4
base.nix
|
@ -12,8 +12,6 @@
|
|||
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
|
||||
boot.loader.generic-extlinux-compatible.enable = false;
|
||||
|
||||
# Set root password to a secure password
|
||||
users.users.root.password = "asecurepassword";
|
||||
|
||||
|
@ -36,8 +34,6 @@
|
|||
networking.hostName = "kiosk";
|
||||
time.timeZone = "America/New_York";
|
||||
|
||||
raspberry-pi-nix.board = "bcm2711";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
|
|
35
flake.nix
35
flake.nix
|
@ -7,24 +7,27 @@
|
|||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, rpi-nix, nixos-hardware, ... }: {
|
||||
|
||||
nixosConfigurations.kiosk = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
./base.nix
|
||||
./kiosk.nix
|
||||
outputs = inputs@{ nixpkgs, rpi-nix, nixos-hardware, ... }:
|
||||
let
|
||||
rpi = [
|
||||
./sd-image
|
||||
|
||||
rpi-nix.nixosModules.raspberry-pi
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
({ lib, pkgs, ... }: {
|
||||
sdImage.compressImage = false;
|
||||
|
||||
nixpkgs.buildPlatform = "x86_64-linux";
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi4;
|
||||
})
|
||||
];
|
||||
mkKiosk = system: modules: nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = nixpkgs.lib.flatten modules ++ [
|
||||
./base.nix
|
||||
./kiosk.nix
|
||||
];
|
||||
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
kiosk-rpi3 = mkKiosk "aarch64-linux" [ rpi ./rpi3.nix ];
|
||||
kiosk-rpi4 = mkKiosk "aarch64-linux" [ rpi ./rpi4.nix ];
|
||||
pc = mkKiosk "x86_64-linux" [ ./pc.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
13
rpi3.nix
Normal file
13
rpi3.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ inputs, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.nixos-hardware.nixosModules.raspberry-pi-3
|
||||
];
|
||||
|
||||
nixpkgs.buildPlatform = "x86_64-linux";
|
||||
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi3;
|
||||
|
||||
raspberry-pi-nix.board = "bcm2711";
|
||||
raspberry-pi-nix.uboot.enable = true;
|
||||
}
|
30
rpi4.nix
Normal file
30
rpi4.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ inputs, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
||||
];
|
||||
|
||||
nixpkgs.buildPlatform = "x86_64-linux";
|
||||
|
||||
raspberry-pi-nix.board = "bcm2711";
|
||||
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi4;
|
||||
|
||||
# nixos-hardware and raspberry-pi-nix conflict, set explicitly
|
||||
boot.loader.generic-extlinux-compatible.enable = false;
|
||||
|
||||
boot.extraModprobeConfig = ''
|
||||
options snd_bcm2835 enable_headphones=1 enable_hdmi=1 enable_compat_alsa=0
|
||||
'';
|
||||
|
||||
hardware.raspberry-pi."4" = {
|
||||
fkms-3d.enable = true;
|
||||
};
|
||||
|
||||
hardware.raspberry-pi.config.all.base-dt-params = {
|
||||
audio = {
|
||||
enable = true;
|
||||
value = true;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue