chore: misc changes for pi setup

This commit is contained in:
truxnell 2024-03-21 09:17:01 +11:00
parent 6c2f9aa79f
commit 02dc1a7027
5 changed files with 36 additions and 20 deletions

View file

@ -65,11 +65,12 @@
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ 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 btop
git git
curl curl
wget wget
ssh-to-age
]; ];
nix = { nix = {

View file

@ -1,6 +1,7 @@
{ inputs { inputs
, lib , lib
, pkgs , pkgs
, config
, ... , ...
}: { }: {
nix = { 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 # Enable printing changes on nix build etc with nvd
system.activationScripts.report-changes = '' system.activationScripts.report-changes = ''
PATH=$PATH:${lib.makeBinPath [ pkgs.nvd pkgs.nix ]} PATH=$PATH:${lib.makeBinPath [ pkgs.nvd pkgs.nix ]}

View file

@ -23,11 +23,19 @@
../common/optional/maddy.nix ../common/optional/maddy.nix
]; ];
boot.loader.systemd-boot.enable = true; # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.efi.canTouchEfiVariables = true; 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. networking.hostName = "dns01"; # Define your hostname.
console.enable = false;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
# Pick only one of the below networking options. # Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.

View file

@ -16,13 +16,11 @@
../common/optional/fish.nix ../common/optional/fish.nix
../common/optional/monitoring.nix ../common/optional/monitoring.nix
../common/optional/reboot-required.nix ../common/optional/reboot-required.nix
../common/optional/dnscrypt-proxy2.nix
../common/optional/gnome.nix ../common/optional/gnome.nix
../common/optional/editors/vscode ../common/optional/editors/vscode
../common/optional/firefox.nix ../common/optional/firefox.nix
../common/optional/sops-nix.nix ../common/optional/sops-nix.nix
../common/optional/cloudflare-dyndns.nix
../common/optional/maddy.nix
]; ];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;

View file

@ -1,27 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -x
# Define variables # Define variables
drive="/dev/mmcblk1" # Change this to the desired drive, e.g., "/dev/sdb" drive="/dev/mmcblk1" # Change this to the desired drive, e.g., "/dev/sdb"
swap_size="100MB" # Change this to the desired swap size 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 # Partitioning
parted "${drive}" -- mklabel gpt parted "${drive}" -- mklabel gpt -s
parted "${drive}" -- mkpart root ext4 512MB -"$swap_size" parted "${drive}" -- mkpart root ext4 512MB -s# -"$swap_size"
parted "${drive}" -- mkpart swap linux-swap -"$swap_size" 100% #parted "${drive}" -- mkpart swap linux-swap -"$swap_size" 100%
parted "${drive}" -- mkpart ESP fat32 1MB 512MB parted "${drive}" -- mkpart ESP fat32 1MB 512MB -s
parted "${drive}" -- set 3 esp on parted "${drive}" -- set 3 esp on -s
# Formatting # Formatting
mkfs.ext4 -L nixos "${drive}p1" mkfs.ext4 -L nixos "${drive}p1"
mkswap -L swap "${drive}p2" #mkswap -L swap "${drive}p2"
mkfs.fat -F 32 -n boot "${drive}p3" mkfs.fat -F 32 -n boot "${drive}p3"
# Mounting disks for installation # Mounting disks for installation