From 0caa2675c350a0e910b404e46834994398b074dd Mon Sep 17 00:00:00 2001 From: MLFlexer Date: Mon, 19 Aug 2024 20:36:00 +0200 Subject: [PATCH 1/4] update configuration for rpi5 --- hosts/rpi5/configuration.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hosts/rpi5/configuration.nix b/hosts/rpi5/configuration.nix index ac01c4c..5fd1ad4 100644 --- a/hosts/rpi5/configuration.nix +++ b/hosts/rpi5/configuration.nix @@ -34,13 +34,13 @@ in extraGroups = [ "networkmanager" "wheel" "docker" ]; shell = pkgs.zsh; packages = (with pkgs; [ + tmux blocky - minecraft-server - jdk # stable ]); #++ (with inputs.unstable; [ # # unstable # ]); + openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINdXjmV661jKgb8bOQ8MqpOlNTfRSo/AneI4KqJ6dhcf malthemlarsen@gmail.com" ]; }; programs.zsh.enable = true; @@ -48,10 +48,17 @@ in enable = true; settings.PasswordAuthentication = true; }; + services.adguardhome = { + enable = true; + openFirewall = true; + allowDHCP = true; + }; - - - networking.firewall.allowedTCPPorts = [ 22 443 8080 25565 ]; + 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; From c5c47b0560b63e7415a70c6d0bcf910a8b601d42 Mon Sep 17 00:00:00 2001 From: MLFlexer Date: Mon, 19 Aug 2024 21:20:57 +0200 Subject: [PATCH 2/4] fixed config --- hosts/rpi5/configuration.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hosts/rpi5/configuration.nix b/hosts/rpi5/configuration.nix index 16cf318..92fad2f 100644 --- a/hosts/rpi5/configuration.nix +++ b/hosts/rpi5/configuration.nix @@ -32,23 +32,22 @@ in { extraGroups = [ "networkmanager" "wheel" "docker" ]; shell = pkgs.zsh; packages = (with pkgs; [ + home-manager tmux blocky btop # stable - ]); #++ (with inputs.unstable; [ - # # unstable - # ]); + ]); #++ (with unstable; []); openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINdXjmV661jKgb8bOQ8MqpOlNTfRSo/AneI4KqJ6dhcf malthemlarsen@gmail.com" ]; }; programs.zsh.enable = true; + services.openssh = { enable = true; - userControlled.enable = true; - - networks = { }; + settings.PasswordAuthentication = true; }; + services.adguardhome = { enable = true; openFirewall = true; From c0b6b4995302468169760537e41e6e33dc1f1eba Mon Sep 17 00:00:00 2001 From: MLFlexer Date: Tue, 20 Aug 2024 17:04:09 +0200 Subject: [PATCH 3/4] update cache, substituers & nix-version --- flake.lock | 61 ++++++++++++-------------------- flake.nix | 14 +++++--- home-manager/config/nix/nix.conf | 2 ++ hosts/rpi5/configuration.nix | 8 ++--- hosts/rpi5/default.nix | 20 +++++++++-- 5 files changed, 55 insertions(+), 50 deletions(-) diff --git a/flake.lock b/flake.lock index e1d35ce..43dcdc4 100644 --- a/flake.lock +++ b/flake.lock @@ -114,11 +114,11 @@ ] }, "locked": { - "lastModified": 1723352546, - "narHash": "sha256-WTIrvp0yV8ODd6lxAq4F7EbrPQv0gscBnyfn559c3k8=", + "lastModified": 1723950649, + "narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "ec78079a904d7d55e81a0468d764d0fffb50ac06", + "rev": "392828aafbed62a6ea6ccab13728df2e67481805", "type": "github" }, "original": { @@ -129,11 +129,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1723310128, - "narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", + "lastModified": 1724067415, + "narHash": "sha256-WJBAEFXAtA41RMpK8mvw0cQ62CJkNMBtzcEeNIJV7b0=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", + "rev": "b09c46430ffcf18d575acf5c339b38ac4e1db5d2", "type": "github" }, "original": { @@ -150,11 +150,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1723124175, - "narHash": "sha256-w+rlZdbj4kn70uPJl4WrPDFoGEy0A9oJqw684nvZ9dY=", + "lastModified": 1724065442, + "narHash": "sha256-8ZUoyeO7Q70bLuijVYvToBSkApw9kfc5hMykTGxB64I=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "be1a6b2e4ddc34b9b6a297e7df2f2a2ecee24690", + "rev": "0bec2bfb8a2d4dd16e5b012982ca95e57d50e6a2", "type": "github" }, "original": { @@ -166,11 +166,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722087241, - "narHash": "sha256-2ShmEaFi0kJVOEEu5gmlykN5dwjWYWYUJmlRTvZQRpU=", + "lastModified": 1723688146, + "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8c50662509100d53229d4be607f1a3a31157fa12", + "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", "type": "github" }, "original": { @@ -182,11 +182,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1723991338, + "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "8a3354191c0d7144db9756a74755672387b702ba", "type": "github" }, "original": { @@ -198,11 +198,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1723556749, - "narHash": "sha256-+CHVZnTnIYRLYsARInHYoWkujzcRkLY/gXm3s5bE52o=", + "lastModified": 1723938990, + "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4a92571f9207810b559c9eac203d1f4d79830073", + "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", "type": "github" }, "original": { @@ -212,28 +212,12 @@ "type": "github" } }, - "nixpkgs_23_11": { - "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, "raspberry-pi-nix": { "inputs": { "libcamera-src": "libcamera-src", "libpisp-src": "libpisp-src", "nixpkgs": [ - "nixpkgs_23_11" + "nixpkgs" ], "rpi-bluez-firmware-src": "rpi-bluez-firmware-src", "rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src", @@ -244,11 +228,11 @@ "u-boot-src": "u-boot-src" }, "locked": { - "lastModified": 1722525809, - "narHash": "sha256-LTCbMSKbSHvKubfXolss39UeTKDIoP9wWTyXV/tDPHU=", + "lastModified": 1723990852, + "narHash": "sha256-72GMGaEOC0f7ExJMBSJhtMLX7Q3CnaXQHMjMO2NkRQA=", "owner": "tstat", "repo": "raspberry-pi-nix", - "rev": "35bb455fdeb495043a94433f67e05fa88980cdad", + "rev": "a993f0cd595ecc0836ca82640657527b934f9c9e", "type": "github" }, "original": { @@ -266,7 +250,6 @@ "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", - "nixpkgs_23_11": "nixpkgs_23_11", "raspberry-pi-nix": "raspberry-pi-nix" } }, diff --git a/flake.nix b/flake.nix index 4dd66d1..2f0ca34 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { @@ -19,8 +23,8 @@ 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"; + # nixpkgs_23_11.url = "github:nixos/nixpkgs/nixos-23.11"; + raspberry-pi-nix.inputs.nixpkgs.follows = "nixpkgs"; # for wsl nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; diff --git a/home-manager/config/nix/nix.conf b/home-manager/config/nix/nix.conf index b17708a..f723b96 100644 --- a/home-manager/config/nix/nix.conf +++ b/home-manager/config/nix/nix.conf @@ -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= diff --git a/hosts/rpi5/configuration.nix b/hosts/rpi5/configuration.nix index 92fad2f..218e338 100644 --- a/hosts/rpi5/configuration.nix +++ b/hosts/rpi5/configuration.nix @@ -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"; @@ -73,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 = { diff --git a/hosts/rpi5/default.nix b/hosts/rpi5/default.nix index a17e454..f3665c8 100644 --- a/hosts/rpi5/default.nix +++ b/hosts/rpi5/default.nix @@ -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 ]; } From 84b3bc962f9b674848fc0d90863d08ed4a313e6a Mon Sep 17 00:00:00 2001 From: MLFlexer Date: Tue, 20 Aug 2024 17:05:08 +0200 Subject: [PATCH 4/4] removed unused nixpkgs_23_11 --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index 2f0ca34..b20ea4b 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,6 @@ # 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"; # for wsl