Remove Raspberry Pi 4 specific bits
This commit is contained in:
parent
b8ae40febd
commit
a389e1395d
@ -9,6 +9,34 @@
|
|||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Kernel configuration
|
||||||
|
boot = {
|
||||||
|
blacklistedKernelModules = [
|
||||||
|
"btusb"
|
||||||
|
"bluetooth"
|
||||||
|
];
|
||||||
|
kernelParams = [
|
||||||
|
"zfs.zfs_arc_max=8589934592"
|
||||||
|
"zfs.zfs_arc_min=1073741824"
|
||||||
|
];
|
||||||
|
supportedFilesystems = [ "zfs" ];
|
||||||
|
zfs = {
|
||||||
|
requestEncryptionCredentials = true;
|
||||||
|
extraPools = [ "vault" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Secure boot using lanzaboote
|
||||||
|
boot.loader = {
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
systemd-boot = {
|
||||||
|
enable = false;
|
||||||
|
configurationLimit = 50;
|
||||||
|
editor = false;
|
||||||
|
};
|
||||||
|
timeout = 3;
|
||||||
|
};
|
||||||
|
|
||||||
# Declare system packages
|
# Declare system packages
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
libraspberrypi
|
libraspberrypi
|
||||||
@ -57,12 +85,6 @@ with pkgs;
|
|||||||
time.timeZone = "Europe/Brussels";
|
time.timeZone = "Europe/Brussels";
|
||||||
services.timesyncd.enable = true;
|
services.timesyncd.enable = true;
|
||||||
|
|
||||||
# Enable ZFS support
|
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
|
||||||
|
|
||||||
# Don't import encrypted datasets
|
|
||||||
boot.zfs.requestEncryptionCredentials = false;
|
|
||||||
|
|
||||||
# Scrub zpool monthly
|
# Scrub zpool monthly
|
||||||
services.zfs.autoScrub = {
|
services.zfs.autoScrub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -73,9 +95,9 @@ with pkgs;
|
|||||||
nix = {
|
nix = {
|
||||||
settings = {
|
settings = {
|
||||||
auto-optimise-store = true;
|
auto-optimise-store = true;
|
||||||
experimental-features = [
|
trusted-users = [
|
||||||
"nix-command"
|
"root"
|
||||||
"flakes"
|
"coolneng"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
gc = {
|
gc = {
|
||||||
@ -87,6 +109,7 @@ with pkgs;
|
|||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
gc-keep-outputs = true
|
gc-keep-outputs = true
|
||||||
|
experimental-features = nix-command flakes
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,15 +222,6 @@ with pkgs;
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Limit the memory and CPU use of Nix
|
|
||||||
systemd.services.nixos-upgrade.serviceConfig = {
|
|
||||||
MemoryHigh = [ "500M" ];
|
|
||||||
MemoryMax = [ "2G" ];
|
|
||||||
MemorySwapMax = [ "500M" ];
|
|
||||||
CPUWeight = [ "50" ];
|
|
||||||
CPUQuota = [ "50%" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Configure git for auto-upgrade
|
# Configure git for auto-upgrade
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -233,7 +247,6 @@ with pkgs;
|
|||||||
./modules/periodic.nix
|
./modules/periodic.nix
|
||||||
./modules/communication.nix
|
./modules/communication.nix
|
||||||
./modules/information.nix
|
./modules/information.nix
|
||||||
./modules/device.nix
|
|
||||||
./modules/containers.nix
|
./modules/containers.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
...
|
...
|
||||||
}@inputs:
|
}@inputs:
|
||||||
let
|
let
|
||||||
system = "aarch64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
pkgs = import pkgs { inherit system; };
|
pkgs = import pkgs { inherit system; };
|
||||||
|
|
||||||
@ -41,8 +41,8 @@
|
|||||||
modules = [
|
modules = [
|
||||||
(import ./configuration.nix)
|
(import ./configuration.nix)
|
||||||
agenix.nixosModules.age
|
agenix.nixosModules.age
|
||||||
nixos-hardware.nixosModules.raspberry-pi-4
|
|
||||||
nix-matrix-appservices.nixosModule
|
nix-matrix-appservices.nixosModule
|
||||||
|
inputs.nixos-hardware.nixosModules.aoostar-r1-n100
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
{
|
|
||||||
# A bunch of boot parameters needed for optimal runtime on RPi 4B
|
|
||||||
boot.kernelPackages = linuxPackages_rpi4;
|
|
||||||
boot.kernelParams = [
|
|
||||||
"zfs.zfs_arc_max=134217728"
|
|
||||||
"console=TTYAMA0,115200"
|
|
||||||
"console=tty1"
|
|
||||||
"8250.nr_uarts=1"
|
|
||||||
"iomem=relaxed"
|
|
||||||
"strict-devmem=0"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enable SATA-HAT GPIO features
|
|
||||||
boot.loader = {
|
|
||||||
grub.enable = false;
|
|
||||||
generic-extlinux-compatible.enable = lib.mkForce false;
|
|
||||||
raspberryPi = {
|
|
||||||
enable = true;
|
|
||||||
version = 4;
|
|
||||||
firmwareConfig = ''
|
|
||||||
iomem=relaxed
|
|
||||||
strict-devmem=0
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Load PWM hardware timers
|
|
||||||
hardware.raspberry-pi."4".pwm0.enable = true;
|
|
||||||
|
|
||||||
# Enable I2C
|
|
||||||
hardware.raspberry-pi."4".i2c1.enable = true;
|
|
||||||
}
|
|
@ -35,22 +35,6 @@ in
|
|||||||
startAt = "02:00:00";
|
startAt = "02:00:00";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable SATA HAT fans
|
|
||||||
systemd.services.sata-hat = {
|
|
||||||
description = "Enable software support for SATA Hat";
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
script = ''
|
|
||||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh on"
|
|
||||||
'';
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
RemainAfterExit = "yes";
|
|
||||||
ExecStop = ''
|
|
||||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh off"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Push zion changes to git daily
|
# Push zion changes to git daily
|
||||||
systemd.user.services.zion-push = {
|
systemd.user.services.zion-push = {
|
||||||
description = "Push zion changes to git";
|
description = "Push zion changes to git";
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
BASE_PATH=/sys/class
|
|
||||||
GPIO_PATH="$BASE_PATH"/gpio
|
|
||||||
PWM_PATH="$BASE_PATH"/pwm/pwmchip0
|
|
||||||
|
|
||||||
# GPIO pins
|
|
||||||
CPU_FAN=12
|
|
||||||
HDD_FAN=13
|
|
||||||
|
|
||||||
# Values
|
|
||||||
LOW=0
|
|
||||||
HIGH=1
|
|
||||||
|
|
||||||
export_pin() {
|
|
||||||
if [ ! -e $GPIO_PATH/gpio"$1" ]; then
|
|
||||||
echo "$1" >$GPIO_PATH/export
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
unexport_pin() {
|
|
||||||
if [ -e $GPIO_PATH/gpio"$1" ]; then
|
|
||||||
echo "$1" >$GPIO_PATH/unexport
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_gpio() {
|
|
||||||
export_pin "$1"
|
|
||||||
echo "out" >$GPIO_PATH/gpio"$1"/direction
|
|
||||||
echo "$2" >$GPIO_PATH/gpio"$1"/value
|
|
||||||
if [ "$3" = "clean" ]; then
|
|
||||||
unexport_pin "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
enable_pwm_channel() {
|
|
||||||
echo "$1" >$PWM_PATH/export
|
|
||||||
echo 40000 >$PWM_PATH/pwm"$1"/period
|
|
||||||
echo 30000 >$PWM_PATH/pwm"$1"/duty_cycle
|
|
||||||
echo 1 >$PWM_PATH/pwm"$1"/enable
|
|
||||||
}
|
|
||||||
|
|
||||||
set_pwm() {
|
|
||||||
if [ "$1" = "clean" ]; then
|
|
||||||
echo 1 >$PWM_PATH/unexport
|
|
||||||
else
|
|
||||||
enable_pwm_channel 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
turn_on() {
|
|
||||||
set_gpio $CPU_FAN $HIGH
|
|
||||||
set_gpio $HDD_FAN $HIGH
|
|
||||||
set_pwm
|
|
||||||
}
|
|
||||||
|
|
||||||
turn_off() {
|
|
||||||
set_gpio $CPU_FAN $LOW clean
|
|
||||||
set_gpio $HDD_FAN $LOW clean
|
|
||||||
set_pwm clean
|
|
||||||
}
|
|
||||||
|
|
||||||
trap turn_off INT
|
|
||||||
|
|
||||||
if [ "$1" = "on" ]; then
|
|
||||||
turn_on
|
|
||||||
else
|
|
||||||
turn_off
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue
Block a user