Skip to content

Commit

Permalink
rpi5: initial config
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Dec 26, 2024
1 parent f004b0b commit b684846
Show file tree
Hide file tree
Showing 11 changed files with 426 additions and 0 deletions.
180 changes: 180 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};

raspberry-pi-nix = {
url = "github:nix-community/raspberry-pi-nix/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};

deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down Expand Up @@ -92,13 +97,15 @@
nixosConfigurations = {
jamie-desktop = mkSystem "jamie-desktop" "x86_64-linux" [ ];
rpi = mkSystem "rpi" "aarch64-linux" [ ];
rpi5 = mkSystem "rpi5" "aarch64-linux" [ ];
jamie-hyperv = mkSystem "jamie-hyperv" "x86_64-linux" [ ];
alfred = mkSystem "alfred" "x86_64-linux" [ ];
};

homeConfigurations = {
"jamie@jamie-desktop" = mkHome "jamie" "wsl" "x86_64-linux" [ ];
"jamie@rpi" = mkHome "jamie" "rpi" "aarch64-linux" [ ];
"jamie@rpi5" = mkHome "jamie" "rpi5" "aarch64-linux" [ ];
"jamie@jamie-hyperv" = mkHome "jamie" "jamie-hyperv" "x86_64-linux" [ ];
"jamie@alfred" = mkHome "jamie" "alfred" "x86_64-linux" [ ];
"jamie@generic" = mkHome "jamie" "generic" "x86_64-linux" [ ];
Expand Down
8 changes: 8 additions & 0 deletions home/jamie/rpi5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ inputs, ... }:
{
imports = [
./global

./features/cli
];
}
12 changes: 12 additions & 0 deletions hosts/common/global/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
"flakes"
];
warn-dirty = false;
substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
trusted-substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
package = pkgs.nixVersions.latest;
gc = {
Expand Down
Empty file added hosts/rpi5/README.md
Empty file.
40 changes: 40 additions & 0 deletions hosts/rpi5/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ inputs, ... }:
{
imports = [
./hardware-configuration.nix

../common/global
../common/users/jamie.nix

../common/optional/vscode-server.nix

./services
];

networking = {
hostName = "rpi5";
#defaultGateway = {
# address = "192.168.1.1";
# interface = "end0";
#};
# interfaces.end0 = {
# wakeOnLan.enable = true;
# ipv4.addresses = [
# {
# address = "192.168.1.3";
# prefixLength = 24;
# }
# ];
# ipv6.addresses = [
# {
# address = "fd63:e339:d9fc::3";
# prefixLength = 64;
# }
# ];
#};
};

raspberry-pi-nix.libcamera-overlay.enable = false;

system.stateVersion = "24.05";
}
39 changes: 39 additions & 0 deletions hosts/rpi5/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ inputs, ... }:
{
imports = [
inputs.raspberry-pi-nix.nixosModules.raspberry-pi
];

fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
};

hardware = {
raspberry-pi = {
config = {
all = {
base-dt-params = {
usb_max_current_enable = {
enable = true;
value = 1;
};
pciex1_gen = {
value = 3;
enable = true;
};
};
};
};
};
};

raspberry-pi-nix.board = "bcm2712";
nixpkgs.hostPlatform.system = "aarch64-linux";
}
29 changes: 29 additions & 0 deletions hosts/rpi5/services/adguard.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
services.adguardhome = {
enable = true;
};

networking.firewall = {
allowedTCPPorts = [
53
853
];
allowedUDPPorts = [
53
853
];
};

services.caddy.virtualHosts."rpi5.tailnet-0b15.ts.net" = {
extraConfig = ''
handle_path /dns* {
reverse_proxy http://[::1]:3000
}
@dns {
header Referer https://rpi5.tailnet-0b15.ts.net/dns
}
reverse_proxy @dns http://[::1]:3000
'';
};
}
Loading

0 comments on commit b684846

Please sign in to comment.