From a1c3fc3649094033f6f605a5c3f7e7d9f4a29f45 Mon Sep 17 00:00:00 2001 From: iFargle Date: Tue, 27 Jun 2023 18:52:45 +0900 Subject: [PATCH] Update --- raspberry-pi/rpi4-configuration.nix | 51 +++++++++++++++++++++++++++++ server/test-configuration.nix | 37 +++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 raspberry-pi/rpi4-configuration.nix create mode 100644 server/test-configuration.nix diff --git a/raspberry-pi/rpi4-configuration.nix b/raspberry-pi/rpi4-configuration.nix new file mode 100644 index 00000000..0fef991b --- /dev/null +++ b/raspberry-pi/rpi4-configuration.nix @@ -0,0 +1,51 @@ +{ config, pkgs, lib, ... }: + +{ + # This configuration worked on 09-03-2021 nixos-unstable @ commit 102eb68ceec + # The image used https://hydra.nixos.org/build/134720986 + + boot = { + kernelPackages = pkgs.linuxPackages_rpi4; + tmpOnTmpfs = true; + initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; + # ttyAMA0 is the serial console broken out to the GPIO + kernelParams = [ + "8250.nr_uarts=1" + "console=ttyAMA0,115200" + "console=tty1" + # A lot GUI programs need this, nearly all wayland applications + "cma=128M" + ]; + }; + + boot.loader.raspberryPi = { + enable = true; + version = 4; + }; + boot.loader.grub.enable = false; + + # Required for the Wireless firmware + hardware.enableRedistributableFirmware = true; + + networking = { + hostName = "nixos-raspi-4"; # Define your hostname. + networkmanager = { + enable = true; + }; + }; + + nix = { + autoOptimiseStore = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + # Free up to 1GiB whenever there is less than 100MiB left. + extraOptions = '' + min-free = ${toString (100 * 1024 * 1024)} + max-free = ${toString (1024 * 1024 * 1024)} + ''; + }; + system.stateVersion = "20.09"; +} \ No newline at end of file diff --git a/server/test-configuration.nix b/server/test-configuration.nix new file mode 100644 index 00000000..a9c32968 --- /dev/null +++ b/server/test-configuration.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: # A pinned version of Nixpkgs passed to the configuration by Nix + +{ + # Enable Nix flakes and the unified Nix CLI + nix.settings = { + experimental-features = "nix-command flakes"; + }; + + # Networking configuration + networking.hostName = "fedora-p1"; + + # Enable OpenSSH + services.openssh.enable = true; + + # Root filesystem + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + # Create a user + users.users.albert = { + isNormalUser = false; + initialPassword = "Password"; + }; + + # CLI tools, language runtimes, shells, and other desired packages + environment.systemPackages = with pkgs; [ + curl + jq + wget + git + python + openssl + zsh + ]; +}sssss \ No newline at end of file