Compare commits

...

18 commits

Author SHA1 Message Date
25b9dc42fb Add support for partitioning btrfs volumes 2024-12-07 21:14:58 +01:00
bb0e4fb945 Add scripts for installing btrfs 2024-12-07 21:14:36 +01:00
2e92274548 Remove trailing slashes properly 2024-12-07 21:09:18 +01:00
76b4071345 Fix incorrect config name 2024-12-07 20:03:58 +01:00
85a4989837 Create mount script in fileSystems module 2024-12-07 19:28:42 +01:00
8d56d55a05 Add a separate option for mounts 2024-12-07 19:11:41 +01:00
775a3fd386 Allow partitions without format 2024-12-07 18:45:44 +01:00
510a38efa9 Add btrfs support 2024-12-07 18:41:08 +01:00
600989f8a7 Remove unnecessary code 2024-12-07 18:36:54 +01:00
4f3c380340 Rename filesystem directory 2024-12-07 18:36:19 +01:00
c818c8c477 Remove redundancy 2024-12-07 17:50:10 +01:00
ed0ccb340f Store device scripts in scripts option 2024-12-07 17:49:57 +01:00
8c6bf72323 Refactor terminology 2024-12-07 17:43:53 +01:00
834c321e82 Move the script to the fileSystems module 2024-12-07 17:35:31 +01:00
d2d99a4b43 Split up disk script into multiple scripts 2024-12-07 16:12:04 +01:00
127ac0688f Remove separate os disk declaration 2024-12-07 16:11:19 +01:00
03e42c5578 Restructure partition config 2024-12-07 12:24:10 +01:00
7cf715f4d8 Remove duplicated code 2024-12-06 16:22:05 +01:00
22 changed files with 425 additions and 179 deletions

115
lib/modules/fileSystems.nix Normal file
View file

@ -0,0 +1,115 @@
{ lib, config, ... }:
let
inherit (lib) types mkOption;
cfg = config.valhalla.fileSystems;
mountType = types.submodule (
{ config, name, ... }: {
options = {
device = mkOption {
type = types.nullOr types.str;
description = "The device to mount.";
default = null;
};
mountPoint = mkOption {
type = types.str;
description = "The path to mount the device to.";
default = name;
};
fsType = mkOption {
type = types.nullOr types.str;
description = "The file system type of the mount.";
default = null;
};
options = mkOption {
type = types.listOf types.str;
description = "The options of the mount.";
default = [ ];
};
};
}
);
in
{
imports = [
./fileSystems/btrfs.nix
./fileSystems/disks.nix
];
options = {
valhalla = {
fileSystems = {
rootDir = mkOption {
type = types.str;
description = "The root of the installation directory to mount disks into.";
default = "/mnt";
};
mounts = mkOption {
type = types.attrsOf mountType;
description = "The devices to mount.";
default = { };
};
script = mkOption {
type = types.str;
description = "The script for preparing the system's mounts.";
};
};
};
};
config = {
valhalla = {
fileSystems = {
script =
let
inherit (lib.strings) normalizePath removeSuffix;
devices = (builtins.attrValues cfg.diskSetup.devices);
mountScript = lib.strings.concatLines (
(builtins.concatMap
(
_: [
"partprobe 2> /dev/null || true"
"udevadm trigger"
(builtins.concatStringsSep " " (
[ "sudo" "mount" "--mkdir" ] ++
(lib.optionals (_.fsType == "ntfs") [ "-t" "ntfs3" ]) ++
[
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.options))
(_.device)
(removeSuffix "/" (normalizePath "/${cfg.rootDir}/${_.mountPoint}"))
]
))
]
)
(builtins.attrValues cfg.mounts))
);
in
''
#!/bin/bash
set -o errexit
${cfg.diskSetup.scripts.init}
${lib.strings.concatLines (lib.optionals ((builtins.length devices) > 0) [
''echo $(tput setaf 3)=== WARNING ====$(jtput sgr0)"''
(''echo "Continuing this script will alter the partitions of ''
+ (lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init devices)))
+ (if (builtins.length devices) > 1 then " and " else "") + (lib.lists.last devices).deviceVariable + ''"'')
''
if ! fish ${./fileSystems/confirm.fish} "Are you sure you want to continue?" "n"; then
exit 1
fi
''
])}
${cfg.diskSetup.scripts.partition}
${cfg.btrfs.script}
${mountScript}
${cfg.diskSetup.scripts.swap}
'';
};
};
};
}

View file

@ -0,0 +1,108 @@
{ lib, config, ... }:
let
inherit (lib) types mkOption;
cfg = config.valhalla.fileSystems.btrfs;
profileType = types.enum [
"raid0"
"raid1"
"raid1c3"
"raid1c4"
"raid5"
"raid6"
"raid10"
"dup"
"single"
];
volumeType = types.submodule (
{ config, name, ... }: {
options = {
mountPoint = mkOption {
type = types.nullOr types.str;
description = "The path to mount the volume to.";
default = null;
};
devices = mkOption {
type = types.listOf types.str;
description = "The devices of the btrfs volume.";
};
label = mkOption {
type = types.nullOr types.str;
description = "The label of the volume.";
default = name;
};
dataProfile = mkOption {
type = types.nullOr profileType;
description = "The data profile.";
default = null;
};
metadataProfile = mkOption {
type = types.nullOr profileType;
description = "The metadata profile.";
default = null;
};
};
}
);
in
{
options = {
valhalla = {
fileSystems.btrfs = {
volumes = mkOption {
type = types.attrsOf volumeType;
description = "The btrfs volumes of the system.";
default = { };
};
script = mkOption {
type = types.str;
description = "The script for creating the btrfs volumes.";
default = lib.strings.concatLines (
builtins.map
(
_: builtins.concatStringsSep " " (
[ "mkfs.btrfs" ] ++
(lib.optionals (_.metadataProfile != null) [ "--metadata" "${_.metadataProfile}" ]) ++
(lib.optionals (_.dataProfile != null) [ "--data" "${_.dataProfile}" ]) ++
(lib.optionals (_.label != null) [ "--label" "${_.label}" ]) ++
_.devices
)
)
(builtins.attrValues cfg.volumes)
);
};
};
};
};
config = {
valhalla = {
linux.programs.btrfs = lib.optionalAttrs
(builtins.any
(_: (builtins.length _.devices) > 1)
(builtins.attrValues cfg.volumes))
{
enable = true;
pools = true;
};
fileSystems.mounts = lib.attrsets.concatMapAttrs
(
name: volume:
if (volume.mountPoint != null) then {
${volume.mountPoint} = {
device = builtins.elemAt volume.devices 0;
fsType = "btrfs";
};
} else { }
)
cfg.volumes;
};
};
}

View file

@ -22,7 +22,7 @@ function chooseDisk -a outFile message selectScript
end end
end end
select "$header" "$outFile" "$message" "No valid disk found!" "$(string collect $disks)" false select "$header" "$outFile" "$message" "No valid device found!" "$(string collect $disks)" false
and begin and begin
set -l disk (string split -n " " (cat "$outFile")) set -l disk (string split -n " " (cat "$outFile"))
echo "/dev/$disk[1]" >$outFile echo "/dev/$disk[1]" >$outFile

View file

@ -4,7 +4,8 @@ let
fs = import ./fs.nix; fs = import ./fs.nix;
diskListVarName = "myDisks"; cfg = config.valhalla.fileSystems;
deviceListVarName = "myDevices";
isSwap = partition: builtins.elem partition.type [ fs.swap 19 ]; isSwap = partition: builtins.elem partition.type [ fs.swap 19 ];
probeScript = builtins.concatStringsSep "\n" [ probeScript = builtins.concatStringsSep "\n" [
@ -12,39 +13,35 @@ let
"udevadm trigger" "udevadm trigger"
]; ];
mkDiskType = osDisk: types.submodule ( mkDeviceType = types.submodule (
{ config, name, ... }: { { config, name, ... }: {
options = { options = {
id = mkOption { id = mkOption {
type = types.str; type = types.str;
description = "The internal identifier of the disk."; description = "The internal identifier of the device.";
internal = true; internal = true;
}; };
wipe = mkOption { wipe = mkOption {
type = types.bool; type = types.bool;
description = "A value indicating whether the disk should be wiped."; description = "A value indicating whether the device should be wiped.";
default = !(lib.lists.any (_: _.keepExisting) (builtins.attrValues config.partitions)); default = !(lib.lists.any (_: _.keepExisting) (builtins.attrValues config.partitions));
}; };
deviceName = mkOption { name = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
description = "The name of the device."; description = "The name of the device.";
default = if osDisk then null else name; default = name;
}; };
devicePath = mkOption { path = mkOption {
type = type = types.nullOr types.str;
if osDisk then
types.nullOr types.str
else
types.str;
description = "The path to the device."; description = "The path to the device.";
default = default =
if osDisk && config.deviceName == null then if config.name == null then
null null
else else
"/dev/${config.deviceName}"; "/dev/${config.name}";
}; };
deviceScript = mkOption { deviceScript = mkOption {
@ -65,21 +62,28 @@ let
default = { }; default = { };
}; };
script = mkOption { scripts = {
type = types.str; init = mkOption {
description = "The script for formatting the disk."; type = types.str;
description = "A script for loading the device path into the device variable";
};
partition = mkOption {
type = types.str;
description = "A script for partitioning and formatting the device.";
};
}; };
}; };
config = config =
let let
diskVarName = "${diskListVarName}[${config.id}]"; deviceVarName = "${deviceListVarName}[${config.id}]";
diskVar = "\${${diskVarName}}"; deviceVar = "\${${deviceVarName}}";
diskSelector = '' deviceSelector = ''
result="$(mktemp)" result="$(mktemp)"
fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish} fish ${./choose-device.fish} "$result" "Please select the \"${name}\" device:" ${./select.fish}
${diskVarName}="$(cat "$result")" ${deviceVarName}="$(cat "$result")"
''; '';
partitions = lib.lists.sortOn (_: _.index) partitions = lib.lists.sortOn (_: _.index)
@ -99,13 +103,12 @@ let
"echo ${script} | ${ "echo ${script} | ${
fdiskCommand "${builtins.concatStringsSep " " args} ${ fdiskCommand "${builtins.concatStringsSep " " args} ${
if append then "--append" else "" if append then "--append" else ""
} ${diskVar}" } ${deviceVar}"
}"; }";
wipeScript = script: fdiskScript script [ ] false;
appendScript = index: script: fdiskScript script [ "-N" (builtins.toString index) ] true; appendScript = index: script: fdiskScript script [ "-N" (builtins.toString index) ] true;
cleanup = lib.strings.concatLines (builtins.map cleanup = lib.strings.concatLines (builtins.map
(partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true") (partition: "${fdiskCommand "--delete ${deviceVar} ${toString partition.index}"} || true")
(lib.lists.sortOn (lib.lists.sortOn
(partition: partition.index * -1) (partition: partition.index * -1)
(builtins.filter (_: !_.keepExisting) partitions))); (builtins.filter (_: !_.keepExisting) partitions)));
@ -113,7 +116,7 @@ let
fdiskCommands = lib.strings.concatLines fdiskCommands = lib.strings.concatLines
(lib.optionals config.wipe [ (lib.optionals config.wipe [
cleanup cleanup
(wipeScript "label: gpt") (fdiskScript "label: gpt" [ ] false)
] ++ (builtins.concatMap ] ++ (builtins.concatMap
( (
partition: partition:
@ -129,6 +132,7 @@ let
formatScripts = { formatScripts = {
${fs.ext4} = "mkfs.ext4 -F ${partVar}"; ${fs.ext4} = "mkfs.ext4 -F ${partVar}";
${fs.btrfs} = "mkfs.btrfs ${partVar}";
${fs.swap} = "mkswap ${partVar}"; ${fs.swap} = "mkswap ${partVar}";
${fs.ntfs} = "mkfs.ntfs -F ${partVar}"; ${fs.ntfs} = "mkfs.ntfs -F ${partVar}";
${fs.fat32} = "mkfs.fat -F 32 ${partVar}"; ${fs.fat32} = "mkfs.fat -F 32 ${partVar}";
@ -136,16 +140,18 @@ let
labelScripts = { labelScripts = {
${fs.ext4} = label: "e2label ${partVar} ${label}"; ${fs.ext4} = label: "e2label ${partVar} ${label}";
${fs.btrfs} = label: "btrfs filesystem label ${partVar} ${label}";
${fs.swap} = label: "swaplabel ${partVar} --label ${label}"; ${fs.swap} = label: "swaplabel ${partVar} --label ${label}";
${fs.ntfs} = label: "ntfslabel ${partVar} ${label}"; ${fs.ntfs} = label: "ntfslabel ${partVar} ${label}";
${fs.fat32} = label: "fatlabel ${partVar} ${label}"; ${fs.fat32} = label: "fatlabel ${partVar} ${label}";
}; };
create = lib.strings.concatLines [ create = lib.strings.concatLines ([
(appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'') (appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'')
probeScript probeScript
] ++ (lib.optionals (format != null) [
"sudo ${formatScripts.${format}}" "sudo ${formatScripts.${format}}"
]; ]));
fallback = '' fallback = ''
if ! { ls "${partVar}" 2>&1; } > /dev/null if ! { ls "${partVar}" 2>&1; } > /dev/null
@ -155,11 +161,12 @@ let
''; '';
in in
[ [
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"'' ''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${deviceVar})"''
''local ${partVarName}="$diskPath-part${toString index}"'' ''local ${partVarName}="$diskPath-part${toString index}"''
(if keepExisting then fallback else create) (if keepExisting then fallback else create)
] ++ (lib.optionals (format != null) [
"sudo ${labelScripts.${format} label}" "sudo ${labelScripts.${format} label}"
] ])
) )
partitions)); partitions));
@ -168,25 +175,25 @@ let
partition: partition:
lib.optional lib.optional
(partition.keepExisting && !(builtins.isNull partition.type)) (partition.keepExisting && !(builtins.isNull partition.type))
''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'' ''sudo sfdisk --part-type ${deviceVar} ${toString partition.index} ${mkType partition.type}''
) )
partitions); partitions);
in in
{ {
id = if osDisk then "os" else "disk-${name}"; id = "disk-${name}";
deviceVariable = diskVar; deviceVariable = deviceVar;
deviceScript = scripts = {
if osDisk && config.devicePath == null then '' init =
${diskSelector} if config.path == null then ''
'' else '' ${deviceSelector}
${diskVarName}=${config.devicePath} '' else ''
${if osDisk then '' ${deviceVarName}=${config.path}
if [ ! -b ${diskVar} ]; then if [ ! -b ${deviceVar} ]; then
function fallback() { function fallback() {
echo "Couldn't find the specified disk \"${diskVar}\"." echo "Couldn't find the specified disk \"${deviceVar}\"."
if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then if fish ${./confirm.fish} "Do you want to choose a different \"${name}\" disk?"; then
${diskSelector} ${deviceSelector}
else else
exit 1 exit 1
fi fi
@ -194,20 +201,19 @@ let
fallback fallback
fi fi
'' else '';
""}
partition = lib.mkDefault ''
function partition() {
${if (!config.wipe) then cleanup else ""}
${probeScript}
${fdiskCommands}
${fixType}
}
partition
''; '';
};
script = lib.mkDefault ''
function partition() {
${if (!config.wipe) then cleanup else ""}
${probeScript}
${fdiskCommands}
${fixType}
}
partition
'';
}; };
} }
); );
@ -239,13 +245,13 @@ let
}; };
format = mkOption { format = mkOption {
type = types.enum (builtins.attrValues fs); type = types.nullOr (types.enum (builtins.attrValues fs));
description = "The file system format of the partition."; description = "The file system format of the partition.";
default = default =
if (isSwap config) then if (isSwap config) then
fs.swap fs.swap
else else
throw ("Partition format not specified."); null;
}; };
size = mkOption { size = mkOption {
@ -291,27 +297,30 @@ in
{ {
options = { options = {
valhalla = { valhalla = {
partition = { fileSystems = {
rootDir = mkOption { diskSetup = {
type = types.str; devices = mkOption {
description = "The root of the installation directory to mount disks into."; type = types.attrsOf (mkDeviceType);
default = "/mnt"; description = "The disk devices to format.";
}; default = { };
};
os = mkOption { scripts = {
type = mkDiskType true; init = mkOption {
description = "The partition layout of the OS disk."; type = types.str;
}; description = "The script for initializing the disk partitioning script.";
};
disks = mkOption { partition = mkOption {
type = types.attrsOf (mkDiskType false); type = types.str;
description = "The additional disks to format."; description = "The script for partitioning the disks.";
default = { }; };
};
script = mkOption { swap = mkOption {
type = types.str; type = types.str;
description = "The script for partitioning the system's disks."; description = "The script for enabling swap devices.";
};
};
}; };
}; };
}; };
@ -319,67 +328,47 @@ in
config = { config = {
valhalla = { valhalla = {
partition = { fileSystems = {
script = lib.mkDefault ( mounts = (lib.attrsets.concatMapAttrs
let (
cfg = config.valhalla.partition; name: device:
inherit (cfg) os rootDir; lib.attrsets.concatMapAttrs
inherit (lib.strings) normalizePath; (
partPath = part: "/dev/disk/by-label/${part.label}"; name: partition:
disks = ([ os ] ++ (builtins.attrValues cfg.disks)); if partition.mountPoint != null then {
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); ${partition.mountPoint} = {
device = "/dev/disk/by-label/${partition.label}";
fsType = partition.format;
options = partition.mountOptions;
};
} else { }
)
device.partitions
)
cfg.diskSetup.devices);
mountScript = lib.strings.concatLines (builtins.concatMap diskSetup = {
( scripts =
_: [ let
probeScript partPath = part: "/dev/disk/by-label/${part.label}";
(builtins.concatStringsSep " " ([ disks = ((builtins.attrValues cfg.diskSetup.devices));
"sudo" partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
"mount" in
"--mkdir" {
] ++ (lib.optionals (_.format == "ntfs") [ init = lib.strings.concatLines (builtins.map (_: _.scripts.init) disks);
"-t" partition = lib.strings.concatLines (builtins.map (_: _.scripts.partition) disks);
"ntfs3" swap = lib.strings.concatLines (
]) ++ [ (builtins.map
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions)) (
(partPath _) _: ''
(normalizePath "/${rootDir}/${_.mountPoint}") ${probeScript}
])) sudo swapon ${partPath _}
] ''
) )
(lib.lists.sortOn (builtins.filter (_: _.useSwap) partitions))
(_: normalizePath "/${_.mountPoint}") );
(builtins.filter (_: _.mountPoint != null) partitions))); };
};
swapScript = lib.strings.concatLines (builtins.map
(
_: ''
${probeScript}
sudo swapon ${partPath _}
''
)
(builtins.filter (_: _.useSwap) partitions));
in
lib.strings.concatLines ([
"#!/bin/bash"
"set -o errexit"
]
++ (builtins.map (_: _.deviceScript) disks)
++ lib.optionals ((builtins.length disks) > 0) [
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
(''echo "Continuing this script will alter the partitions of ''
+ (lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init disks)))
+ (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable + ''"'')
''
if ! fish ${./confirm.fish} "Are you sure you want to continue?" "n"; then
exit 1
fi
''
] ++ (builtins.map (_: _.script) disks) ++ [
mountScript
swapScript
])
);
}; };
}; };
}; };

View file

@ -1,5 +1,6 @@
{ {
ext4 = "ext4"; ext4 = "ext4";
btrfs = "btrfs";
swap = "swap"; swap = "swap";
ntfs = "ntfs"; ntfs = "ntfs";
fat32 = "fat32"; fat32 = "fat32";

View file

@ -1,5 +0,0 @@
{ ... }: {
imports = [
./partition/disks.nix
];
}

View file

@ -91,6 +91,7 @@ let
in in
{ {
imports = [ imports = [
./programs/btrfs.nix
./programs/docker.nix ./programs/docker.nix
./programs/git.nix ./programs/git.nix
./programs/nextcloud.nix ./programs/nextcloud.nix

View file

@ -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";
};
};
};
}

View file

@ -2,10 +2,10 @@
let inherit (lib) mkOption types; let inherit (lib) mkOption types;
in { in {
imports = [ imports = [
./fileSystems.nix
./hardware.nix ./hardware.nix
./i18n.nix ./i18n.nix
./os.nix ./os.nix
./partition.nix
./programs.nix ./programs.nix
./software.nix ./software.nix
./users.nix ./users.nix

View file

@ -25,7 +25,7 @@
}; };
}; };
partition.os.partitions = { fileSystems.diskSetup.devices.OS.partitions = {
# Keep Windows' boot partition # Keep Windows' boot partition
Boot.keepExisting = true; Boot.keepExisting = true;

View file

@ -1,12 +1,12 @@
{ lib, config, ... }: { lib, config, ... }:
let fs = import ../../../../lib/modules/partition/fs.nix; let fs = import ../../../../lib/modules/fileSystems/fs.nix;
in { in {
imports = [ ../defaults.nix ]; imports = [ ../defaults.nix ];
config = { config = {
valhalla = { valhalla = {
partition = { fileSystems.diskSetup.devices = {
os = { OS = {
partitions = { partitions = {
Boot = { Boot = {
index = 1; index = 1;

View file

@ -1,32 +1,43 @@
{ lib, config, ... }: { lib, config, ... }:
let fs = import ../../../lib/modules/partition/fs.nix; let fs = import ../../../lib/modules/fileSystems/fs.nix;
in { in {
imports = [ ../../users/manuel/config.nix ]; imports = [ ../../users/manuel/config.nix ];
config = { config = {
valhalla = { valhalla = {
partition = { fileSystems = {
os = { diskSetup.devices = {
partitions = { OS = {
Boot = { path = "/dev/sda";
index = 1;
type = "uefi";
size = "+1G";
format = fs.fat32;
mountPoint = config.valhalla.boot.efiMountPoint;
};
Swap = { partitions = {
index = 2; Boot = {
type = "swap"; index = 1;
}; type = "uefi";
size = "+1G";
format = fs.fat32;
mountPoint = config.valhalla.boot.efiMountPoint;
};
Swap = {
index = 2;
type = "swap";
};
OS = {
index = 3;
label = lib.mkDefault config.valhalla.boot.label;
type = "linux";
};
};
};
};
btrfs = {
volumes = {
OS = { OS = {
index = 3;
label = lib.mkDefault config.valhalla.boot.label;
type = "linux";
format = fs.ext4;
mountPoint = "/"; mountPoint = "/";
devices = [ "/dev/sda3" "/dev/sdb" ];
}; };
}; };
}; };

View file

@ -91,6 +91,7 @@ begin
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null 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 arch-chroot "$mountDir" mkinitcpio -P
and runInOS fish "$tempDir/../Software/grub/main.fish" and runInOS fish "$tempDir/../Software/grub/main.fish"

View file

@ -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

View file

@ -71,6 +71,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
end end
and source "$dir/../../Common/Software/bash/main.fish" $argv 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/../../Common/Software/nuke-usb/main.fish" $argv
and source "$dir/../Software/sudo/main.fish" $argv and source "$dir/../Software/sudo/main.fish" $argv
and source "$dir/../Software/aliae/main.fish" $argv and source "$dir/../Software/aliae/main.fish" $argv

View file

@ -31,7 +31,6 @@ begin
set -l port set -l port
set -l file (mktemp) set -l file (mktemp)
set -l root (getServiceRoot $argv) set -l root (getServiceRoot $argv)
set -l bin /usr/local/bin/forgejo
set -l config "$root/docker-compose.base.yml" set -l config "$root/docker-compose.base.yml"
set -l overrides (getServiceOverrides $argv) set -l overrides (getServiceOverrides $argv)
set -l envKey "$(getServiceKey "$service").environment" set -l envKey "$(getServiceKey "$service").environment"
@ -72,14 +71,6 @@ begin
end end
rm "$file" rm "$file"
begin
printf "%s\n" \
"#!/bin/sh" \
"ssh -p $port -o StrictHostKeyChecking=no git@127.0.0.1 \"SSH_ORIGINAL_COMMAND=\\\"$SSH_ORIGINAL_COMMAND\\\" \$0 \$@\""
end | sudo tee "$bin" >/dev/null
chmod +x "$bin"
end end
function getServiceServers -V server function getServiceServers -V server

View file

@ -7,7 +7,7 @@ function initBackupConfig -V dir -d "Fetches the configuration by prompting the
if [ -z "$VALHALLA_BACKUP_DIR" ] if [ -z "$VALHALLA_BACKUP_DIR" ]
argparse -i "action=" -- $argv argparse -i "action=" -- $argv
set -l index set -l index
set -l confirm fish "$dir/../../lib/modules/partition/confirm.fish" set -l confirm fish "$dir/../../lib/modules/fileSystems/confirm.fish"
switch "$_flag_action" switch "$_flag_action"
case backup case backup

View file

@ -4,7 +4,7 @@ function isConfigured -S
end end
function selectProfile -S -a result function selectProfile -S -a result
source "$(status dirname)/../../lib/modules/partition/select.fish" source "$(status dirname)/../../lib/modules/fileSystems/select.fish"
set -l file (mktemp) set -l file (mktemp)
set -l header NAME set -l header NAME
set -l profiles set -l profiles

View file

@ -1,6 +1,6 @@
#!/bin/env fish #!/bin/env fish
function chooseDisk -a result message function chooseDisk -a result message
set -l file (mktemp) set -l file (mktemp)
fish "$(status dirname)/../../lib/modules/partition/choose-disk.fish" "$file" "$message" fish "$(status dirname)/../../lib/modules/fileSystems/choose-disk.fish" "$file" "$message"
set -g "$result" (cat "$file") set -g "$result" (cat "$file")
end end

View file

@ -1,4 +1,4 @@
#!/bin/env fish #!/bin/env fish
function confirm -a message default function confirm -a message default
fish "$(status dirname)/../../lib/modules/partition/confirm.fish" $argv fish "$(status dirname)/../../lib/modules/fileSystems/confirm.fish" $argv
end end