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 = { nodeconfig = {
minimize = true; minimize = true;
nix.auto-gc = 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 = { i18n = {
defaultLocale = "en_US.UTF-8"; defaultLocale = "en_US.UTF-8";
extraLocaleSettings = { extraLocaleSettings = {

View file

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

View file

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

View file

@ -11,16 +11,9 @@ _: {
nodeconfig = { nodeconfig = {
minimize = true; minimize = true;
nix.auto-gc = 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 = { i18n = {
defaultLocale = "en_US.UTF-8"; defaultLocale = "en_US.UTF-8";
extraLocaleSettings = { extraLocaleSettings = {

View file

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

View file

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

View file

@ -11,16 +11,9 @@ _: {
nodeconfig = { nodeconfig = {
minimize = true; minimize = true;
nix.auto-gc = 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 = { i18n = {
defaultLocale = "en_US.UTF-8"; defaultLocale = "en_US.UTF-8";
extraLocaleSettings = { extraLocaleSettings = {

View file

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

View file

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

View file

@ -2,5 +2,6 @@ _: {
imports = [ imports = [
./general.nix ./general.nix
./nix.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;
};
}