diff --git a/flake.nix b/flake.nix index 782a98d..cedab0f 100644 --- a/flake.nix +++ b/flake.nix @@ -195,6 +195,13 @@ monitorSetup = "none"; containerization = "podman"; }; + + rpi4-1 = mkSystem { + hostname = "rpi4-1"; + username = "phil"; + monitorSetup = "none"; + containerization = "podman"; + }; }; }; diff --git a/hosts/rpi4-1/default.nix b/hosts/rpi4-1/default.nix new file mode 100644 index 0000000..1cf9402 --- /dev/null +++ b/hosts/rpi4-1/default.nix @@ -0,0 +1,16 @@ +{ ... }: +{ + import = [ + ../rpi4 + ]; + + networking = { + hostName = "nix-rpi1"; + interfaces.end0.ipv4.addresses = [ + { + address = "192.168.2.35"; + prefixLength = 24; + } + ]; + }; +} diff --git a/hosts/rpi4/configuration.nix b/hosts/rpi4/configuration.nix deleted file mode 100644 index a37056d..0000000 --- a/hosts/rpi4/configuration.nix +++ /dev/null @@ -1,197 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ./fan-controll.nix - ]; - - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) - boot.loader.grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; - - # 📝 Uncomment the default hostname. - networking.hostName = "nix-rpi4-1"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # 📝 If you are using ethernet to connect to the device, uncomment the NetworkManager option. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # hardware.pulseaudio.enable = true; - # OR - # services.pipewire = { - # enable = true; - # pulse.enable = true; - # }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.libinput.enable = true; - - # Define a user account. Don't forget to set a password with 'passwd'. - # users.users.alice = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable 'sudo' for the user. - # packages = with pkgs; [ - # firefox - # tree - # ]; - # }; - - # Enable Raspberry Pi 4 GPIO support - # hardware.raspberry-pi."4".enable = true; - - # 📝 Make sure the `nixos` user stays. - users.users.nixos = { - isNormalUser = true; - extraGroups = [ "wheel" "gpio" ]; # Enable 'sudo' for the user. - shell = pkgs.fish; - # 📝 Re-add the trusted SSH keys. - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCaLHfxVylghDMYR8t4QMUpeRRqXasNABQKBEy9MmhbUXCcWiPbPMSZH8FMHON34rm2OrXP1kY/8jQxqBJDA+SqpFR2AZ4Khk9iVMaq5GHxxpn2amZUjoBa+fB29WaiE1npV5JVJV3O0ylw6GtiCnpneE6fGx2MO1vOY/7zKrUX/OK7WfwkDpeEzZgV/j/md917HrzUVeZwdeTq3WCRO8Gew6R8Xs6FRjSiGuH0dq14D4Ow5Zf1cI1jx+JfD/5vGasw8HXPu1NdxsOE+6D7/22IKqGr+S74/lAoyyD5qqk0s05lw8UY/PXBLJaNLZu9Fwx0BqTHpJEvftpmvd9wUxgR3msx9VXtKNSrqivIbDgeU+3oGzzkrGZODl7FCp4XKGmbrX85Z6lKwEGgv5jez4MLZcmT86bxB7m1wIbqSbVtfhS+GI7yPTA/kLzzFa14Im/+LTj95pb8qs2ALMwTMP1j2f9A6D3RriOFihL+68qn+YbK58KuV1R0f+CQRmlfVbk= phil@web.cyperpunk.de" - ]; - # 📝 Give user an empty password. - # ⚠️ This is pretty risky, so use only in initial setup. - password = "1P2h3i4lon"; - }; - - users.users.phil = { - isNormalUser = true; - extraGroups = [ "wheel" "gpio" "i2c" ]; # Enable 'sudo' for the user. - shell = pkgs.fish; - # 📝 Re-add the trusted SSH keys. - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCaLHfxVylghDMYR8t4QMUpeRRqXasNABQKBEy9MmhbUXCcWiPbPMSZH8FMHON34rm2OrXP1kY/8jQxqBJDA+SqpFR2AZ4Khk9iVMaq5GHxxpn2amZUjoBa+fB29WaiE1npV5JVJV3O0ylw6GtiCnpneE6fGx2MO1vOY/7zKrUX/OK7WfwkDpeEzZgV/j/md917HrzUVeZwdeTq3WCRO8Gew6R8Xs6FRjSiGuH0dq14D4Ow5Zf1cI1jx+JfD/5vGasw8HXPu1NdxsOE+6D7/22IKqGr+S74/lAoyyD5qqk0s05lw8UY/PXBLJaNLZu9Fwx0BqTHpJEvftpmvd9wUxgR3msx9VXtKNSrqivIbDgeU+3oGzzkrGZODl7FCp4XKGmbrX85Z6lKwEGgv5jez4MLZcmT86bxB7m1wIbqSbVtfhS+GI7yPTA/kLzzFa14Im/+LTj95pb8qs2ALMwTMP1j2f9A6D3RriOFihL+68qn+YbK58KuV1R0f+CQRmlfVbk= phil@web.cyperpunk.de" - ]; - # 📝 Give user an empty password. - # ⚠️ This is pretty risky, so use only in initial setup. - password = "1P2h3i4lon"; - }; - # 📝 Remove the need to be prompted for a password when using `sudo`. - # ⚠️ This is pretty risky, so use only in initial setup. - security.sudo.wheelNeedsPassword = false; - - # List packages installed in system profile. To search, run: - # $ nix search wget - # 📝 Uncomment system packages to ensure that vim access stays. - environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - git - fastfetch - neovim - curl - fish - kitty - libgpiod - hping - gcc - libraspberrypi - eza - fzf - stress-ng - i2c-tools - ]; - - # Enable fish shell - programs.fish = { - enable = true; - shellAliases = { - ls = "eza"; - la = "eza -la"; - f = "fzf"; - i = "kitty +kitten icat"; - tw = "tw --theme config"; - }; - interactiveShellInit = '' - starship init fish | source - fzf --fish | source - function fish_greeting - fastfetch - end - ''; - }; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # 📝 Add SSH access, but only using SSH keys, and to the NixOS user. - services.openssh = { - enable = true; - authorizedKeysInHomedir = true; # Do not trust SSH keys in ~/.ssh/authorized_keys. - settings = { - PasswordAuthentication = true; # Disable password authentication. - AllowUsers = [ "nixos" "phil" ]; # Allow only login via the "nixos" user. - PermitRootLogin = "no"; # Disable root login via SSH. - }; - }; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # 📝 Uncomment firewall option if you are okay with disabling the firewall entirely during initial setup. - networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - # This option defines the first version of NixOS you have installed on this particular machine, - # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. - # - # Most users should NEVER change this value after the initial install, for any reason, - # even if you've upgraded your system to a new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how - # to actually do that. - # - # This value being lower than the current NixOS release does NOT mean your system is - # out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, - # and migrated your data accordingly. - # - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "24.11"; # Did you read the comment? - -} diff --git a/hosts/rpi4/default.nix b/hosts/rpi4/default.nix new file mode 100644 index 0000000..36f584f --- /dev/null +++ b/hosts/rpi4/default.nix @@ -0,0 +1,56 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ./fan-controll.nix + ]; + + boot.loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + + networking.hostName = "nix-rpi4-1"; # Define your hostname. + + networking = { + networkmanager.enable = false; + useNetworkd = true; + useDHCP = false; + + interfaces.end0 = { + defaultGateway = { + address = "192.168.2.1"; + interface = "end0"; + }; + + nameservers = [ + "192.168.2.2" + "1.1.1.1" + "8.8.8.8" + ]; + }; + + wireless = { + enable = true; + userControlled.enable = false; + networks = { + "LANFRED".psk = "CooleJungsWG"; + }; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + networking.firewall.enable = false; + + system.stateVersion = "25.11"; # Did you read the comment? + +}