rico*: put pi specific stuff in a module

This commit is contained in:
Adithya 2024-07-05 02:43:33 +05:30
parent 27dc382f9e
commit 9b292c4ddb
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
11 changed files with 40 additions and 45 deletions

View file

@ -11,16 +11,9 @@ _: {
nodeconfig = {
minimize = true;
nix.auto-gc = true;
is-pi = true;
};
# https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {

View file

@ -1,15 +1,11 @@
{ lib, pkgs, ... }: {
{ lib, ... }: {
imports = [ ./filesystem.nix ];
hardware.enableRedistributableFirmware = true;
boot = {
consoleLogLevel = 3;
initrd = {
availableKernelModules = [ "xhci_pci" ];
systemd.enable = true;
};
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi4;
kernel.sysctl = {
"vm.swappiness" = 10;
"vm.dirty_ratio" = 3;

View file

@ -12,8 +12,6 @@
environment.systemPackages = with pkgs; [
sops
age
libraspberrypi
raspberrypi-eeprom
];
}

View file

@ -11,16 +11,9 @@ _: {
nodeconfig = {
minimize = true;
nix.auto-gc = true;
is-pi = true;
};
# https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {

View file

@ -1,15 +1,11 @@
{ lib, pkgs, ... }: {
{ lib, ... }: {
imports = [ ./filesystem.nix ];
hardware.enableRedistributableFirmware = true;
boot = {
consoleLogLevel = 3;
initrd = {
availableKernelModules = [ "xhci_pci" ];
systemd.enable = true;
};
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi4;
kernel.sysctl = {
"vm.swappiness" = 10;
"vm.dirty_ratio" = 3;

View file

@ -12,8 +12,6 @@
environment.systemPackages = with pkgs; [
sops
age
libraspberrypi
raspberrypi-eeprom
];
}

View file

@ -11,16 +11,9 @@ _: {
nodeconfig = {
minimize = true;
nix.auto-gc = true;
is-pi = true;
};
# https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {

View file

@ -1,15 +1,11 @@
{ lib, pkgs, ... }: {
{ lib, ... }: {
imports = [ ./filesystem.nix ];
hardware.enableRedistributableFirmware = true;
boot = {
consoleLogLevel = 3;
initrd = {
availableKernelModules = [ "xhci_pci" ];
systemd.enable = true;
};
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi4;
kernel.sysctl = {
"vm.swappiness" = 10;
"vm.dirty_ratio" = 3;

View file

@ -12,8 +12,6 @@
environment.systemPackages = with pkgs; [
sops
age
libraspberrypi
raspberrypi-eeprom
];
}

View file

@ -2,5 +2,6 @@ _: {
imports = [
./general.nix
./nix.nix
./pi.nix
];
}

33
modules/pi.nix Normal file
View file

@ -0,0 +1,33 @@
{ lib, config, pkgs, ... }:
let cfg = config.nodeconfig; in {
options.nodeconfig = {
is-pi = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Is the node a Raspberry Pi?";
};
};
config = lib.mkIf cfg.is-pi {
# https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
boot = {
kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi4;
initrd.availableKernelModules = [ "xhci_pci" ];
};
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
hardware.enableRedistributableFirmware = true;
};
}