Compare commits

..

47 commits

Author SHA1 Message Date
d218d0495d Format all files 2024-11-29 01:15:08 +01:00
6d1c9fee53 FIx handling users with no docker services 2024-11-29 01:15:08 +01:00
7f9616be02 Fix invalid git cli call 2024-11-29 01:15:08 +01:00
e20681a1bd Add missing function argument 2024-11-29 01:15:08 +01:00
597fa1ee1f Inherit all env variables in the tmux session 2024-11-29 01:15:08 +01:00
98ff044bc2 Back up teamspeak properly 2024-11-29 01:15:08 +01:00
85b6f8ccc6 Force creation of an ssh key for backups 2024-11-29 01:15:08 +01:00
d1588b4d9f Preserve PATH for setup actions 2024-11-29 01:15:08 +01:00
9b53e96561 Add scripts for installing a terraria server 2024-11-29 01:15:08 +01:00
70d2323d68 Back up extra files using getExtraBackupPatterns 2024-11-29 01:15:08 +01:00
2e1fa261bd Remove world mounts for minecraft services 2024-11-29 01:15:08 +01:00
080d3d3222 Simplify xaseco command handling 2024-11-29 01:15:08 +01:00
1e2ce910c2 Silence unnecessary output 2024-11-29 01:15:08 +01:00
f259592064 Allow specifying xaseco operators and admins 2024-11-29 01:15:08 +01:00
df1077ffe8 Normalize display name of vaultwarden mailer 2024-11-29 01:15:08 +01:00
8bed36aed5 Store all game data of TrackMania service 2024-11-29 01:15:08 +01:00
3b9943f1a1 Add declaration of transmission service 2024-11-29 01:15:08 +01:00
05d0d5a692 Leave user of wekan container unchanged 2024-11-29 01:15:08 +01:00
5970d729af Store domain names in overrides 2024-11-29 01:15:08 +01:00
3b489ee5fb Normalize the save path of service data 2024-11-29 01:15:08 +01:00
ad1d72d85b Improve the format of the docker files 2024-11-29 01:15:08 +01:00
54b6eccbf0 Rename secrets files to overrides 2024-11-29 01:15:08 +01:00
d3134647dd Store Jellyfin domain in secrets 2024-11-29 01:15:08 +01:00
3ab2b71afb Allow specifying overrides for docker services 2024-11-29 01:15:08 +01:00
d144876afb Allow specifying additional patterns to back up 2024-11-29 01:15:08 +01:00
18e531141b Configure forgejo runner by default 2024-11-29 01:15:08 +01:00
4db9a640b3 Store all forgejo files in data/ 2024-11-29 01:15:08 +01:00
5ee149e42a Set forgejo domain by default 2024-11-29 01:15:08 +01:00
269f8b89e9 Reduce redundancy of drone setup 2024-11-29 01:15:08 +01:00
d9ace95328 Fix order of properties in drone templates 2024-11-29 01:15:08 +01:00
7248ec703a Load enabled services from machine config 2024-11-29 01:15:08 +01:00
e25c00cd39 Ensure nix channels are functioning 2024-11-29 01:15:08 +01:00
df2e0ffc16 Force running actions as setup-user 2024-11-29 01:15:08 +01:00
981e6eaa5c Skip backup questions if specified 2024-11-29 01:15:08 +01:00
222467b5ae Create backup whitelist for docker-compose 2024-11-29 01:15:08 +01:00
f8e4e94af5 Add a profile for the server 2024-11-29 01:15:08 +01:00
67e5e04a06 Add options for enabling docker-compose services 2024-11-29 01:15:08 +01:00
3df1501fbc Add scripts for installing woodpecker 2024-11-29 01:15:08 +01:00
395d69c974 Add scripts for installing wekan 2024-11-29 01:15:08 +01:00
567a0d8070 Add scripts for installing TrackMania server 2024-11-29 01:15:08 +01:00
b4b87f37ea Replace yq with go-yq 2024-11-29 01:15:08 +01:00
5e1686402c Add scripts for installing TeamSpeak 2024-11-29 01:15:08 +01:00
885e7cf9d0 Add scripts for installing ryot 2024-11-29 01:15:08 +01:00
8b9758dea0 Add scripts for installing nextcloud 2024-11-29 01:15:08 +01:00
ed237fb750 Restructure service overrides 2024-11-29 01:15:08 +01:00
61276f51c9 Add scripts for installing Minecraft 2024-11-29 01:15:08 +01:00
a4bd5c60d2 Add settings for allowing VPN access in lxc 2024-11-29 01:15:08 +01:00
57 changed files with 739 additions and 667 deletions

View file

@ -5,17 +5,16 @@ fi
~/.automated_script.sh ~/.automated_script.sh
if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1 if bash -c "ls /sys/class/backlight/*/max_brightness" >/dev/null 2>&1; then
then cat /sys/class/backlight/*/max_brightness >/sys/class/backlight/*/brightness
cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
fi fi
cd "/root/PortValhalla" || exit cd "/root/PortValhalla" || exit
git diff -p -R --no-ext-diff --no-color --diff-filter=M \ git diff -p -R --no-ext-diff --no-color --diff-filter=M |
| grep -E "^(diff|(old|new) mode)" --color=never \ grep -E "^(diff|(old|new) mode)" --color=never |
| sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \ sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" |
| git apply git apply
loadkeys de_CH-latin1 loadkeys de_CH-latin1
./scripts/Arch/OS/setup.fish ./scripts/Arch/OS/setup.fish

View file

@ -16,9 +16,8 @@ begin
and begin and begin
git -C "$projectDir" ls-files git -C "$projectDir" ls-files
git -C "$projectDir" ls-files --exclude-standard --others git -C "$projectDir" ls-files --exclude-standard --others
end | \ end | rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot"
rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot" end &>/dev/null
end &> /dev/null
and git -C "$contextRoot" diff and git -C "$contextRoot" diff
end end

View file

@ -2,5 +2,5 @@
# Updates the patch to be applicable to Arch's current `releng` template. # Updates the patch to be applicable to Arch's current `releng` template.
begin begin
set -l dir (status dirname) set -l dir (status dirname)
"$dir/show-diff.fish" > "$dir/valhalla.patch" "$dir/show-diff.fish" >"$dir/valhalla.patch"
end end

View file

@ -1,23 +1,22 @@
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
index bf6bc8f..bdbe55c 100644 index bf6bc8f..e71dc26 100644
--- a/airootfs/root/.zlogin --- a/airootfs/root/.zlogin
+++ b/airootfs/root/.zlogin +++ b/airootfs/root/.zlogin
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then @@ -4,3 +4,17 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
fi fi
~/.automated_script.sh ~/.automated_script.sh
+ +
+if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1 +if bash -c "ls /sys/class/backlight/*/max_brightness" >/dev/null 2>&1; then
+then + cat /sys/class/backlight/*/max_brightness >/sys/class/backlight/*/brightness
+ cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
+fi +fi
+ +
+cd "/root/PortValhalla" || exit +cd "/root/PortValhalla" || exit
+ +
+git diff -p -R --no-ext-diff --no-color --diff-filter=M \ +git diff -p -R --no-ext-diff --no-color --diff-filter=M |
+ | grep -E "^(diff|(old|new) mode)" --color=never \ + grep -E "^(diff|(old|new) mode)" --color=never |
+ | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \ + sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" |
+ | git apply + git apply
+ +
+loadkeys de_CH-latin1 +loadkeys de_CH-latin1
+./scripts/Arch/OS/setup.fish +./scripts/Arch/OS/setup.fish

View file

@ -5,8 +5,10 @@ let
overlay = [ ]; overlay = [ ];
}; };
property = (builtins.getEnv "PROPERTY"); property = (builtins.getEnv "PROPERTY");
processor = if (builtins.stringLength property > 0) then processor =
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _) if (builtins.stringLength property > 0) then
else (_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
(_: _); else
in _: processor (lib.evalModules { modules = [ _ ]; }).config (_: _);
in
_: processor (lib.evalModules { modules = [ _ ]; }).config

View file

@ -3,7 +3,8 @@ let
inherit (lib) mkOption types; inherit (lib) mkOption types;
optionalAttrs = lib.attrsets.optionalAttrs; optionalAttrs = lib.attrsets.optionalAttrs;
hw = config.valhalla.hardware; hw = config.valhalla.hardware;
in { in
{
options = { options = {
valhalla = { valhalla = {
hardware = { hardware = {

View file

@ -4,7 +4,8 @@ in {
options = { options = {
valhalla = mkOption { valhalla = mkOption {
type = types.submodule ( type = types.submodule (
{ extendModules, ... }: let { extendModules, ... }:
let
osVariant = extendModules { osVariant = extendModules {
modules = [ modules = [
({ config, ... }: { ({ config, ... }: {
@ -35,7 +36,8 @@ in {
}; };
windowsVariant = osVariant.extendModules { }; windowsVariant = osVariant.extendModules { };
in { in
{
options = { options = {
linux = mkOption { linux = mkOption {
inherit (linuxVariant) type; inherit (linuxVariant) type;
@ -51,7 +53,8 @@ in {
visible = "shallow"; visible = "shallow";
}; };
}; };
}); }
);
description = "Configuration for PortValhalla."; description = "Configuration for PortValhalla.";
default = { }; default = { };

View file

@ -34,15 +34,17 @@ let
}; };
devicePath = mkOption { devicePath = mkOption {
type = if osDisk then type =
types.nullOr types.str if osDisk then
else types.nullOr types.str
types.str; else
types.str;
description = "The path to the device."; description = "The path to the device.";
default = if osDisk && config.deviceName == null then default =
null if osDisk && config.deviceName == null then
else null
"/dev/${config.deviceName}"; else
"/dev/${config.deviceName}";
}; };
deviceScript = mkOption { deviceScript = mkOption {
@ -69,135 +71,146 @@ let
}; };
}; };
config = let config =
diskVarName = "${diskListVarName}[${config.id}]"; let
diskVar = "\${${diskVarName}}"; diskVarName = "${diskListVarName}[${config.id}]";
diskVar = "\${${diskVarName}}";
diskSelector = '' diskSelector = ''
result="$(mktemp)" result="$(mktemp)"
fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish} fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish}
${diskVarName}="$(cat "$result")" ${diskVarName}="$(cat "$result")"
''; '';
partitions = lib.lists.sortOn (_: _.index) partitions = lib.lists.sortOn (_: _.index)
(builtins.filter (_: _ != null) (builtins.filter (_: _ != null)
(builtins.attrValues config.partitions)); (builtins.attrValues config.partitions));
mkType = type: mkType = type:
lib.strings.escapeShellArg ( lib.strings.escapeShellArg (
if builtins.isInt type then if builtins.isInt type then
"${lib.trivial.toHexString type}" "${lib.trivial.toHexString type}"
else else
type); type
);
fdiskCommand = arguments: "sudo sfdisk ${arguments}"; fdiskCommand = arguments: "sudo sfdisk ${arguments}";
fdiskScript = script: args: append: fdiskScript = script: args: append:
"echo ${script} | ${ "echo ${script} | ${
fdiskCommand "${builtins.concatStringsSep " " args} ${ fdiskCommand "${builtins.concatStringsSep " " args} ${
if append then "--append" else "" if append then "--append" else ""
} ${diskVar}" } ${diskVar}"
}"; }";
wipeScript = script: fdiskScript script [] false; 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 ${diskVar} ${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)));
fdiskCommands = lib.strings.concatLines fdiskCommands = lib.strings.concatLines
(lib.optionals config.wipe [ (lib.optionals config.wipe [
cleanup cleanup
(wipeScript "label: gpt") (wipeScript "label: gpt")
] ++ (builtins.concatMap ( ] ++ (builtins.concatMap
partition: (
let partition:
inherit (partition) format index keepExisting label sizeScript type; let
inherit (partition) format index keepExisting label sizeScript type;
partVarName = "myPartition"; partVarName = "myPartition";
partVar = "\${${partVarName}}"; partVar = "\${${partVarName}}";
sizeOption = '' sizeOption = ''
${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/" ${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/"
''; '';
formatScripts = { formatScripts = {
${fs.ext4} = "mkfs.ext4 -F ${partVar}"; ${fs.ext4} = "mkfs.ext4 -F ${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}";
}; };
labelScripts = { labelScripts = {
${fs.ext4} = label: "e2label ${partVar} ${label}"; ${fs.ext4} = label: "e2label ${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
"sudo ${formatScripts.${format}}" "sudo ${formatScripts.${format}}"
]; ];
fallback = '' fallback = ''
if ! { ls "${partVar}" 2>&1; } > /dev/null if ! { ls "${partVar}" 2>&1; } > /dev/null
then then
${create} ${create}
fi fi
''; '';
in [ in
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"'' [
''local ${partVarName}="$diskPath-part${toString index}"'' ''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
(if keepExisting then fallback else create) ''local ${partVarName}="$diskPath-part${toString index}"''
"sudo ${labelScripts.${format} label}" (if keepExisting then fallback else create)
]) partitions)); "sudo ${labelScripts.${format} label}"
]
)
partitions));
fixType = lib.strings.concatLines (builtins.concatMap ( fixType = lib.strings.concatLines (builtins.concatMap
partition: (
lib.optional partition:
(partition.keepExisting && !(builtins.isNull partition.type)) lib.optional
''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'') (partition.keepExisting && !(builtins.isNull partition.type))
partitions); ''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}''
in { )
id = if osDisk then "os" else "disk-${name}"; partitions);
deviceVariable = diskVar; in
{
id = if osDisk then "os" else "disk-${name}";
deviceVariable = diskVar;
deviceScript = if osDisk && config.devicePath == null then '' deviceScript =
${diskSelector} if osDisk && config.devicePath == null then ''
'' else '' ${diskSelector}
${diskVarName}=${config.devicePath} '' else ''
${if osDisk then '' ${diskVarName}=${config.devicePath}
if [ ! -b ${diskVar} ]; then ${if osDisk then ''
function fallback() { if [ ! -b ${diskVar} ]; then
echo "Couldn't find the specified disk \"${diskVar}\"." function fallback() {
if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then echo "Couldn't find the specified disk \"${diskVar}\"."
${diskSelector} if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then
else ${diskSelector}
exit 1 else
exit 1
fi
}
fallback
fi fi
} '' else
""}
'';
fallback script = lib.mkDefault ''
fi function partition() {
'' else ${if (!config.wipe) then cleanup else ""}
""} ${probeScript}
''; ${fdiskCommands}
${fixType}
}
script = lib.mkDefault '' partition
function partition() { '';
${if (!config.wipe) then cleanup else ""} };
${probeScript} }
${fdiskCommands} );
${fixType}
}
partition
'';
};
});
partitionType = types.submodule ( partitionType = types.submodule (
{ name, config, ... }: { { name, config, ... }: {
@ -228,10 +241,11 @@ let
format = mkOption { format = mkOption {
type = types.enum (builtins.attrValues fs); type = types.enum (builtins.attrValues fs);
description = "The file system format of the partition."; description = "The file system format of the partition.";
default = if (isSwap config) then default =
fs.swap if (isSwap config) then
else fs.swap
throw ("Partition format not specified."); else
throw ("Partition format not specified.");
}; };
size = mkOption { size = mkOption {
@ -271,8 +285,10 @@ let
else else
"echo ${lib.strings.escapeShellArg (toString config.size)}"); "echo ${lib.strings.escapeShellArg (toString config.size)}");
}; };
}); }
in { );
in
{
options = { options = {
valhalla = { valhalla = {
partition = { partition = {
@ -304,41 +320,50 @@ in {
config = { config = {
valhalla = { valhalla = {
partition = { partition = {
script = lib.mkDefault (let script = lib.mkDefault (
cfg = config.valhalla.partition; let
inherit (cfg) os rootDir; cfg = config.valhalla.partition;
inherit (lib.strings) normalizePath; inherit (cfg) os rootDir;
partPath = part: "/dev/disk/by-label/${part.label}"; inherit (lib.strings) normalizePath;
disks = ([ os ] ++ (builtins.attrValues cfg.disks)); partPath = part: "/dev/disk/by-label/${part.label}";
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); disks = ([ os ] ++ (builtins.attrValues cfg.disks));
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
mountScript = lib.strings.concatLines (builtins.concatMap ( mountScript = lib.strings.concatLines (builtins.concatMap
_: [ (
probeScript _: [
(builtins.concatStringsSep " " ([ probeScript
"sudo" (builtins.concatStringsSep " " ([
"mount" "sudo"
"--mkdir" "mount"
] ++ (lib.optionals (_.format == "ntfs") [ "--mkdir"
"-t" "ntfs3" ] ++ (lib.optionals (_.format == "ntfs") [
]) ++ [ "-t"
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions)) "ntfs3"
(partPath _) ]) ++ [
(normalizePath "/${rootDir}/${_.mountPoint}") (builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
])) (partPath _)
]) (lib.lists.sortOn (normalizePath "/${rootDir}/${_.mountPoint}")
(_: normalizePath "/${_.mountPoint}") ]))
]
)
(lib.lists.sortOn
(_: normalizePath "/${_.mountPoint}")
(builtins.filter (_: _.mountPoint != null) partitions))); (builtins.filter (_: _.mountPoint != null) partitions)));
swapScript = lib.strings.concatLines (builtins.map ( swapScript = lib.strings.concatLines (builtins.map
_: '' (
${probeScript} _: ''
sudo swapon ${partPath _} ${probeScript}
'') (builtins.filter (_: _.useSwap) partitions)); sudo swapon ${partPath _}
in lib.strings.concatLines ([ ''
"#!/bin/bash" )
"set -o errexit" (builtins.filter (_: _.useSwap) partitions));
] in
lib.strings.concatLines ([
"#!/bin/bash"
"set -o errexit"
]
++ (builtins.map (_: _.deviceScript) disks) ++ (builtins.map (_: _.deviceScript) disks)
++ lib.optionals ((builtins.length disks) > 0) [ ++ lib.optionals ((builtins.length disks) > 0) [
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"'' ''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
@ -353,7 +378,8 @@ in {
] ++ (builtins.map (_: _.script) disks) ++ [ ] ++ (builtins.map (_: _.script) disks) ++ [
mountScript mountScript
swapScript swapScript
])); ])
);
}; };
}; };
}; };

View file

@ -11,77 +11,85 @@ let
}; };
config = { config = {
programs = builtins.mapAttrs ( programs = builtins.mapAttrs
name: config: { (
enable = mkDefault config.enable; name: config: {
}) osConfig.programs; enable = mkDefault config.enable;
}; }
})); )
osConfig.programs;
};
}
));
}; };
mkPrograms = infos: builtins.foldl' (programs: info: mkPrograms = infos: builtins.foldl'
programs // { (programs: info:
${builtins.elemAt info 0} = { programs // {
enable = mkEnableOption (builtins.elemAt info 1); ${builtins.elemAt info 0} = {
}; enable = mkEnableOption (builtins.elemAt info 1);
}) { } infos; };
})
{ }
infos;
programs = mkPrograms [ programs = mkPrograms [
["aliae" "aliae"] [ "aliae" "aliae" ]
["brave" "Brave Browser"] [ "brave" "Brave Browser" ]
["discord" "Discord"] [ "discord" "Discord" ]
["firefox" "Firefox Web Browser"] [ "firefox" "Firefox Web Browser" ]
["openssh" "OpenSSH"] [ "openssh" "OpenSSH" ]
["osu!lazer" "osu!lazer"] [ "osu!lazer" "osu!lazer" ]
["pennywise" "Pennywise"] [ "pennywise" "Pennywise" ]
["powershell" "PowerShell Core"] [ "powershell" "PowerShell Core" ]
["retroarch" "RetroArch"] [ "retroarch" "RetroArch" ]
["steam" "Steam"] [ "steam" "Steam" ]
["thunderbird" "Thunderbird"] [ "thunderbird" "Thunderbird" ]
["vscode" "Visual Studio Code"] [ "vscode" "Visual Studio Code" ]
["zoxide" "zoxide"] [ "zoxide" "zoxide" ]
]; ];
linuxPrograms = mkPrograms [ linuxPrograms = mkPrograms [
["bash" "Bash"] [ "bash" "Bash" ]
["fish" "fish"] [ "fish" "fish" ]
["icedtea" "IcedTea"] [ "icedtea" "IcedTea" ]
["grub" "GRUB"] [ "grub" "GRUB" ]
["logo-ls" "logo-ls"] [ "logo-ls" "logo-ls" ]
["lutris" "Lutris"] [ "lutris" "Lutris" ]
["minegrub-theme" "Minegrub Theme"] [ "minegrub-theme" "Minegrub Theme" ]
["nginx" "nginx"] [ "nginx" "nginx" ]
["nodejs-n" "n"] [ "nodejs-n" "n" ]
["nuke-usb" "nuke-usb"] [ "nuke-usb" "nuke-usb" ]
["nvidia-dkms" "Nvidia Drivers"] [ "nvidia-dkms" "Nvidia Drivers" ]
["plasma" "Plasma"] [ "plasma" "Plasma" ]
["pyenv" "pyenv"] [ "pyenv" "pyenv" ]
["sddm" "SDDM"] [ "sddm" "SDDM" ]
["vim" "Vim"] [ "vim" "Vim" ]
["virt-manager" "Virtual Machine Manager"] [ "virt-manager" "Virtual Machine Manager" ]
["waydroid" "Waydroid"] [ "waydroid" "Waydroid" ]
["xone" "xone"] [ "xone" "xone" ]
]; ];
windowsPrograms = mkPrograms [ windowsPrograms = mkPrograms [
["lghub" "Logitech G Hub"] [ "lghub" "Logitech G Hub" ]
["maniaplanet" "ManiaPlanet"] [ "maniaplanet" "ManiaPlanet" ]
["msedge-redirect" "MSEdgeRedirect"] [ "msedge-redirect" "MSEdgeRedirect" ]
["nvs" "Node Version Switcher"] [ "nvs" "Node Version Switcher" ]
["osu!" "Osu!"] [ "osu!" "Osu!" ]
["posh-git" "posh-git"] [ "posh-git" "posh-git" ]
["putty" "PuTTY"] [ "putty" "PuTTY" ]
["rewasd" "reWASD"] [ "rewasd" "reWASD" ]
["terminal-icons" "Terminal Icons"] [ "terminal-icons" "Terminal Icons" ]
["tm-nations-forever" "TrackMania Nations Forever"] [ "tm-nations-forever" "TrackMania Nations Forever" ]
["tm-united-forever" "TrackMania United Forever"] [ "tm-united-forever" "TrackMania United Forever" ]
["tobii-gamehub" "Tobii Game Hub"] [ "tobii-gamehub" "Tobii Game Hub" ]
["tobii-ghost" "Tobii Ghost"] [ "tobii-ghost" "Tobii Ghost" ]
["ubiquiti-unifi-controller" "Ubiquiti UniFi Controller"] [ "ubiquiti-unifi-controller" "Ubiquiti UniFi Controller" ]
["visualstudio" "Visual Studio"] [ "visualstudio" "Visual Studio" ]
["winscp" "WinSCP"] [ "winscp" "WinSCP" ]
]; ];
in { in
{
imports = [ imports = [
./programs/docker.nix ./programs/docker.nix
./programs/git.nix ./programs/git.nix

View file

@ -5,7 +5,8 @@ let
commonOptions = { commonOptions = {
enable = mkEnableOption "docker"; enable = mkEnableOption "docker";
}; };
in { in
{
options = { options = {
valhalla = { valhalla = {
programs.docker = commonOptions; programs.docker = commonOptions;
@ -16,7 +17,8 @@ in {
options = { options = {
programs.docker = commonOptions; programs.docker = commonOptions;
}; };
})); }
));
}; };
linux = { linux = {

View file

@ -31,7 +31,8 @@ let
default = { }; default = { };
}; };
}; };
in { in
{
options = { options = {
valhalla = { valhalla = {
programs.git = gitOption; programs.git = gitOption;
@ -42,7 +43,8 @@ in {
options = { options = {
programs.git = gitOption; programs.git = gitOption;
}; };
})); }
));
}; };
}; };
}; };

View file

@ -31,7 +31,8 @@ let
default = [ ]; default = [ ];
}; };
}; };
in { in
{
options = { options = {
valhalla = { valhalla = {
programs.nextcloud = commonOptions; programs.nextcloud = commonOptions;
@ -42,7 +43,8 @@ in {
options = { options = {
programs.nextcloud = commonOptions; programs.nextcloud = commonOptions;
}; };
})); }
));
}; };
windows.users = mkOption { windows.users = mkOption {
@ -51,7 +53,8 @@ in {
options = { options = {
programs.nextcloud = userOptions; programs.nextcloud = userOptions;
}; };
})); }
));
}; };
}; };
}; };

View file

@ -16,7 +16,8 @@ let
default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source)); default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source));
}; };
}; };
}); }
);
commonOptions = { commonOptions = {
enable = mkEnableOption "Oh My Posh"; enable = mkEnableOption "Oh My Posh";
@ -35,7 +36,8 @@ let
default = [ ]; default = [ ];
}; };
}; };
in { in
{
options = { options = {
valhalla = { valhalla = {
programs.oh-my-posh = commonOptions; programs.oh-my-posh = commonOptions;
@ -46,7 +48,8 @@ in {
options = { options = {
programs.oh-my-posh = userOptions; programs.oh-my-posh = userOptions;
}; };
})); }
));
}; };
}; };
}; };

View file

@ -16,7 +16,8 @@ let
default = null; default = null;
}; };
}; };
}); }
);
commonOptions = { commonOptions = {
enable = mkEnableOption "rclone"; enable = mkEnableOption "rclone";
@ -29,7 +30,8 @@ let
default = { }; default = { };
}; };
}; };
in { in
{
options = { options = {
valhalla.linux = { valhalla.linux = {
programs.rclone = commonOptions; programs.rclone = commonOptions;
@ -40,7 +42,8 @@ in {
options = { options = {
programs.rclone = userOptions; programs.rclone = userOptions;
}; };
})); }
));
}; };
}; };
}; };

View file

@ -1,150 +1,156 @@
{ lib, ... }: { lib, ... }:
let inherit (lib) mkOption types; let inherit (lib) mkOption types;
in { in {
imports = [ imports = [
./programs.nix ./programs.nix
]; ];
options = { options = {
valhalla = mkOption { valhalla = mkOption {
type = types.submodule ( type = types.submodule (
{ config, ... }: { config, ... }:
let let
optionalAttrs = lib.attrsets.optionalAttrs; optionalAttrs = lib.attrsets.optionalAttrs;
cfg = config; cfg = config;
inherit (cfg.software) coding desktopExperience essential gaming server socialMedia; inherit (cfg.software) coding desktopExperience essential gaming server socialMedia;
mkPrograms = programs: builtins.foldl' ( mkPrograms = programs: builtins.foldl'
programs: name: programs // { (
${name}.enable = true; programs: name: programs // {
}) {} programs; ${name}.enable = true;
in { }
options = { )
software = { { }
essential = mkOption { programs;
type = types.bool; in
description = "A value indicating whether essentials should be installed."; {
default = false; options = {
}; software = {
essential = mkOption {
server = mkOption { type = types.bool;
type = types.bool; description = "A value indicating whether essentials should be installed.";
description = "A value indicating whether server applications should be installed."; default = false;
default = false;
};
desktopExperience = mkOption {
type = types.bool;
description = "A value indicating whether GUI apps should be installed.";
default = false;
};
school = mkOption {
type = types.bool;
description = "A value indicating whether software for studies should be installed.";
default = false;
};
productivity = mkOption {
type = types.bool;
description = "A value indicating whether productivity apps should be installed.";
default = false;
};
socialMedia = mkOption {
type = types.bool;
description = "A value indicating whether social media apps should be installed.";
default = false;
};
media = mkOption {
type = types.bool;
description = "A value indicating whether media apps should be installed.";
default = false;
};
gaming = mkOption {
type = types.bool;
description = "A value indicating whether gaming apps should be installed.";
default = false;
};
coding = mkOption {
type = types.bool;
description = "A value indicating whether development apps should be installed.";
default = false;
};
};
}; };
config = { server = mkOption {
programs = (optionalAttrs essential (mkPrograms [ type = types.bool;
"aliae" description = "A value indicating whether server applications should be installed.";
"git" default = false;
"oh-my-posh"
"openssh"
"powershell"
"zoxide"
])) // (optionalAttrs desktopExperience (mkPrograms [
"brave"
"firefox"
"pennywise"
"thunderbird"
])) // (optionalAttrs socialMedia (mkPrograms [
"discord"
])) // (optionalAttrs coding (mkPrograms [
"docker"
"vscode"
])) // (optionalAttrs gaming (mkPrograms [
"osu!lazer"
"retroarch"
"steam"
]));
linux.programs = (optionalAttrs essential (mkPrograms [
"bash"
"logo-ls"
"minegrub-theme"
"nuke-usb"
"vim"
])) // (optionalAttrs desktopExperience (mkPrograms [
"icedtea"
"plasma"
"sddm"
"waydroid"
"virt-manager"
])) // (optionalAttrs coding (mkPrograms [
"nodejs-n"
"pyenv"
])) // (optionalAttrs gaming (mkPrograms [
"lutris"
])) // (optionalAttrs server (mkPrograms [
"nginx"
]));
# Essentials
windows.programs = (optionalAttrs essential (mkPrograms [
"posh-git"
"terminal-icons"
# Desktop Experience
])) // (optionalAttrs desktopExperience (mkPrograms [
"msedge-redirect"
"putty"
"winscp"
# Development
])) // (optionalAttrs coding (mkPrograms [
"nvs"
"visualstudio"
# Gaming
])) // (optionalAttrs gaming (mkPrograms [
"maniaplanet"
"osu!"
"rewasd"
"tm-nations-forever"
"tm-united-forever"
]));
}; };
});
}; desktopExperience = mkOption {
type = types.bool;
description = "A value indicating whether GUI apps should be installed.";
default = false;
};
school = mkOption {
type = types.bool;
description = "A value indicating whether software for studies should be installed.";
default = false;
};
productivity = mkOption {
type = types.bool;
description = "A value indicating whether productivity apps should be installed.";
default = false;
};
socialMedia = mkOption {
type = types.bool;
description = "A value indicating whether social media apps should be installed.";
default = false;
};
media = mkOption {
type = types.bool;
description = "A value indicating whether media apps should be installed.";
default = false;
};
gaming = mkOption {
type = types.bool;
description = "A value indicating whether gaming apps should be installed.";
default = false;
};
coding = mkOption {
type = types.bool;
description = "A value indicating whether development apps should be installed.";
default = false;
};
};
};
config = {
programs = (optionalAttrs essential (mkPrograms [
"aliae"
"git"
"oh-my-posh"
"openssh"
"powershell"
"zoxide"
])) // (optionalAttrs desktopExperience (mkPrograms [
"brave"
"firefox"
"pennywise"
"thunderbird"
])) // (optionalAttrs socialMedia (mkPrograms [
"discord"
])) // (optionalAttrs coding (mkPrograms [
"docker"
"vscode"
])) // (optionalAttrs gaming (mkPrograms [
"osu!lazer"
"retroarch"
"steam"
]));
linux.programs = (optionalAttrs essential (mkPrograms [
"bash"
"logo-ls"
"minegrub-theme"
"nuke-usb"
"vim"
])) // (optionalAttrs desktopExperience (mkPrograms [
"icedtea"
"plasma"
"sddm"
"waydroid"
"virt-manager"
])) // (optionalAttrs coding (mkPrograms [
"nodejs-n"
"pyenv"
])) // (optionalAttrs gaming (mkPrograms [
"lutris"
])) // (optionalAttrs server (mkPrograms [
"nginx"
]));
# Essentials
windows.programs = (optionalAttrs essential (mkPrograms [
"posh-git"
"terminal-icons"
# Desktop Experience
])) // (optionalAttrs desktopExperience (mkPrograms [
"msedge-redirect"
"putty"
"winscp"
# Development
])) // (optionalAttrs coding (mkPrograms [
"nvs"
"visualstudio"
# Gaming
])) // (optionalAttrs gaming (mkPrograms [
"maniaplanet"
"osu!"
"rewasd"
"tm-nations-forever"
"tm-united-forever"
]));
};
}
);
}; };
} };
}

View file

@ -25,7 +25,8 @@ let
default = [ ]; default = [ ];
}; };
}; };
}); }
);
linuxUserType = types.submodule ( linuxUserType = types.submodule (
{ ... }: { { ... }: {
@ -36,7 +37,8 @@ let
default = null; default = null;
}; };
}; };
}); }
);
winUserType = types.submodule ( winUserType = types.submodule (
{ ... }: { { ... }: {
@ -47,8 +49,10 @@ let
default = false; default = false;
}; };
}; };
}); }
in { );
in
{
options = { options = {
valhalla = { valhalla = {
users = mkOption { users = mkOption {

View file

@ -2,7 +2,8 @@
let let
inherit (lib) mkDefault mkEnableOption mkIf mkOption types; inherit (lib) mkDefault mkEnableOption mkIf mkOption types;
capitalize = (import ../text.nix { inherit lib; }).capitalize; capitalize = (import ../text.nix { inherit lib; }).capitalize;
in { in
{
options = { options = {
valhalla = { valhalla = {
windows = { windows = {

View file

@ -2,6 +2,6 @@
capitalize = text: capitalize = text:
let chars = lib.strings.stringToCharacters text; let chars = lib.strings.stringToCharacters text;
in lib.strings.concatStrings in lib.strings.concatStrings
([ (lib.strings.toUpper (builtins.elemAt chars 0)) ] ([ (lib.strings.toUpper (builtins.elemAt chars 0)) ]
++ (lib.lists.drop 1 chars)); ++ (lib.lists.drop 1 chars));
} }

View file

@ -37,12 +37,13 @@ in {
keyboardLayout = "ch"; keyboardLayout = "ch";
i18n = { i18n = {
localeSettings = let defaultLocale = "en_US.UTF-8"; localeSettings =
in { let defaultLocale = "en_US.UTF-8";
LANG = "de_CH.UTF-8"; in {
LANGUAGE = defaultLocale; LANG = "de_CH.UTF-8";
LC_MESSAGE = defaultLocale; LANGUAGE = defaultLocale;
}; LC_MESSAGE = defaultLocale;
};
}; };
software = { software = {
@ -58,45 +59,46 @@ in {
linux.programs.grub.enable = true; linux.programs.grub.enable = true;
programs = { programs = {
git = let defaultBranch = "main"; git =
in { let defaultBranch = "main";
inherit defaultBranch; in {
inherit defaultBranch;
flow = { flow = {
mainBranch = defaultBranch; mainBranch = defaultBranch;
devBranch = "dev"; devBranch = "dev";
}; };
aliases = { aliases = {
ahfange = "init"; ahfange = "init";
tuedezue = "add"; tuedezue = "add";
beschuldig = "blame"; beschuldig = "blame";
zieh = "pull"; zieh = "pull";
druck = "push"; druck = "push";
machnah = "clone"; machnah = "clone";
hol = "fetch"; hol = "fetch";
zwiigab = "branch"; zwiigab = "branch";
buechiih = "commit"; buechiih = "commit";
eich = "rebase"; eich = "rebase";
erd = "rebase"; erd = "rebase";
gahufwiifelde = "rebase"; gahufwiifelde = "rebase";
vergliich = "diff"; vergliich = "diff";
tuezemme = "merge"; tuezemme = "merge";
versorg = "stash"; versorg = "stash";
markier = "tag"; markier = "tag";
pflueckoepfel = "cherry-pick"; pflueckoepfel = "cherry-pick";
pflueckhimbeeri = "cherry-pick"; pflueckhimbeeri = "cherry-pick";
buechuus = "checkout"; buechuus = "checkout";
quaetsch = "merge --squash"; quaetsch = "merge --squash";
pfudle = "push --force"; pfudle = "push --force";
beschuldigung = "blame"; beschuldigung = "blame";
zwiigli = "branch"; zwiigli = "branch";
tagebuech = "log"; tagebuech = "log";
versteck = "stash"; versteck = "stash";
zuestand = "status"; zuestand = "status";
markierig = "tag"; markierig = "tag";
};
}; };
};
}; };
}; };
}; };

View file

@ -38,12 +38,13 @@ in {
keyboardLayout = "ch"; keyboardLayout = "ch";
i18n = { i18n = {
localeSettings = let defaultLocale = "en_US.UTF-8"; localeSettings =
in { let defaultLocale = "en_US.UTF-8";
LANG = "de_CH.UTF-8"; in {
LANGUAGE = defaultLocale; LANG = "de_CH.UTF-8";
LC_MESSAGE = defaultLocale; LANGUAGE = defaultLocale;
}; LC_MESSAGE = defaultLocale;
};
}; };
software = { software = {

View file

@ -29,20 +29,22 @@
windows.users.manuel = { windows.users.manuel = {
programs = { programs = {
nextcloud = { nextcloud = {
folderSyncs = let folderSyncs =
localPath = "C:/tools/RetroArch-Win64"; let
remotePath = "/Saved Games/RetroArch"; localPath = "C:/tools/RetroArch-Win64";
in [ remotePath = "/Saved Games/RetroArch";
{ in
remotePath = "${remotePath}/Saves"; [
localPath = "${localPath}/saves"; {
virtualFiles = false; remotePath = "${remotePath}/Saves";
} localPath = "${localPath}/saves";
{ virtualFiles = false;
remotePath = "${remotePath}/System"; }
localPath = "${localPath}/system"; {
} remotePath = "${remotePath}/System";
]; localPath = "${localPath}/system";
}
];
}; };
}; };
}; };

View file

@ -20,11 +20,11 @@ begin
sudo sed -i \ sudo sed -i \
-e "/esp=/{" \ -e "/esp=/{" \
-e "a esp=$(echo "$efiDir" | string escape)" \ -e "a esp=$(echo "$efiDir" | string escape)" \
-e "d" \ -e d \
-e "}" \ -e "}" \
-e "/bootloader_id=/{" \ -e "/bootloader_id=/{" \
-e "a bootloader_id=$(echo "$label" | string escape)" \ -e "a bootloader_id=$(echo "$label" | string escape)" \
-e "d" \ -e d \
-e "}" \ -e "}" \
/etc/secureboot.conf /etc/secureboot.conf

View file

@ -61,7 +61,7 @@ begin
and arch-chroot "$mountDir" hwclock --systohc and arch-chroot "$mountDir" hwclock --systohc
and begin and begin
getOSConfig i18n.localeSettings --json | \ getOSConfig i18n.localeSettings --json |
jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")' jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")'
end | begin end | begin
read LOCALES read LOCALES
@ -70,7 +70,7 @@ begin
end end
and begin and begin
getOSConfig i18n.localeSettings --json | \ getOSConfig i18n.localeSettings --json |
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")' jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
end | arch-chroot "$mountDir" tee /etc/locale.conf >/dev/null end | arch-chroot "$mountDir" tee /etc/locale.conf >/dev/null

View file

@ -147,7 +147,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
and yayinst propertree-git # mac .plist config file editor and yayinst propertree-git # mac .plist config file editor
end end
and if isProgramEnabled "thunderbird" && $isInstall and if isProgramEnabled thunderbird && $isInstall
yayinst thunderbird yayinst thunderbird
end end
@ -200,7 +200,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
audius-client-bin audius-client-bin
end end
and if isProgramEnabled "nextcloud" and if isProgramEnabled nextcloud
yayinst nextcloud-client yayinst nextcloud-client
end end
end end
@ -284,7 +284,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
yayinst osu-lazer-bin yayinst osu-lazer-bin
end end
and if isProgramEnabled "retroarch" and if isProgramEnabled retroarch
yayinst libretro yayinst libretro
end end
end end

View file

@ -54,7 +54,7 @@ function backupAction -V dir
if [ -n "$deployScript" ] if [ -n "$deployScript" ]
for name in (getUsers | jq '.[]' --raw-output0 | string split0) for name in (getUsers | jq '.[]' --raw-output0 | string split0)
echo "Backing up user `$name`..." echo "Backing up user `$name`..."
and source $deployScript userBackup $name and source $deployScript userBackup --user $name
end end
end end
end end

View file

@ -34,7 +34,7 @@ function installAction -V dir
for name in (getUsers | jq '.[]' --raw-output0 | string split0) for name in (getUsers | jq '.[]' --raw-output0 | string split0)
echo "Configuring user `$name`..." echo "Configuring user `$name`..."
and source $deployScript userConfig $name and source $deployScript userConfig --user $name
end end
end end
end end

View file

@ -18,7 +18,7 @@ begin
argparse -i "name=" "user=" -- $argv argparse -i "name=" "user=" -- $argv
set -l services (getProgramConfig --name "$_flag_name" --json | jq '.services') set -l services (getProgramConfig --name "$_flag_name" --json | jq '.services')
for service in (echo "$services" | jq '. | keys[]' --raw-output0 | string split0) for service in (echo "$services" | jq '. // {} | keys[]' --raw-output0 | string split0)
if echo "$services" | SERVICE=$service jq --exit-status ".[env.SERVICE].enable" >/dev/null if echo "$services" | SERVICE=$service jq --exit-status ".[env.SERVICE].enable" >/dev/null
fish "$dir/services/$service/main.fish" $argv fish "$dir/services/$service/main.fish" $argv

View file

@ -12,7 +12,7 @@ begin
initializeServiceInstallation $argv initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
USER=$user yq "$userKey = env(USER)" "$source" | \ USER=$user yq "$userKey = env(USER)" "$source" |
sudo tee (getServiceOverrides $argv) >/dev/null sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv installDockerService $argv

View file

@ -52,8 +52,8 @@ begin
end end
CI_NAME=$ciName \ CI_NAME=$ciName \
SECRET_ENV="$name.secret.env" \ SECRET_ENV="$name.secret.env" \
RUNNER_ENV="$name.runner.env" begin RUNNER_ENV="$name.runner.env" begin
begin begin
printf "%s\n" \ printf "%s\n" \
DRONE_RPC_PROTO=http \ DRONE_RPC_PROTO=http \
@ -62,28 +62,28 @@ begin
echo "DRONE_RPC_SECRET=$secret" | sudo tee "$root/$SECRET_ENV" >/dev/null echo "DRONE_RPC_SECRET=$secret" | sudo tee "$root/$SECRET_ENV" >/dev/null
yq "$ciKey = $ciTemplate" "$tmpConfig" | \ yq "$ciKey = $ciTemplate" "$tmpConfig" |
ENTRY="./data/$name:/data" yq "$ciKey.volumes = [ env(ENTRY) ]" | \ ENTRY="./data/$name:/data" yq "$ciKey.volumes = [ env(ENTRY) ]" |
yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | \ yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" |
PROTO=https yq "$ciEnv.DRONE_SERVER_PROTO = env(PROTO)" | \ PROTO=https yq "$ciEnv.DRONE_SERVER_PROTO = env(PROTO)" |
HOST=(getServiceDomain "$subdomain" "$domain") yq "$ciEnv.DRONE_SERVER_HOST = env(HOST)" | \ HOST=(getServiceDomain "$subdomain" "$domain") yq "$ciEnv.DRONE_SERVER_HOST = env(HOST)" |
yq "$dockerKey = $dockerTemplate" | \ yq "$dockerKey = $dockerTemplate" |
yq "$sshKey = $sshTemplate" | \ yq "$sshKey = $sshTemplate" |
yq "$dockerKey.depends_on = [ env(CI_NAME) ]" | \ yq "$dockerKey.depends_on = [ env(CI_NAME) ]" |
sudo tee "$config" >/dev/null sudo tee "$config" >/dev/null
for key in $dockerKey $sshKey for key in $dockerKey $sshKey
set -l file (mktemp) set -l file (mktemp)
yq "$key.depends_on = [ env(CI_NAME) ]" "$config" | \ yq "$key.depends_on = [ env(CI_NAME) ]" "$config" |
yq "$key.env_file |= . + [ env(RUNNER_ENV), env(SECRET_ENV) ]" | \ yq "$key.env_file |= . + [ env(RUNNER_ENV), env(SECRET_ENV) ]" |
tee "$file" >/dev/null tee "$file" >/dev/null
sudo cp "$file" "$config" sudo cp "$file" "$config"
rm "$file" rm "$file"
end end
PORT="127.0.0.1:1337:80" yq "$ciKey.ports = [ env(PORT) ]" "$tmpOverrides" | \ PORT="127.0.0.1:1337:80" yq "$ciKey.ports = [ env(PORT) ]" "$tmpOverrides" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
end end
end end
@ -101,7 +101,7 @@ begin
for i in (seq 1 3 (count $environments)) for i in (seq 1 3 (count $environments))
set -l domain $environments[(math $i + 2)] set -l domain $environments[(math $i + 2)]
set -l subdomain $environments[(math $i + 1)] set -l subdomain $environments[(math $i + 1)]
printf "%s\0" "$subdomain" "$domain" printf "%s\0" "$subdomain" "$domain"
end end
end end

View file

@ -1,8 +1,8 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l user "forgejo" set -l user forgejo
set -l domain "git" set -l domain git
set -l server "$domain" "" set -l server "$domain" ""
set -l service $user set -l service $user
source "$dir/../service.fish" source "$dir/../service.fish"
@ -23,21 +23,21 @@ begin
set port (yq (getSSHPortKey) "$source" | mutatePort "$port") set port (yq (getSSHPortKey) "$source" | mutatePort "$port")
DOMAIN=(getServiceDomain $server) PW=$pw DB=Git USER=forgejo PW=$pw begin DOMAIN=(getServiceDomain $server) PW=$pw DB=Git USER=forgejo PW=$pw begin
set -l gitEnv "$(getServiceKey "$service").environment" set -l gitEnv "$(getServiceKey "$service").environment"
set -l actEnv "$(getServiceKey "runner").environment" set -l actEnv "$(getServiceKey "runner").environment"
set -l dbEnv "$(getServiceKey "db").environment" set -l dbEnv "$(getServiceKey "db").environment"
PORT=$port yq "$(getSSHPortKey) = env(PORT)" "$source" | \ PORT=$port yq "$(getSSHPortKey) = env(PORT)" "$source" |
yq "$gitEnv.FORGEJO__server__DOMAIN = env(DOMAIN)" | \ yq "$gitEnv.FORGEJO__server__DOMAIN = env(DOMAIN)" |
yq "$gitEnv.FORGEJO__database__NAME = env(DB)" | \ yq "$gitEnv.FORGEJO__database__NAME = env(DB)" |
yq "$gitEnv.FORGEJO__database__USER = env(USER)" | \ yq "$gitEnv.FORGEJO__database__USER = env(USER)" |
yq "$gitEnv.FORGEJO__database__PASSWD = env(PW)" | \ yq "$gitEnv.FORGEJO__database__PASSWD = env(PW)" |
yq "$dbEnv.MARIADB_DATABASE = env(DB)" | \ yq "$dbEnv.MARIADB_DATABASE = env(DB)" |
yq "$dbEnv.MARIADB_USER = env(USER)" | \ yq "$dbEnv.MARIADB_USER = env(USER)" |
yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | \ yq "$dbEnv.MARIADB_PASSWORD = env(PW)" |
URL="https://$DOMAIN/" yq "$actEnv.GITEA_INSTANCE_URL = env(URL)" | \ URL="https://$DOMAIN/" yq "$actEnv.GITEA_INSTANCE_URL = env(URL)" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
end end
installDockerService $argv installDockerService $argv
end end
@ -49,7 +49,7 @@ begin
set -l file (mktemp) set -l file (mktemp)
set -l root (getServiceRoot $argv) set -l root (getServiceRoot $argv)
set -l dir "$root/data" set -l dir "$root/data"
set -l bin "/usr/local/bin/forgejo" 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"
@ -66,8 +66,8 @@ begin
set uid (id -u $user) set uid (id -u $user)
set gid (id -g $user) set gid (id -g $user)
and yq "$envKey.USER_UID = $uid" "$file" | \ and yq "$envKey.USER_UID = $uid" "$file" |
yq "$envKey.USER_GID = $gid" | \ yq "$envKey.USER_GID = $gid" |
sudo tee "$config" >/dev/null sudo tee "$config" >/dev/null
mkdir -p "$dir" mkdir -p "$dir"

View file

@ -1,8 +1,8 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l user "jellyfin" set -l user jellyfin
set -l domain "media" set -l domain media
set -l server "$domain" "" set -l server "$domain" ""
set -l servarr radarr sonarr lidarr prowlarr set -l servarr radarr sonarr lidarr prowlarr
set -l flood flood set -l flood flood
@ -31,7 +31,7 @@ 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 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"
@ -57,13 +57,13 @@ begin
set -l envKey "$(getServiceKey "$name").environment" set -l envKey "$(getServiceKey "$name").environment"
sudo cp "$config" "$file" sudo cp "$config" "$file"
and yq "$envKey.PUID = $uid" "$file" | \ and yq "$envKey.PUID = $uid" "$file" |
yq "$envKey.PGID = $gid" | \ yq "$envKey.PGID = $gid" |
sudo tee "$config" >/dev/null sudo tee "$config" >/dev/null
end end
cp "$overrides" "$file" cp "$overrides" "$file"
URL="https://$(getServiceDomain "$domain" "")/" yq "$(getServiceKey "$service").environment.JELLYFIN_PublishedServerUrl = env(URL)" "$file" | \ URL="https://$(getServiceDomain "$domain" "")/" yq "$(getServiceKey "$service").environment.JELLYFIN_PublishedServerUrl = env(URL)" "$file" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
for dir in "$root"/{downloads,config/{,jellyfin,flood,rtorrent,radarr,sonarr,lidarr,prowlarr},media/{,movies,series,music}} for dir in "$root"/{downloads,config/{,jellyfin,flood,rtorrent,radarr,sonarr,lidarr,prowlarr},media/{,movies,series,music}}
@ -107,13 +107,13 @@ begin
getServiceDefaultProxy $domain $s "$location" --comment "Proxy main Jellyfin traffic" $argv getServiceDefaultProxy $domain $s "$location" --comment "Proxy main Jellyfin traffic" $argv
getServiceDefaultProxy $domain $s "= /web/" --path "/web/index.html" --comment "Proxy main Jellyfin traffic" $argv getServiceDefaultProxy $domain $s "= /web/" --path "/web/index.html" --comment "Proxy main Jellyfin traffic" $argv
getServiceDefaultProxy $domain $s "/socket" --comment "Proxy Jellyfin Websockets traffic" $argv getServiceDefaultProxy $domain $s /socket --comment "Proxy Jellyfin Websockets traffic" $argv
else if [ "$s" = "$flood" ] else if [ "$s" = "$flood" ]
getServiceDefaultProxy $argv getServiceDefaultProxy $argv
printf "%s\n" \ printf "%s\n" \
"location = /flood {" \ "location = /flood {" \
'return 302 $scheme://$host$uri/$is_args$args;' \ 'return 302 $scheme://$host$uri/$is_args$args;' \
"}" "}"
else else
getServiceDefaultProxy $argv --path "$location" getServiceDefaultProxy $argv --path "$location"
@ -126,7 +126,7 @@ begin
printf "%s\n" \ printf "%s\n" \
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \ "# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
"proxy_buffering off;" "proxy_buffering off;"
else if [ "$location" = "/socket" ] else if [ "$location" = /socket ]
printf "%s\n" \ printf "%s\n" \
'# Websocket' \ '# Websocket' \
"proxy_http_version 1.1;" \ "proxy_http_version 1.1;" \

View file

@ -7,6 +7,7 @@ import subprocess
import sys import sys
from protonvpn_cli.cli import FeatureEnum, protonvpn from protonvpn_cli.cli import FeatureEnum, protonvpn
def run_proton(args): def run_proton(args):
exit( exit(
subprocess.run( subprocess.run(
@ -17,6 +18,7 @@ def run_proton(args):
PIPENV_VENV_IN_PROJECT=f"{1}", PIPENV_VENV_IN_PROJECT=f"{1}",
PVPN_CMD_ARGS=" ".join(args))).returncode) PVPN_CMD_ARGS=" ".join(args))).returncode)
protonvpn.ensure_connectivity() protonvpn.ensure_connectivity()
args = sys.argv[1:] args = sys.argv[1:]
@ -56,9 +58,11 @@ else:
try: try:
session.ensure_valid() session.ensure_valid()
except: except:
raise Exception("Your current session is invalid. Please initialize the session using the `init` subcommand.") raise Exception(
"Your current session is invalid. Please initialize the session using the `init` subcommand.")
environ["PVPN_USERNAME"] = session.vpn_username + (environ.get("PVPN_TAGS") or "") environ["PVPN_USERNAME"] = session.vpn_username + \
(environ.get("PVPN_TAGS") or "")
environ["PVPN_PASSWORD"] = session.vpn_password environ["PVPN_PASSWORD"] = session.vpn_password
environ["PVPN_TIER"] = f"{session.vpn_tier}" environ["PVPN_TIER"] = f"{session.vpn_tier}"
@ -95,6 +99,7 @@ else:
run_proton(["connect", server.name]) run_proton(["connect", server.name])
else: else:
raise Exception(f"Unable to find a server matching the specified criteria {args[1:]}!") raise Exception(
f"Unable to find a server matching the specified criteria {args[1:]}!")
else: else:
run_proton(args) run_proton(args)

View file

@ -1,7 +1,7 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l user "minecraft" set -l user minecraft
source "$dir/../service.fish" source "$dir/../service.fish"
function installSW -V dir -V domain -V server -V service function installSW -V dir -V domain -V server -V service
@ -34,8 +34,8 @@ begin
set -l envKey "$(getServiceKey "$service").environment" set -l envKey "$(getServiceKey "$service").environment"
cp "$config" "$file" cp "$config" "$file"
and yq "$envKey.UID = $uid" "$file" | \ and yq "$envKey.UID = $uid" "$file" |
yq "$envKey.GID = $gid" | \ yq "$envKey.GID = $gid" |
sudo tee "$config" >/dev/null sudo tee "$config" >/dev/null
end end

View file

@ -5,7 +5,7 @@ begin
set -l domain cloud "" set -l domain cloud ""
set -l service web set -l service web
set -l office collabora set -l office collabora
set -l officeDomain "office" "" set -l officeDomain office ""
set -l server $service $domain set -l server $service $domain
set -l services \ set -l services \
@ -68,10 +68,10 @@ begin
set -l key "$turnKey.command" set -l key "$turnKey.command"
PW="--static-auth-secret=$turnPW" \ PW="--static-auth-secret=$turnPW" \
DOMAIN="--realm=$domain" \ DOMAIN="--realm=$domain" \
yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" | \ yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" |
DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" | \ DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" |
URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" | \ URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
end end

View file

@ -1,8 +1,8 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l domain "tracker" "" set -l domain tracker ""
set -l service "ryot" set -l service ryot
set -l source "$dir/docker-compose.overrides.yml" set -l source "$dir/docker-compose.overrides.yml"
source "$dir/../service.fish" source "$dir/../service.fish"
@ -17,8 +17,8 @@ begin
initializeServiceInstallation $argv initializeServiceInstallation $argv
sudo cp "$file" "$root" sudo cp "$file" "$root"
URL=$dbUrl yq "$dbKey = env(URL)" "$source" | \ URL=$dbUrl yq "$dbKey = env(URL)" "$source" |
PW=$pw yq ".services.db.environment.POSTGRES_PASSWORD = env(PW)" | \ PW=$pw yq ".services.db.environment.POSTGRES_PASSWORD = env(PW)" |
sudo tee (getServiceOverrides $argv) >/dev/null sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv installDockerService $argv

View file

@ -5,26 +5,26 @@ begin
source "$dir/../service.fish" source "$dir/../service.fish"
function installSW -V dir -V domain -V source function installSW -V dir -V domain -V source
set -l service "teamspeak" set -l service teamspeak
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32") set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l db "TeamSpeak" set -l db TeamSpeak
set -l tsEnv "$(getServiceKey "$service").environment" set -l tsEnv "$(getServiceKey "$service").environment"
set -l dbEnv "$(getServiceKey db).environment" set -l dbEnv "$(getServiceKey db).environment"
initializeServiceInstallation $argv initializeServiceInstallation $argv
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
USER="$service" begin USER="$service" begin
yq "$tsEnv.TS3SERVER_DB_USER = env(USER)" "$source" | \ yq "$tsEnv.TS3SERVER_DB_USER = env(USER)" "$source" |
yq "$dbEnv.MARIADB_USER = env(USER)" yq "$dbEnv.MARIADB_USER = env(USER)"
end | \ end | \
PW="$pw" begin PW="$pw" begin
yq "$tsEnv.TS3SERVER_DB_PASSWORD = env(PW)" | \ yq "$tsEnv.TS3SERVER_DB_PASSWORD = env(PW)" |
yq "$dbEnv.MARIADB_PASSWORD = env(PW)" yq "$dbEnv.MARIADB_PASSWORD = env(PW)"
end | \
DB="$db" begin
yq "$tsEnv.TS3SERVER_DB_NAME = env(DB)" | \
yq "$dbEnv.MARIADB_DATABASE = env(DB)"
end | \ end | \
DB="$db" begin
yq "$tsEnv.TS3SERVER_DB_NAME = env(DB)" |
yq "$dbEnv.MARIADB_DATABASE = env(DB)"
end |
sudo tee (getServiceOverrides $argv) >/dev/null sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv installDockerService $argv

View file

@ -12,8 +12,8 @@ begin
cp -rf "$dir"/{.dockerignore,docker-compose{.base,.overrides,.core{,.overrides}}.yml,parser.patch,tmforever-entrypoint.sh,trackmania.Dockerfile,xaseco-entrypoint.sh,xaseco.Dockerfile} "$root" cp -rf "$dir"/{.dockerignore,docker-compose{.base,.overrides,.core{,.overrides}}.yml,parser.patch,tmforever-entrypoint.sh,trackmania.Dockerfile,xaseco-entrypoint.sh,xaseco.Dockerfile} "$root"
PW="$tmPW" yq "$(getServiceKey "tm").environment.TM_SUPERADMIN_PASSWORD = env(PW)" "$source" | \ PW="$tmPW" yq "$(getServiceKey "tm").environment.TM_SUPERADMIN_PASSWORD = env(PW)" "$source" |
PW="$sqlPW" yq "$(getServiceKey "db").environment.MYSQL_PASSWORD = env(PW)" | \ PW="$sqlPW" yq "$(getServiceKey "db").environment.MYSQL_PASSWORD = env(PW)" |
sudo tee "$root/$(basename "$source")" >/dev/null sudo tee "$root/$(basename "$source")" >/dev/null
installDockerService $argv installDockerService $argv
@ -33,5 +33,5 @@ begin
echo "^docker-compose\.core\.overrides\.yml\$" echo "^docker-compose\.core\.overrides\.yml\$"
end end
runInstaller --force $argv --name "tm-forever" runInstaller --force $argv --name tm-forever
end end

View file

@ -29,30 +29,30 @@ serverOptions=(
TM_TITLE name TM_TITLE name
TM_COMMENT comment TM_COMMENT comment
TM_HIDDEN hide_server TM_HIDDEN hide_server
\
TM_MAX_PLAYERS max_players TM_MAX_PLAYERS max_players
TM_PLAYER_PASSWORD password TM_PLAYER_PASSWORD password
\
TM_MAX_SPECTATORS max_spectators TM_MAX_SPECTATORS max_spectators
TM_SPECTATOR_PASSWORD password_spectator TM_SPECTATOR_PASSWORD password_spectator
\
TM_LADDER_MODE ladder_mode TM_LADDER_MODE ladder_mode
TM_LADDER_LIMIT_MIN ladder_serverlimit_min TM_LADDER_LIMIT_MIN ladder_serverlimit_min
TM_LADDER_LIMIT_MAX ladder_serverlimit_max TM_LADDER_LIMIT_MAX ladder_serverlimit_max
\
TM_ENABLE_P2P_UPLOAD enable_p2p_upload TM_ENABLE_P2P_UPLOAD enable_p2p_upload
TM_ENABLE_P2P_DOWNLOAD enable_p2p_download TM_ENABLE_P2P_DOWNLOAD enable_p2p_download
\
TM_CALLVOTE_TIMEOUT callvote_timeout TM_CALLVOTE_TIMEOUT callvote_timeout
TM_CALLVOTE_RATIO callvote_ratio TM_CALLVOTE_RATIO callvote_ratio
\
TM_ALLOW_CHALLENGE_DOWNLOAD allow_challenge_download TM_ALLOW_CHALLENGE_DOWNLOAD allow_challenge_download
TM_AUTOSAVE_REPLAYS autosave_replays TM_AUTOSAVE_REPLAYS autosave_replays
TM_AUTOSAVE_VALIDATION_REPLAYS autosave_validation_replays TM_AUTOSAVE_VALIDATION_REPLAYS autosave_validation_replays
\
TM_REFEREE_PASSWORD referee_password TM_REFEREE_PASSWORD referee_password
TM_REFEREE_VALIDATION_MODE referee_validation_mode TM_REFEREE_VALIDATION_MODE referee_validation_mode
\
TM_USE_CHANGING_VALIDATION_SEED use_changing_validation_seed TM_USE_CHANGING_VALIDATION_SEED use_changing_validation_seed
) )
@ -62,23 +62,23 @@ systemOptions=(
TM_P2P_PORT server_p2p_port TM_P2P_PORT server_p2p_port
TM_CLIENT_PORT client_port TM_CLIENT_PORT client_port
TM_USE_NAT_UPNP use_nat_upnp TM_USE_NAT_UPNP use_nat_upnp
\
TM_XMLRPC_PORT xmlrpc_port TM_XMLRPC_PORT xmlrpc_port
TM_XMLRPC_ALLOWED_REMOTE xmlrpc_allowremote TM_XMLRPC_ALLOWED_REMOTE xmlrpc_allowremote
\
TM_PACKMASK packmask TM_PACKMASK packmask
\
TM_CONNECTION_UPLOADRATE connection_uploadrate TM_CONNECTION_UPLOADRATE connection_uploadrate
TM_CONNECTION_DOWNLOADRATE connection_downloadrate TM_CONNECTION_DOWNLOADRATE connection_downloadrate
\
TM_P2P_CACHE_SIZE p2p_cache_size TM_P2P_CACHE_SIZE p2p_cache_size
\
TM_BLACKLIST_URL blacklist_url TM_BLACKLIST_URL blacklist_url
TM_GUESTLIST_FILENAME guestlist_filename TM_GUESTLIST_FILENAME guestlist_filename
TM_BLACKLIST_FILENAME blacklist_filename TM_BLACKLIST_FILENAME blacklist_filename
\
TM_ALLOW_SPECTATOR_RELAYS allow_spectator_relays TM_ALLOW_SPECTATOR_RELAYS allow_spectator_relays
\
TM_USE_PROXY use_proxy TM_USE_PROXY use_proxy
TM_PROXY_LOGIN proxy_login TM_PROXY_LOGIN proxy_login
TM_PROXY_PASSWORD proxy_password TM_PROXY_PASSWORD proxy_password

View file

@ -1,7 +1,7 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l domain "passwords" set -l domain passwords
set -l source "$dir/docker-compose.overrides.yml" set -l source "$dir/docker-compose.overrides.yml"
source "$dir/../service.fish" source "$dir/../service.fish"
@ -14,10 +14,10 @@ begin
initializeServiceInstallation $argv initializeServiceInstallation $argv
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" | \ URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" |
ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | \ ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" |
URL=$dbUrl yq "$dbKey = env(URL)" | \ URL=$dbUrl yq "$dbKey = env(URL)" |
PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" | \ PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" |
sudo tee (getServiceOverrides $argv) >/dev/null sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv installDockerService $argv

View file

@ -12,7 +12,7 @@ begin
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL="https://$domain" yq "$(getServiceKey "$service").environment.ROOT_URL = env(URL)" "$dir/$(basename "$overrides")" | \ URL="https://$domain" yq "$(getServiceKey "$service").environment.ROOT_URL = env(URL)" "$dir/$(basename "$overrides")" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
installDockerService $argv installDockerService $argv

View file

@ -57,29 +57,29 @@ begin
end end
CI_NAME=$ciName \ CI_NAME=$ciName \
SECRET_ENV="$name.secret.env" begin SECRET_ENV="$name.secret.env" begin
begin begin
echo "WOODPECKER_AGENT_SECRET=$secret" echo "WOODPECKER_AGENT_SECRET=$secret"
end | sudo tee "$root/$SECRET_ENV" >/dev/null end | sudo tee "$root/$SECRET_ENV" >/dev/null
yq "$ciKey = $ciTemplate" "$tmpConfig" | \ yq "$ciKey = $ciTemplate" "$tmpConfig" |
DB="$dbName" yq "$ciKey.depends_on |= . + [ env(DB) ]" | \ DB="$dbName" yq "$ciKey.depends_on |= . + [ env(DB) ]" |
ENTRY="./data/$name/ci:/var/lib/woodpecker" yq "$ciKey.volumes = [ env(ENTRY) ]" | \ ENTRY="./data/$name/ci:/var/lib/woodpecker" yq "$ciKey.volumes = [ env(ENTRY) ]" |
yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | \ yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" |
yq "$agentKey = $agentTemplate" | \ yq "$agentKey = $agentTemplate" |
yq "$agentKey.depends_on |= . + [ env(CI_NAME) ]" | \ yq "$agentKey.depends_on |= . + [ env(CI_NAME) ]" |
yq "$agentKey.env_file |= . + [ env(SECRET_ENV) ]" | \ yq "$agentKey.env_file |= . + [ env(SECRET_ENV) ]" |
SERVER="$ciName:9000" yq "$agentEnv.WOODPECKER_SERVER = env(SERVER)" | \ SERVER="$ciName:9000" yq "$agentEnv.WOODPECKER_SERVER = env(SERVER)" |
yq "$dbKey = $dbTemplate" | \ yq "$dbKey = $dbTemplate" |
ENTRY="./data/$name/db:/var/lib/mysql" yq "$dbKey.volumes |= . + [ env(ENTRY) ]" | \ ENTRY="./data/$name/db:/var/lib/mysql" yq "$dbKey.volumes |= . + [ env(ENTRY) ]" |
sudo tee "$config" >/dev/null sudo tee "$config" >/dev/null
HOST="https://$domain" yq "$ciEnv.WOODPECKER_HOST = env(HOST)" "$tmpOverrides" | \ HOST="https://$domain" yq "$ciEnv.WOODPECKER_HOST = env(HOST)" "$tmpOverrides" |
PORT="127.0.0.1:1337:8000" yq "$ciKey.ports = [ env(PORT) ]" | \ PORT="127.0.0.1:1337:8000" yq "$ciKey.ports = [ env(PORT) ]" |
DB="$dbUser:$pw@tcp($dbName:3306)/$db?parseTime=true" yq "$ciEnv.WOODPECKER_DATABASE_DATASOURCE = env(DB)" | \ DB="$dbUser:$pw@tcp($dbName:3306)/$db?parseTime=true" yq "$ciEnv.WOODPECKER_DATABASE_DATASOURCE = env(DB)" |
USER="$dbUser" yq "$dbEnv.MARIADB_USER = env(USER)" | \ USER="$dbUser" yq "$dbEnv.MARIADB_USER = env(USER)" |
PW="$pw" yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | \ PW="$pw" yq "$dbEnv.MARIADB_PASSWORD = env(PW)" |
DB="$db" yq "$dbEnv.MARIADB_DATABASE = env(DB)" | \ DB="$db" yq "$dbEnv.MARIADB_DATABASE = env(DB)" |
sudo tee "$overrides" >/dev/null sudo tee "$overrides" >/dev/null
end end
end end
@ -97,7 +97,7 @@ begin
for i in (seq 1 3 (count $environments)) for i in (seq 1 3 (count $environments))
set -l domain $environments[(math $i + 2)] set -l domain $environments[(math $i + 2)]
set -l subdomain $environments[(math $i + 1)] set -l subdomain $environments[(math $i + 1)]
printf "%s\0" "$subdomain" "$domain" printf "%s\0" "$subdomain" "$domain"
end end
end end

View file

@ -5,6 +5,6 @@ begin
function getUserBackupArgs function getUserBackupArgs
argparse -i "user=" -- $argv argparse -i "user=" -- $argv
printf "%s\n" --base-directory ~"$_flag_user" --exact-depth 1 --hidden "^(\\.ssh|[^.])" --exclude "Games" --exclude "Desktop" ~ --exec fd . {} printf "%s\n" --base-directory ~"$_flag_user" --exact-depth 1 --hidden "^(\\.ssh|[^.])" --exclude Games --exclude Desktop ~ --exec fd . {}
end end
end end

View file

@ -11,6 +11,7 @@ sleep_secs="1"
# * 'ehci-pci' - USB 2.0 # * 'ehci-pci' - USB 2.0
# * 'xhci_hcd' - USB 3.0 # * 'xhci_hcd' - USB 3.0
echo "Looking for USB standards ..." echo "Looking for USB standards ..."
for usb_std in "$base/"?hci[-_]?c*; do for usb_std in "$base/"?hci[-_]?c*; do
echo "* USB standard '$usb_std' ..." echo "* USB standard '$usb_std' ..."
@ -25,4 +26,5 @@ for usb_std in "$base/"?hci[-_]?c*; do
echo " done." echo " done."
done done
echo "done." echo "done."

View file

@ -36,4 +36,4 @@ Start-SoftwareInstaller @args `
}).ToString()) -join "`n") ` }).ToString()) -join "`n") `
-Append; -Append;
} }
}; };

View file

@ -9,7 +9,7 @@ Start-SoftwareInstaller -Force @args `
$null = Push-Location $dir; $null = Push-Location $dir;
Invoke-WebRequest "https://global-download.acer.com/GDFiles/Driver/Monitor/Monitor_Acer_1.0_W7x86W7x64W8x86W8x64_A.zip?acerid=636092441703392074" -OutFile $file; Invoke-WebRequest "https://global-download.acer.com/GDFiles/Driver/Monitor/Monitor_Acer_1.0_W7x86W7x64W8x86W8x64_A.zip?acerid=636092441703392074" -OutFile $file;
Expand-Archive $file; Expand-Archive $file;
$null = Start-Process -Wait -FilePath "pnputil" -ArgumentList "/add-driver","*.inf","/install","/subdirs"; $null = Start-Process -Wait -FilePath "pnputil" -ArgumentList "/add-driver", "*.inf", "/install", "/subdirs";
$null = Pop-Location; $null = Pop-Location;
Remove-Item -Recurse $dir; Remove-Item -Recurse $dir;

View file

@ -1,25 +1,24 @@
InstallGameHub() InstallGameHub() {
{ SetDefaultMouseSpeed(100)
SetDefaultMouseSpeed(100) SetTitleMatchMode("RegEx")
SetTitleMatchMode("RegEx") windowTitle := "^Tobii Game Hub$"
windowTitle := "^Tobii Game Hub$"
Run("setup.exe") Run("setup.exe")
WinWait(windowTitle, unset, 60) WinWait(windowTitle, unset, 60)
WinActivate(windowTitle) WinActivate(windowTitle)
Sleep(2 * 1000) Sleep(2 * 1000)
MouseClick("Left", 485, 365) MouseClick("Left", 485, 365)
MouseClick("Left", 600, 455) MouseClick("Left", 600, 455)
MouseClick("Left", 533, 623) MouseClick("Left", 533, 623)
MouseClick("Left", 936, 662) MouseClick("Left", 936, 662)
Sleep(4 * 1000) Sleep(4 * 1000)
WinActivate(windowTitle) WinActivate(windowTitle)
MouseClick("Left", 1150, 60) MouseClick("Left", 1150, 60)
MouseClick("Left", 518, 203) MouseClick("Left", 518, 203)
Sleep(10 * 1000) Sleep(10 * 1000)
WinActivate(windowTitle) WinActivate(windowTitle)
pid := WinGetPID() pid := WinGetPID()
Run("pwsh -c Stop-Process -Force " . pid) Run("pwsh -c Stop-Process -Force " . pid)
} }
SetWorkingDir(A_InitialWorkingDir) SetWorkingDir(A_InitialWorkingDir)

View file

@ -1,22 +1,21 @@
InstallGhost() InstallGhost() {
{ SetDefaultMouseSpeed(100)
SetDefaultMouseSpeed(100) SetTitleMatchMode("RegEx")
SetTitleMatchMode("RegEx") windowTitle := "^Tobii Ghost$"
windowTitle := "^Tobii Ghost$"
Run("setup.exe") Run("setup.exe")
WinWait(windowTitle, unset, 60) WinWait(windowTitle, unset, 60)
WinActivate(windowTitle) WinActivate(windowTitle)
MouseClick("Left", 44, 694) MouseClick("Left", 44, 694)
MouseClick("Left", 330, 752) MouseClick("Left", 330, 752)
WinWaitNotActive() WinWaitNotActive()
WinWait(windowTitle, unset, 20) WinWait(windowTitle, unset, 20)
MouseClick("Left", 563, 397) MouseClick("Left", 563, 397)
MouseClick("Left", 650, 497) MouseClick("Left", 650, 497)
Sleep(10 * 1000) Sleep(10 * 1000)
WinActivate(windowTitle) WinActivate(windowTitle)
pid := WinGetPID() pid := WinGetPID()
Run("pwsh -c Stop-Process -Force " . pid) Run("pwsh -c Stop-Process -Force " . pid)
} }
SetWorkingDir(A_InitialWorkingDir) SetWorkingDir(A_InitialWorkingDir)

View file

@ -208,7 +208,7 @@ function Deploy-SoftwareAction {
Install-ChocoPackage teamspeak; Install-ChocoPackage teamspeak;
Remove-DesktopIcon "*TeamSpeak*"; Remove-DesktopIcon "*TeamSpeak*";
} }
elseif ($userInstall) { elseif ($userInstall) {
Install-WingetPackage ` Install-WingetPackage `
Element.Element ` Element.Element `
OpenWhisperSystems.Signal ` OpenWhisperSystems.Signal `

View file

@ -186,7 +186,8 @@ $null = New-Module {
$programs = & { $programs = & {
if ($User) { if ($User) {
return Get-UserConfig -UserName $User @args; return Get-UserConfig -UserName $User @args;
} else { }
else {
return Get-OSConfig @args; return Get-OSConfig @args;
} }
} "programs"; } "programs";
@ -207,7 +208,8 @@ $null = New-Module {
try { try {
(Get-ProgramConfig @PSBoundParameters).enable; (Get-ProgramConfig @PSBoundParameters).enable;
} catch { }
catch {
$false; $false;
} }
} }

View file

@ -90,7 +90,7 @@ $null = New-Module {
installer = $installHandler; installer = $installHandler;
arguments = $Arguments; arguments = $Arguments;
context = $Context; context = $Context;
base = { & $runBase @args }; base = { & $runBase @args };
}; };
switch ($Action) { switch ($Action) {

View file

@ -27,7 +27,7 @@ function disposeAction -V dir
source "$dir/nix.fish" source "$dir/nix.fish"
runHook actionPostRun || true runHook actionPostRun || true
and uninstallNixPkgs and uninstallNixPkgs
and sudo git config remove-section --system safe || true and sudo git config --remove-section --system safe || true
end end
function runAction -V dir function runAction -V dir
@ -41,7 +41,6 @@ function runSetupUserAction -V dir
source "$dir/settings.fish" source "$dir/settings.fish"
runActionSetup runActionSetup
runActionConfigure runActionConfigure
set -l env "CONFIG_NAME=$CONFIG_NAME"
set -l name (getOSConfig setupUser.name) set -l name (getOSConfig setupUser.name)
if [ "$USER" != "$name" ] if [ "$USER" != "$name" ]
@ -51,7 +50,7 @@ function runSetupUserAction -V dir
sudo --set-home --preserve-env env "PATH=$PATH" $cmdline sudo --set-home --preserve-env env "PATH=$PATH" $cmdline
else else
if [ -z "$TMUX" ] if [ -z "$TMUX" ]
tmux new-session -e "$env" $cmdline tmux new-session env (env) $cmdline
else else
set -l sudoConfig "/etc/sudoers.d/PortValhalla" set -l sudoConfig "/etc/sudoers.d/PortValhalla"
@ -59,12 +58,12 @@ function runSetupUserAction -V dir
echo "Creating setup user" echo "Creating setup user"
and useradd \ and useradd \
--comment "PortValhalla Setup User" \ --comment "PortValhalla Setup User" \
--system \ --system \
--groups nix-users \ --groups nix-users \
--create-home \ --create-home \
--uid (getOSConfig setupUser.id --json) \ --uid (getOSConfig setupUser.id --json) \
"$name" "$name"
and begin and begin
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL" echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"

View file

@ -1,7 +1,7 @@
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l config "$dir/config.fish" set -l config "$dir/config.fish"
set nixPkgsDir "/nix/var/nix/profiles/per-user/root/channels/nixpkgs" set nixPkgsDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs
function __isNixModule -a path function __isNixModule -a path
nix-instantiate --eval --expr "{ path }: import path" --argstr path "$path" &>/dev/null nix-instantiate --eval --expr "{ path }: import path" --argstr path "$path" &>/dev/null

View file

@ -109,12 +109,12 @@ begin
end end
function runInstallerAction -V dir -V actions function runInstallerAction -V dir -V actions
argparse -i "force" "name=" "action=" -- $argv argparse -i force "name=" "action=" -- $argv
set -l install set -l install
set -l name $_flag_name set -l name $_flag_name
set -l action $_flag_action set -l action $_flag_action
set -l args $_flag_force --name "$name" set -l args $_flag_force --name "$name"
set -l dependencyFunction "installSWDependencies" set -l dependencyFunction installSWDependencies
set -l installDependencies set -l installDependencies
source "$dir/settings.fish" source "$dir/settings.fish"
@ -149,8 +149,8 @@ begin
if [ "$action" = "$actions[$i]" ] if [ "$action" = "$actions[$i]" ]
set -l message set -l message
set -l function $actions[(math $i + 1)] set -l function $actions[(math $i + 1)]
set -l preRun "__preRun" set -l preRun __preRun
set -l postRun "__postRun" set -l postRun __postRun
functions -e $preRun functions -e $preRun
functions -e $postRun functions -e $postRun

View file

@ -2,7 +2,7 @@
set -l dir (status dirname) set -l dir (status dirname)
set -l container valhalla-test set -l container valhalla-test
set -l containerDir "/var/lib/lxc/$container" set -l containerDir "/var/lib/lxc/$container"
set -l valhallaRoot "opt/PortValhalla" set -l valhallaRoot opt/PortValhalla
sudo lxc-stop "$container" sudo lxc-stop "$container"
sudo lxc-destroy "$container" sudo lxc-destroy "$container"
sudo lxc-create "$container" -t download -- --dist archlinux --release current --arch amd64 sudo lxc-create "$container" -t download -- --dist archlinux --release current --arch amd64
@ -18,9 +18,9 @@ begin
"lxc.mount.entry = $(realpath "$dir/../..") $valhallaRoot none bind 0 0" \ "lxc.mount.entry = $(realpath "$dir/../..") $valhallaRoot none bind 0 0" \
"" \ "" \
"# VPN" \ "# VPN" \
"lxc.cgroup.devices.allow = c 10:200 rwm" "lxc.cgroup.devices.allow = c 10:200 rwm" \
"lxc.mount.entry = /dev/net dev/net none bind,create=dir 0 0" "lxc.mount.entry = /dev/net dev/net none bind,create=dir 0 0"
end | sudo tee -a "$containerDir/config" > /dev/null end | sudo tee -a "$containerDir/config" >/dev/null
sudo lxc-start "$container" sudo lxc-start "$container"