Skip to content

Commit

Permalink
Merge pull request #17 from MLFlexer/rasptest
Browse files Browse the repository at this point in the history
Rasptest
  • Loading branch information
MLFlexer authored Aug 20, 2024
2 parents 8a968ab + 84b3bc9 commit 1ebf4e7
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 59 deletions.
61 changes: 22 additions & 39 deletions flake.lock

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

14 changes: 8 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

# for raspberry pi
nixConfig = {
extra-substituters = [ "https://raspberry-pi-nix.cachix.org" ];
extra-trusted-public-keys = [
"raspberry-pi-nix.cachix.org-1:WmV2rdSangxW0rZjY/tBvBDSaNFQ3DyEQsVw8EvHn9o="
substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
trusted-users = ["root" "mlflexer"];
};

inputs = {
Expand All @@ -18,9 +22,7 @@
# for raspberry pi
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
raspberry-pi-nix.url = "github:tstat/raspberry-pi-nix";
# Should be changed with this: https://github.com/tstat/raspberry-pi-nix/issues/19
nixpkgs_23_11.url = "github:nixos/nixpkgs/nixos-23.11";
raspberry-pi-nix.inputs.nixpkgs.follows = "nixpkgs_23_11";
raspberry-pi-nix.inputs.nixpkgs.follows = "nixpkgs";

# for wsl
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
Expand Down
2 changes: 2 additions & 0 deletions home-manager/config/nix/nix.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
experimental-features = nix-command flakes
extra-platforms = aarch64-linux
substituters = https://cache.nixos.org https://nix-community.cachix.org
trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
34 changes: 22 additions & 12 deletions hosts/rpi5/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ pkgs, ... }:
let user = "mlflexer";
in {
{ pkgs, unstable, user, raspberry-pi-nix, ... }:
{
time.timeZone = "Europe/Copenhagen";
# Select internationalisation properties.
i18n.defaultLocale = "en_DK.UTF-8";
Expand All @@ -16,7 +15,8 @@ in {
enable = true;
userControlled.enable = true;

networks = { };
networks = {
};
};
};

Expand All @@ -32,23 +32,32 @@ in {
shell = pkgs.zsh;
packages = (with pkgs; [
home-manager
btop
tmux
blocky
minecraft-server
jdk
btop
# stable
]); # ++ (with unstable; [
# # unstable
# ]);
]); #++ (with unstable; []);
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINdXjmV661jKgb8bOQ8MqpOlNTfRSo/AneI4KqJ6dhcf [email protected]" ];
};

programs.zsh.enable = true;

services.openssh = {
enable = true;
settings.PasswordAuthentication = true;
};

networking.firewall.allowedTCPPorts = [ 22 443 8080 25565 ];
services.adguardhome = {
enable = true;
openFirewall = true;
allowDHCP = true;
};

networking.firewall.allowedTCPPorts = [ 22 443 53 80 4221 5000 8000 8080 25565 6969 ];
networking.firewall.allowedUDPPortRanges = [
{ from = 2456; to = 2457; } # Valheim
{ from = 53; to = 53; } # adguard
];

nix = {
settings.auto-optimise-store = true;
Expand All @@ -63,7 +72,8 @@ in {
nixpkgs.config.allowUnfree = true;

environment.systemPackages = with pkgs; [ vim git bluez bluez-tools ];
system.stateVersion = "23.11";
system.stateVersion = "24.05";
raspberry-pi-nix.board = "bcm2712";
hardware = {
bluetooth.enable = true;
raspberry-pi = {
Expand Down
20 changes: 18 additions & 2 deletions hosts/rpi5/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{ inputs, ... }:

inputs.nixpkgs.lib.nixosSystem {
let
system = "aarch64-linux";
user = "mlflexer";

unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};

lib = inputs.nixpkgs.lib;

raspberry-pi-nix = inputs.raspberry-pi-nix;

in lib.nixosSystem {
inherit system;
specialArgs = {
inherit unstable user raspberry-pi-nix;
};
modules =
[ inputs.raspberry-pi-nix.nixosModules.raspberry-pi ./configuration.nix ];
[ raspberry-pi-nix.nixosModules.raspberry-pi ./configuration.nix ];
}

0 comments on commit 1ebf4e7

Please sign in to comment.