🧱 use nixos-hardware for rpi4s

This commit is contained in:
James Walker 2022-06-24 22:44:43 -04:00
parent 5a7666240f
commit a3d7476d54
Signed by: walkah
GPG Key ID: 3C127179D6086E93
4 changed files with 32 additions and 123 deletions

View File

@ -107,11 +107,11 @@
}, },
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1653893745, "lastModified": 1656065134,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", "narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", "rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -129,11 +129,11 @@
"utils": "utils_2" "utils": "utils_2"
}, },
"locked": { "locked": {
"lastModified": 1655928858, "lastModified": 1656111632,
"narHash": "sha256-qVOcb7WVDiqs2yseZwCZRsKT0be8bF3NZufdBZVvZXU=", "narHash": "sha256-TqNwPFPRy/NP3zGf9DJvBFfIyVtsH150nkOIX07MKBI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e622bad16372aa5ada79a7fa749ec78715dffc54", "rev": "223b9deeaddb9b8e2a6325fb661d2f62abe8450d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -142,6 +142,22 @@
"type": "github" "type": "github"
} }
}, },
"nixos-hardware": {
"locked": {
"lastModified": 1655789751,
"narHash": "sha256-DbL2gn7YwkuX10OdlWfZ/A7zEJztwHh9NMeau1JMTdk=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "f9d8dff4e621f2d7f2b84d9e84bc6359715f971c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1648219316, "lastModified": 1648219316,
@ -208,11 +224,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1655567057, "lastModified": 1655876541,
"narHash": "sha256-Cc5hQSMsTzOHmZnYm8OSJ5RNUp22bd5NADWLHorULWQ=", "narHash": "sha256-eOz1YNclUTobC2f9meWpw+idhzWImdti43OKjLBoDq8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e0a42267f73ea52adc061a64650fddc59906fc99", "rev": "a0edeb02ae5b92eda6efbee4e26d8c33c15063fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -262,6 +278,7 @@
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }

View File

@ -3,6 +3,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = github:NixOS/nixos-hardware/master;
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
@ -32,6 +33,7 @@
outputs = outputs =
{ self { self
, nixpkgs , nixpkgs
, nixos-hardware
, deploy-rs , deploy-rs
, darwin , darwin
, flake-utils , flake-utils
@ -82,10 +84,10 @@
}) // { }) // {
nixosConfigurations = { nixosConfigurations = {
# Aristotle # Aristotle
agent = mkSystem "agent" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ]; agent = mkSystem "agent" "aarch64-linux" [ nixos-hardware.nixosModules.raspberry-pi-4 ./hosts/aristotle/configuration.nix ];
form = mkSystem "form" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ]; form = mkSystem "form" "aarch64-linux" [ nixos-hardware.nixosModules.raspberry-pi-4 ./hosts/aristotle/configuration.nix ];
matter = mkSystem "matter" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ]; matter = mkSystem "matter" "aarch64-linux" [ nixos-hardware.nixosModules.raspberry-pi-4 ./hosts/aristotle/configuration.nix ];
purpose = mkSystem "purpose" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ]; purpose = mkSystem "purpose" "aarch64-linux" [ nixos-hardware.nixosModules.raspberry-pi-4 ./hosts/aristotle/configuration.nix ];
plato = mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ]; plato = mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ];
socrates = mkSystem "socrates" "x86_64-linux" [ ./hosts/socrates/configuration.nix ]; socrates = mkSystem "socrates" "x86_64-linux" [ ./hosts/socrates/configuration.nix ];

View File

@ -4,7 +4,6 @@
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./rpi-poe.nix
../../modules/ipfs/cluster.nix ../../modules/ipfs/cluster.nix
../../modules/sops ../../modules/sops

View File

@ -1,109 +0,0 @@
{ config, lib, pkgs, ... }:
{
hardware = {
deviceTree = {
filter = "bcm2711-rpi-*.dtb";
overlays = [{
name = "rpi-poe";
dtsText = ''
/*
* Overlay for the Raspberry Pi POE HAT.
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target-path = "/";
__overlay__ {
fan0: rpi-poe-fan@0 {
compatible = "raspberrypi,rpi-poe-fan";
firmware = <&firmware>;
cooling-min-state = <0>;
cooling-max-state = <4>;
#cooling-cells = <2>;
cooling-levels = <0 1 10 100 255>;
status = "okay";
};
};
};
fragment@1 {
target = <&cpu_thermal>;
__overlay__ {
trips {
trip0: trip0 {
temperature = <40000>;
hysteresis = <2000>;
type = "active";
};
trip1: trip1 {
temperature = <45000>;
hysteresis = <2000>;
type = "active";
};
trip2: trip2 {
temperature = <50000>;
hysteresis = <2000>;
type = "active";
};
trip3: trip3 {
temperature = <55000>;
hysteresis = <5000>;
type = "active";
};
};
cooling-maps {
map0 {
trip = <&trip0>;
cooling-device = <&fan0 0 1>;
};
map1 {
trip = <&trip1>;
cooling-device = <&fan0 1 2>;
};
map2 {
trip = <&trip2>;
cooling-device = <&fan0 2 3>;
};
map3 {
trip = <&trip3>;
cooling-device = <&fan0 3 4>;
};
};
};
};
fragment@2 {
target-path = "/__overrides__";
__overlay__ {
poe_fan_temp0 = <&trip0>,"temperature:0";
poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
poe_fan_temp1 = <&trip1>,"temperature:0";
poe_fan_temp1_hyst = <&trip1>,"hysteresis:0";
poe_fan_temp2 = <&trip2>,"temperature:0";
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
poe_fan_temp3 = <&trip3>,"temperature:0";
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
};
};
__overrides__ {
poe_fan_temp0 = <&trip0>,"temperature:0";
poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
poe_fan_temp1 = <&trip1>,"temperature:0";
poe_fan_temp1_hyst = <&trip1>,"hysteresis:0";
poe_fan_temp2 = <&trip2>,"temperature:0";
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
poe_fan_temp3 = <&trip3>,"temperature:0";
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
};
};
'';
}];
};
};
}