diff --git a/hosts/rico0/default.nix b/hosts/rico0/default.nix index 59c4244..71a6804 100644 --- a/hosts/rico0/default.nix +++ b/hosts/rico0/default.nix @@ -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 = { diff --git a/hosts/rico0/hardware/default.nix b/hosts/rico0/hardware/default.nix index d62b7f8..c2cffa3 100644 --- a/hosts/rico0/hardware/default.nix +++ b/hosts/rico0/hardware/default.nix @@ -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; diff --git a/hosts/rico0/programs/default.nix b/hosts/rico0/programs/default.nix index 3bc319f..0dc90ba 100644 --- a/hosts/rico0/programs/default.nix +++ b/hosts/rico0/programs/default.nix @@ -12,8 +12,6 @@ environment.systemPackages = with pkgs; [ sops age - libraspberrypi - raspberrypi-eeprom ]; } diff --git a/hosts/rico1/default.nix b/hosts/rico1/default.nix index 59c4244..71a6804 100644 --- a/hosts/rico1/default.nix +++ b/hosts/rico1/default.nix @@ -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 = { diff --git a/hosts/rico1/hardware/default.nix b/hosts/rico1/hardware/default.nix index d62b7f8..c2cffa3 100644 --- a/hosts/rico1/hardware/default.nix +++ b/hosts/rico1/hardware/default.nix @@ -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; diff --git a/hosts/rico1/programs/default.nix b/hosts/rico1/programs/default.nix index 3bc319f..0dc90ba 100644 --- a/hosts/rico1/programs/default.nix +++ b/hosts/rico1/programs/default.nix @@ -12,8 +12,6 @@ environment.systemPackages = with pkgs; [ sops age - libraspberrypi - raspberrypi-eeprom ]; } diff --git a/hosts/rico2/default.nix b/hosts/rico2/default.nix index 59c4244..71a6804 100644 --- a/hosts/rico2/default.nix +++ b/hosts/rico2/default.nix @@ -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 = { diff --git a/hosts/rico2/hardware/default.nix b/hosts/rico2/hardware/default.nix index d62b7f8..c2cffa3 100644 --- a/hosts/rico2/hardware/default.nix +++ b/hosts/rico2/hardware/default.nix @@ -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; diff --git a/hosts/rico2/programs/default.nix b/hosts/rico2/programs/default.nix index 3bc319f..0dc90ba 100644 --- a/hosts/rico2/programs/default.nix +++ b/hosts/rico2/programs/default.nix @@ -12,8 +12,6 @@ environment.systemPackages = with pkgs; [ sops age - libraspberrypi - raspberrypi-eeprom ]; } diff --git a/modules/default.nix b/modules/default.nix index 9e79ce3..cbbc4cb 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,5 +2,6 @@ _: { imports = [ ./general.nix ./nix.nix + ./pi.nix ]; } diff --git a/modules/pi.nix b/modules/pi.nix new file mode 100644 index 0000000..63503d1 --- /dev/null +++ b/modules/pi.nix @@ -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; + }; +}