From 02dc1a702757b5db0a0f4a2ff0274b10180f6d36 Mon Sep 17 00:00:00 2001 From: truxnell <19149206+truxnell@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:17:01 +1100 Subject: [PATCH] chore: misc changes for pi setup --- nixos/hosts/bootstrap/configuration.nix | 3 ++- nixos/hosts/common/nixos/nix.nix | 16 ++++++++++++++++ nixos/hosts/dns01/default.nix | 12 ++++++++++-- nixos/hosts/nixosvm/default.nix | 4 +--- partition.sh | 21 +++++++-------------- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/nixos/hosts/bootstrap/configuration.nix b/nixos/hosts/bootstrap/configuration.nix index 8c8a9af..6ba6aa7 100644 --- a/nixos/hosts/bootstrap/configuration.nix +++ b/nixos/hosts/bootstrap/configuration.nix @@ -65,11 +65,12 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. btop git curl wget + ssh-to-age ]; nix = { diff --git a/nixos/hosts/common/nixos/nix.nix b/nixos/hosts/common/nixos/nix.nix index e790933..f0a456c 100644 --- a/nixos/hosts/common/nixos/nix.nix +++ b/nixos/hosts/common/nixos/nix.nix @@ -1,6 +1,7 @@ { inputs , lib , pkgs +, config , ... }: { nix = { @@ -15,6 +16,21 @@ }; }; + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: { inherit flake; })) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = [ "/etc/nix/path" ]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + # Enable printing changes on nix build etc with nvd system.activationScripts.report-changes = '' PATH=$PATH:${lib.makeBinPath [ pkgs.nvd pkgs.nix ]} diff --git a/nixos/hosts/dns01/default.nix b/nixos/hosts/dns01/default.nix index 6b55b0a..5c41b53 100644 --- a/nixos/hosts/dns01/default.nix +++ b/nixos/hosts/dns01/default.nix @@ -23,11 +23,19 @@ ../common/optional/maddy.nix ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + # 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; networking.hostName = "dns01"; # Define your hostname. + console.enable = false; + environment.systemPackages = with pkgs; [ + libraspberrypi + raspberrypi-eeprom + ]; + # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. diff --git a/nixos/hosts/nixosvm/default.nix b/nixos/hosts/nixosvm/default.nix index 8356a9b..a540998 100644 --- a/nixos/hosts/nixosvm/default.nix +++ b/nixos/hosts/nixosvm/default.nix @@ -16,13 +16,11 @@ ../common/optional/fish.nix ../common/optional/monitoring.nix ../common/optional/reboot-required.nix - ../common/optional/dnscrypt-proxy2.nix ../common/optional/gnome.nix ../common/optional/editors/vscode ../common/optional/firefox.nix ../common/optional/sops-nix.nix - ../common/optional/cloudflare-dyndns.nix - ../common/optional/maddy.nix + ]; boot.loader.systemd-boot.enable = true; diff --git a/partition.sh b/partition.sh index 70a130c..e592d8f 100644 --- a/partition.sh +++ b/partition.sh @@ -1,27 +1,20 @@ #!/usr/bin/env bash - +set -x # Define variables drive="/dev/mmcblk1" # Change this to the desired drive, e.g., "/dev/sdb" swap_size="100MB" # Change this to the desired swap size -# Confirmation prompt -read -p "This script will partition and format $drive. Are you sure you want to proceed? (y/n): " choice -if [ "$choice" != "y" ]; then - echo "Exiting script." - exit 1 -fi - # Partitioning -parted "${drive}" -- mklabel gpt -parted "${drive}" -- mkpart root ext4 512MB -"$swap_size" -parted "${drive}" -- mkpart swap linux-swap -"$swap_size" 100% -parted "${drive}" -- mkpart ESP fat32 1MB 512MB -parted "${drive}" -- set 3 esp on +parted "${drive}" -- mklabel gpt -s +parted "${drive}" -- mkpart root ext4 512MB -s# -"$swap_size" +#parted "${drive}" -- mkpart swap linux-swap -"$swap_size" 100% +parted "${drive}" -- mkpart ESP fat32 1MB 512MB -s +parted "${drive}" -- set 3 esp on -s # Formatting mkfs.ext4 -L nixos "${drive}p1" -mkswap -L swap "${drive}p2" +#mkswap -L swap "${drive}p2" mkfs.fat -F 32 -n boot "${drive}p3" # Mounting disks for installation