From bb0e4fb945a88761e9538bdd584a82a8de9c1f11 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 7 Dec 2024 21:14:36 +0100 Subject: [PATCH] Add scripts for installing `btrfs` --- lib/modules/programs.nix | 1 + lib/modules/programs/btrfs.nix | 14 ++++++++++++++ scripts/Arch/OS/setup.fish | 1 + scripts/Arch/Software/btrfs/main.fish | 19 +++++++++++++++++++ scripts/Arch/lib/deploy.fish | 1 + 5 files changed, 36 insertions(+) create mode 100644 lib/modules/programs/btrfs.nix create mode 100755 scripts/Arch/Software/btrfs/main.fish diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix index ba618415..34b19b74 100644 --- a/lib/modules/programs.nix +++ b/lib/modules/programs.nix @@ -91,6 +91,7 @@ let in { imports = [ + ./programs/btrfs.nix ./programs/docker.nix ./programs/git.nix ./programs/nextcloud.nix diff --git a/lib/modules/programs/btrfs.nix b/lib/modules/programs/btrfs.nix new file mode 100644 index 00000000..afb06741 --- /dev/null +++ b/lib/modules/programs/btrfs.nix @@ -0,0 +1,14 @@ +{ lib, ... }: +let + inherit (lib) mkEnableOption; +in +{ + options = { + valhalla = { + linux.programs.btrfs = { + enable = mkEnableOption "btrfs tools"; + pools = mkEnableOption "btrfs pool support in bootloaders"; + }; + }; + }; +} diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 69a9057d..72d88248 100755 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -91,6 +91,7 @@ begin and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null + and runInOS fish "$tempDir/../Software/btrfs/main.fish" and arch-chroot "$mountDir" mkinitcpio -P and runInOS fish "$tempDir/../Software/grub/main.fish" diff --git a/scripts/Arch/Software/btrfs/main.fish b/scripts/Arch/Software/btrfs/main.fish new file mode 100755 index 00000000..d09f8f13 --- /dev/null +++ b/scripts/Arch/Software/btrfs/main.fish @@ -0,0 +1,19 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../lib/software.fish" + + function installSW + pacinst btrfs-progs + end + + function configureSW -V dir + source "$dir/../../../lib/settings.fish" + + if isOSEnabled "programs.btrfs.pools" + echo "HOOKS+=(btrfs)" | sudo tee /etc/mkinitcpio.conf.d/btrfs.conf >/dev/null + end + end + + runInstaller $argv +end diff --git a/scripts/Arch/lib/deploy.fish b/scripts/Arch/lib/deploy.fish index 61726ce4..59cd3d1f 100644 --- a/scripts/Arch/lib/deploy.fish +++ b/scripts/Arch/lib/deploy.fish @@ -71,6 +71,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action end and source "$dir/../../Common/Software/bash/main.fish" $argv + and source "$dir/../Software/btrfs/main.fish" $argv and source "$dir/../../Common/Software/nuke-usb/main.fish" $argv and source "$dir/../Software/sudo/main.fish" $argv and source "$dir/../Software/aliae/main.fish" $argv