From d218d0495dd7af085131297fa75314e09343a336 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 29 Nov 2024 01:13:58 +0100 Subject: [PATCH] Format all files --- archiso/airootfs/root/.zlogin | 13 +- archiso/scripts/show-diff.fish | 5 +- archiso/scripts/update-patch.fish | 2 +- archiso/scripts/valhalla.patch | 17 +- lib/eval-attribute.nix | 12 +- lib/modules/hardware.nix | 3 +- lib/modules/os.nix | 9 +- lib/modules/partition/disks.nix | 336 ++++++++++-------- lib/modules/programs.nix | 128 +++---- lib/modules/programs/docker.nix | 6 +- lib/modules/programs/git.nix | 6 +- lib/modules/programs/nextcloud.nix | 9 +- lib/modules/programs/oh-my-posh.nix | 9 +- lib/modules/programs/rclone.nix | 9 +- lib/modules/software.nix | 292 +++++++-------- lib/modules/users.nix | 12 +- lib/modules/windows.nix | 3 +- lib/text.nix | 4 +- profiles/machines/manuel/Generic/config.nix | 86 ++--- profiles/machines/manuel/server.nix | 13 +- profiles/users/manuel/desktop.nix | 30 +- scripts/Arch/Config/SecureBoot/main.fish | 4 +- scripts/Arch/OS/setup.fish | 4 +- scripts/Arch/lib/deploy.fish | 12 +- scripts/Common/OS/backup.fish | 6 +- .../docker/services/anki-sync/main.fish | 2 +- .../Software/docker/services/drone/main.fish | 28 +- .../docker/services/forgejo/main.fish | 38 +- .../docker/services/jellyfin/main.fish | 20 +- .../docker/services/jellyfin/pvpn-cli.py | 11 +- .../docker/services/minecraft/main.fish | 6 +- .../docker/services/nextcloud/main.fish | 12 +- .../Software/docker/services/ryot/main.fish | 8 +- .../docker/services/teamspeak/main.fish | 22 +- .../docker/services/trackmania/main.fish | 6 +- .../trackmania/tmforever-entrypoint.sh | 30 +- .../docker/services/vaultwarden/main.fish | 10 +- .../Software/docker/services/wekan/main.fish | 2 +- .../docker/services/woodpecker/main.fish | 36 +- scripts/Common/Software/linux/main.fish | 2 +- scripts/Common/Software/nuke-usb/nuke-usb.sh | 2 + scripts/Common/Software/powershell/Main.ps1 | 2 +- .../Windows/Drivers/Predator Z301C/Main.ps1 | 2 +- .../Software/tobii-gamehub/GameHub.ahk | 41 ++- .../Windows/Software/tobii-ghost/Ghost.ahk | 35 +- scripts/Windows/Software/zoxide/Main.ps1 | 2 +- scripts/Windows/lib/Deployment.ps1 | 2 +- scripts/lib/Settings.ps1 | 6 +- scripts/lib/Software.ps1 | 2 +- scripts/lib/action.fish | 12 +- scripts/lib/nix.fish | 2 +- scripts/lib/restoration.fish | 6 +- scripts/lib/software.fish | 10 +- scripts/test/arch-install.fish | 4 +- winiso/README.md | 2 +- 55 files changed, 733 insertions(+), 660 deletions(-) diff --git a/archiso/airootfs/root/.zlogin b/archiso/airootfs/root/.zlogin index bdbe55ce..e71dc266 100644 --- a/archiso/airootfs/root/.zlogin +++ b/archiso/airootfs/root/.zlogin @@ -5,17 +5,16 @@ fi ~/.automated_script.sh -if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1 -then - cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness +if bash -c "ls /sys/class/backlight/*/max_brightness" >/dev/null 2>&1; then + cat /sys/class/backlight/*/max_brightness >/sys/class/backlight/*/brightness fi cd "/root/PortValhalla" || exit -git diff -p -R --no-ext-diff --no-color --diff-filter=M \ - | grep -E "^(diff|(old|new) mode)" --color=never \ - | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \ - | git apply +git diff -p -R --no-ext-diff --no-color --diff-filter=M | + grep -E "^(diff|(old|new) mode)" --color=never | + sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" | + git apply loadkeys de_CH-latin1 ./scripts/Arch/OS/setup.fish diff --git a/archiso/scripts/show-diff.fish b/archiso/scripts/show-diff.fish index 11a5920c..d6684ba8 100755 --- a/archiso/scripts/show-diff.fish +++ b/archiso/scripts/show-diff.fish @@ -16,9 +16,8 @@ begin and begin git -C "$projectDir" ls-files git -C "$projectDir" ls-files --exclude-standard --others - end | \ - rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot" - end &> /dev/null + end | rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot" + end &>/dev/null and git -C "$contextRoot" diff end diff --git a/archiso/scripts/update-patch.fish b/archiso/scripts/update-patch.fish index b28be88e..9d5a5799 100755 --- a/archiso/scripts/update-patch.fish +++ b/archiso/scripts/update-patch.fish @@ -2,5 +2,5 @@ # Updates the patch to be applicable to Arch's current `releng` template. begin set -l dir (status dirname) - "$dir/show-diff.fish" > "$dir/valhalla.patch" + "$dir/show-diff.fish" >"$dir/valhalla.patch" end diff --git a/archiso/scripts/valhalla.patch b/archiso/scripts/valhalla.patch index 00fac4e9..a2bfebcb 100644 --- a/archiso/scripts/valhalla.patch +++ b/archiso/scripts/valhalla.patch @@ -1,23 +1,22 @@ diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin -index bf6bc8f..bdbe55c 100644 +index bf6bc8f..e71dc26 100644 --- a/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 ~/.automated_script.sh + -+if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1 -+then -+ cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness ++if bash -c "ls /sys/class/backlight/*/max_brightness" >/dev/null 2>&1; then ++ cat /sys/class/backlight/*/max_brightness >/sys/class/backlight/*/brightness +fi + +cd "/root/PortValhalla" || exit + -+git diff -p -R --no-ext-diff --no-color --diff-filter=M \ -+ | grep -E "^(diff|(old|new) mode)" --color=never \ -+ | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \ -+ | git apply ++git diff -p -R --no-ext-diff --no-color --diff-filter=M | ++ grep -E "^(diff|(old|new) mode)" --color=never | ++ sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" | ++ git apply + +loadkeys de_CH-latin1 +./scripts/Arch/OS/setup.fish diff --git a/lib/eval-attribute.nix b/lib/eval-attribute.nix index 5555bc83..ae738fb3 100644 --- a/lib/eval-attribute.nix +++ b/lib/eval-attribute.nix @@ -5,8 +5,10 @@ let overlay = [ ]; }; property = (builtins.getEnv "PROPERTY"); - processor = if (builtins.stringLength property > 0) then - (_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _) - else - (_: _); -in _: processor (lib.evalModules { modules = [ _ ]; }).config + processor = + if (builtins.stringLength property > 0) then + (_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _) + else + (_: _); +in +_: processor (lib.evalModules { modules = [ _ ]; }).config diff --git a/lib/modules/hardware.nix b/lib/modules/hardware.nix index 5e73c761..ac693190 100644 --- a/lib/modules/hardware.nix +++ b/lib/modules/hardware.nix @@ -3,7 +3,8 @@ let inherit (lib) mkOption types; optionalAttrs = lib.attrsets.optionalAttrs; hw = config.valhalla.hardware; -in { +in +{ options = { valhalla = { hardware = { diff --git a/lib/modules/os.nix b/lib/modules/os.nix index e8fa71a6..20ef3de5 100644 --- a/lib/modules/os.nix +++ b/lib/modules/os.nix @@ -4,7 +4,8 @@ in { options = { valhalla = mkOption { type = types.submodule ( - { extendModules, ... }: let + { extendModules, ... }: + let osVariant = extendModules { modules = [ ({ config, ... }: { @@ -35,7 +36,8 @@ in { }; windowsVariant = osVariant.extendModules { }; - in { + in + { options = { linux = mkOption { inherit (linuxVariant) type; @@ -51,7 +53,8 @@ in { visible = "shallow"; }; }; - }); + } + ); description = "Configuration for PortValhalla."; default = { }; diff --git a/lib/modules/partition/disks.nix b/lib/modules/partition/disks.nix index dd125fdb..19d66830 100644 --- a/lib/modules/partition/disks.nix +++ b/lib/modules/partition/disks.nix @@ -34,15 +34,17 @@ let }; devicePath = mkOption { - type = if osDisk then - types.nullOr types.str - else - types.str; + type = + if osDisk then + types.nullOr types.str + else + types.str; description = "The path to the device."; - default = if osDisk && config.deviceName == null then - null - else - "/dev/${config.deviceName}"; + default = + if osDisk && config.deviceName == null then + null + else + "/dev/${config.deviceName}"; }; deviceScript = mkOption { @@ -69,135 +71,146 @@ let }; }; - config = let - diskVarName = "${diskListVarName}[${config.id}]"; - diskVar = "\${${diskVarName}}"; + config = + let + diskVarName = "${diskListVarName}[${config.id}]"; + diskVar = "\${${diskVarName}}"; - diskSelector = '' - result="$(mktemp)" - fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish} - ${diskVarName}="$(cat "$result")" - ''; + diskSelector = '' + result="$(mktemp)" + fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish} + ${diskVarName}="$(cat "$result")" + ''; - partitions = lib.lists.sortOn (_: _.index) - (builtins.filter (_: _ != null) - (builtins.attrValues config.partitions)); + partitions = lib.lists.sortOn (_: _.index) + (builtins.filter (_: _ != null) + (builtins.attrValues config.partitions)); - mkType = type: - lib.strings.escapeShellArg ( - if builtins.isInt type then - "${lib.trivial.toHexString type}" - else - type); + mkType = type: + lib.strings.escapeShellArg ( + if builtins.isInt type then + "${lib.trivial.toHexString type}" + else + type + ); - fdiskCommand = arguments: "sudo sfdisk ${arguments}"; - fdiskScript = script: args: append: - "echo ${script} | ${ + fdiskCommand = arguments: "sudo sfdisk ${arguments}"; + fdiskScript = script: args: append: + "echo ${script} | ${ fdiskCommand "${builtins.concatStringsSep " " args} ${ if append then "--append" else "" } ${diskVar}" }"; - wipeScript = script: fdiskScript script [] false; - appendScript = index: script: fdiskScript script ["-N" (builtins.toString index)] true; + wipeScript = script: fdiskScript script [ ] false; + appendScript = index: script: fdiskScript script [ "-N" (builtins.toString index) ] true; - cleanup = lib.strings.concatLines (builtins.map - (partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true") - (lib.lists.sortOn - (partition: partition.index * -1) - (builtins.filter (_: !_.keepExisting) partitions))); + cleanup = lib.strings.concatLines (builtins.map + (partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true") + (lib.lists.sortOn + (partition: partition.index * -1) + (builtins.filter (_: !_.keepExisting) partitions))); - fdiskCommands = lib.strings.concatLines - (lib.optionals config.wipe [ - cleanup - (wipeScript "label: gpt") - ] ++ (builtins.concatMap ( - partition: - let - inherit (partition) format index keepExisting label sizeScript type; + fdiskCommands = lib.strings.concatLines + (lib.optionals config.wipe [ + cleanup + (wipeScript "label: gpt") + ] ++ (builtins.concatMap + ( + partition: + let + inherit (partition) format index keepExisting label sizeScript type; - partVarName = "myPartition"; - partVar = "\${${partVarName}}"; + partVarName = "myPartition"; + partVar = "\${${partVarName}}"; - sizeOption = '' - ${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/" - ''; + sizeOption = '' + ${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/" + ''; - formatScripts = { - ${fs.ext4} = "mkfs.ext4 -F ${partVar}"; - ${fs.swap} = "mkswap ${partVar}"; - ${fs.ntfs} = "mkfs.ntfs -F ${partVar}"; - ${fs.fat32} = "mkfs.fat -F 32 ${partVar}"; - }; + formatScripts = { + ${fs.ext4} = "mkfs.ext4 -F ${partVar}"; + ${fs.swap} = "mkswap ${partVar}"; + ${fs.ntfs} = "mkfs.ntfs -F ${partVar}"; + ${fs.fat32} = "mkfs.fat -F 32 ${partVar}"; + }; - labelScripts = { - ${fs.ext4} = label: "e2label ${partVar} ${label}"; - ${fs.swap} = label: "swaplabel ${partVar} --label ${label}"; - ${fs.ntfs} = label: "ntfslabel ${partVar} ${label}"; - ${fs.fat32} = label: "fatlabel ${partVar} ${label}"; - }; + labelScripts = { + ${fs.ext4} = label: "e2label ${partVar} ${label}"; + ${fs.swap} = label: "swaplabel ${partVar} --label ${label}"; + ${fs.ntfs} = label: "ntfslabel ${partVar} ${label}"; + ${fs.fat32} = label: "fatlabel ${partVar} ${label}"; + }; - create = lib.strings.concatLines [ - (appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'') - probeScript - "sudo ${formatScripts.${format}}" - ]; + create = lib.strings.concatLines [ + (appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'') + probeScript + "sudo ${formatScripts.${format}}" + ]; - fallback = '' - if ! { ls "${partVar}" 2>&1; } > /dev/null - then - ${create} - fi - ''; - in [ - ''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"'' - ''local ${partVarName}="$diskPath-part${toString index}"'' - (if keepExisting then fallback else create) - "sudo ${labelScripts.${format} label}" - ]) partitions)); + fallback = '' + if ! { ls "${partVar}" 2>&1; } > /dev/null + then + ${create} + fi + ''; + in + [ + ''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"'' + ''local ${partVarName}="$diskPath-part${toString index}"'' + (if keepExisting then fallback else create) + "sudo ${labelScripts.${format} label}" + ] + ) + partitions)); - fixType = lib.strings.concatLines (builtins.concatMap ( - partition: - lib.optional - (partition.keepExisting && !(builtins.isNull partition.type)) - ''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'') - partitions); - in { - id = if osDisk then "os" else "disk-${name}"; - deviceVariable = diskVar; + fixType = lib.strings.concatLines (builtins.concatMap + ( + partition: + lib.optional + (partition.keepExisting && !(builtins.isNull partition.type)) + ''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'' + ) + partitions); + in + { + id = if osDisk then "os" else "disk-${name}"; + deviceVariable = diskVar; - deviceScript = if osDisk && config.devicePath == null then '' - ${diskSelector} - '' else '' - ${diskVarName}=${config.devicePath} - ${if osDisk then '' - if [ ! -b ${diskVar} ]; then - function fallback() { - echo "Couldn't find the specified disk \"${diskVar}\"." - if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then - ${diskSelector} - else - exit 1 + deviceScript = + if osDisk && config.devicePath == null then '' + ${diskSelector} + '' else '' + ${diskVarName}=${config.devicePath} + ${if osDisk then '' + if [ ! -b ${diskVar} ]; then + function fallback() { + echo "Couldn't find the specified disk \"${diskVar}\"." + if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then + ${diskSelector} + else + exit 1 + fi + } + + fallback fi - } + '' else + ""} + ''; - fallback - fi - '' else - ""} - ''; + script = lib.mkDefault '' + function partition() { + ${if (!config.wipe) then cleanup else ""} + ${probeScript} + ${fdiskCommands} + ${fixType} + } - script = lib.mkDefault '' - function partition() { - ${if (!config.wipe) then cleanup else ""} - ${probeScript} - ${fdiskCommands} - ${fixType} - } - - partition - ''; - }; - }); + partition + ''; + }; + } + ); partitionType = types.submodule ( { name, config, ... }: { @@ -228,10 +241,11 @@ let format = mkOption { type = types.enum (builtins.attrValues fs); description = "The file system format of the partition."; - default = if (isSwap config) then - fs.swap - else - throw ("Partition format not specified."); + default = + if (isSwap config) then + fs.swap + else + throw ("Partition format not specified."); }; size = mkOption { @@ -271,8 +285,10 @@ let else "echo ${lib.strings.escapeShellArg (toString config.size)}"); }; - }); -in { + } + ); +in +{ options = { valhalla = { partition = { @@ -304,41 +320,50 @@ in { config = { valhalla = { partition = { - script = lib.mkDefault (let - cfg = config.valhalla.partition; - inherit (cfg) os rootDir; - inherit (lib.strings) normalizePath; - partPath = part: "/dev/disk/by-label/${part.label}"; - disks = ([ os ] ++ (builtins.attrValues cfg.disks)); - partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); + script = lib.mkDefault ( + let + cfg = config.valhalla.partition; + inherit (cfg) os rootDir; + inherit (lib.strings) normalizePath; + partPath = part: "/dev/disk/by-label/${part.label}"; + disks = ([ os ] ++ (builtins.attrValues cfg.disks)); + partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); - mountScript = lib.strings.concatLines (builtins.concatMap ( - _: [ - probeScript - (builtins.concatStringsSep " " ([ - "sudo" - "mount" - "--mkdir" - ] ++ (lib.optionals (_.format == "ntfs") [ - "-t" "ntfs3" - ]) ++ [ - (builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions)) - (partPath _) - (normalizePath "/${rootDir}/${_.mountPoint}") - ])) - ]) (lib.lists.sortOn - (_: normalizePath "/${_.mountPoint}") + mountScript = lib.strings.concatLines (builtins.concatMap + ( + _: [ + probeScript + (builtins.concatStringsSep " " ([ + "sudo" + "mount" + "--mkdir" + ] ++ (lib.optionals (_.format == "ntfs") [ + "-t" + "ntfs3" + ]) ++ [ + (builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions)) + (partPath _) + (normalizePath "/${rootDir}/${_.mountPoint}") + ])) + ] + ) + (lib.lists.sortOn + (_: 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" - ] + 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)"'' @@ -353,7 +378,8 @@ in { ] ++ (builtins.map (_: _.script) disks) ++ [ mountScript swapScript - ])); + ]) + ); }; }; }; diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix index cf1a76c1..ba618415 100644 --- a/lib/modules/programs.nix +++ b/lib/modules/programs.nix @@ -11,77 +11,85 @@ let }; config = { - programs = builtins.mapAttrs ( - name: config: { - enable = mkDefault config.enable; - }) osConfig.programs; - }; - })); + programs = builtins.mapAttrs + ( + name: config: { + enable = mkDefault config.enable; + } + ) + osConfig.programs; + }; + } + )); }; - mkPrograms = infos: builtins.foldl' (programs: info: - programs // { - ${builtins.elemAt info 0} = { - enable = mkEnableOption (builtins.elemAt info 1); - }; - }) { } infos; + mkPrograms = infos: builtins.foldl' + (programs: info: + programs // { + ${builtins.elemAt info 0} = { + enable = mkEnableOption (builtins.elemAt info 1); + }; + }) + { } + infos; programs = mkPrograms [ - ["aliae" "aliae"] - ["brave" "Brave Browser"] - ["discord" "Discord"] - ["firefox" "Firefox Web Browser"] - ["openssh" "OpenSSH"] - ["osu!lazer" "osu!lazer"] - ["pennywise" "Pennywise"] - ["powershell" "PowerShell Core"] - ["retroarch" "RetroArch"] - ["steam" "Steam"] - ["thunderbird" "Thunderbird"] - ["vscode" "Visual Studio Code"] - ["zoxide" "zoxide"] + [ "aliae" "aliae" ] + [ "brave" "Brave Browser" ] + [ "discord" "Discord" ] + [ "firefox" "Firefox Web Browser" ] + [ "openssh" "OpenSSH" ] + [ "osu!lazer" "osu!lazer" ] + [ "pennywise" "Pennywise" ] + [ "powershell" "PowerShell Core" ] + [ "retroarch" "RetroArch" ] + [ "steam" "Steam" ] + [ "thunderbird" "Thunderbird" ] + [ "vscode" "Visual Studio Code" ] + [ "zoxide" "zoxide" ] ]; linuxPrograms = mkPrograms [ - ["bash" "Bash"] - ["fish" "fish"] - ["icedtea" "IcedTea"] - ["grub" "GRUB"] - ["logo-ls" "logo-ls"] - ["lutris" "Lutris"] - ["minegrub-theme" "Minegrub Theme"] - ["nginx" "nginx"] - ["nodejs-n" "n"] - ["nuke-usb" "nuke-usb"] - ["nvidia-dkms" "Nvidia Drivers"] - ["plasma" "Plasma"] - ["pyenv" "pyenv"] - ["sddm" "SDDM"] - ["vim" "Vim"] - ["virt-manager" "Virtual Machine Manager"] - ["waydroid" "Waydroid"] - ["xone" "xone"] + [ "bash" "Bash" ] + [ "fish" "fish" ] + [ "icedtea" "IcedTea" ] + [ "grub" "GRUB" ] + [ "logo-ls" "logo-ls" ] + [ "lutris" "Lutris" ] + [ "minegrub-theme" "Minegrub Theme" ] + [ "nginx" "nginx" ] + [ "nodejs-n" "n" ] + [ "nuke-usb" "nuke-usb" ] + [ "nvidia-dkms" "Nvidia Drivers" ] + [ "plasma" "Plasma" ] + [ "pyenv" "pyenv" ] + [ "sddm" "SDDM" ] + [ "vim" "Vim" ] + [ "virt-manager" "Virtual Machine Manager" ] + [ "waydroid" "Waydroid" ] + [ "xone" "xone" ] ]; windowsPrograms = mkPrograms [ - ["lghub" "Logitech G Hub"] - ["maniaplanet" "ManiaPlanet"] - ["msedge-redirect" "MSEdgeRedirect"] - ["nvs" "Node Version Switcher"] - ["osu!" "Osu!"] - ["posh-git" "posh-git"] - ["putty" "PuTTY"] - ["rewasd" "reWASD"] - ["terminal-icons" "Terminal Icons"] - ["tm-nations-forever" "TrackMania Nations Forever"] - ["tm-united-forever" "TrackMania United Forever"] - ["tobii-gamehub" "Tobii Game Hub"] - ["tobii-ghost" "Tobii Ghost"] - ["ubiquiti-unifi-controller" "Ubiquiti UniFi Controller"] - ["visualstudio" "Visual Studio"] - ["winscp" "WinSCP"] + [ "lghub" "Logitech G Hub" ] + [ "maniaplanet" "ManiaPlanet" ] + [ "msedge-redirect" "MSEdgeRedirect" ] + [ "nvs" "Node Version Switcher" ] + [ "osu!" "Osu!" ] + [ "posh-git" "posh-git" ] + [ "putty" "PuTTY" ] + [ "rewasd" "reWASD" ] + [ "terminal-icons" "Terminal Icons" ] + [ "tm-nations-forever" "TrackMania Nations Forever" ] + [ "tm-united-forever" "TrackMania United Forever" ] + [ "tobii-gamehub" "Tobii Game Hub" ] + [ "tobii-ghost" "Tobii Ghost" ] + [ "ubiquiti-unifi-controller" "Ubiquiti UniFi Controller" ] + [ "visualstudio" "Visual Studio" ] + [ "winscp" "WinSCP" ] ]; -in { +in +{ imports = [ ./programs/docker.nix ./programs/git.nix diff --git a/lib/modules/programs/docker.nix b/lib/modules/programs/docker.nix index 4f4ed787..07244541 100644 --- a/lib/modules/programs/docker.nix +++ b/lib/modules/programs/docker.nix @@ -5,7 +5,8 @@ let commonOptions = { enable = mkEnableOption "docker"; }; -in { +in +{ options = { valhalla = { programs.docker = commonOptions; @@ -16,7 +17,8 @@ in { options = { programs.docker = commonOptions; }; - })); + } + )); }; linux = { diff --git a/lib/modules/programs/git.nix b/lib/modules/programs/git.nix index eb2b1ed6..6f8a2149 100644 --- a/lib/modules/programs/git.nix +++ b/lib/modules/programs/git.nix @@ -31,7 +31,8 @@ let default = { }; }; }; -in { +in +{ options = { valhalla = { programs.git = gitOption; @@ -42,7 +43,8 @@ in { options = { programs.git = gitOption; }; - })); + } + )); }; }; }; diff --git a/lib/modules/programs/nextcloud.nix b/lib/modules/programs/nextcloud.nix index 86948e27..4de36e67 100644 --- a/lib/modules/programs/nextcloud.nix +++ b/lib/modules/programs/nextcloud.nix @@ -31,7 +31,8 @@ let default = [ ]; }; }; -in { +in +{ options = { valhalla = { programs.nextcloud = commonOptions; @@ -42,7 +43,8 @@ in { options = { programs.nextcloud = commonOptions; }; - })); + } + )); }; windows.users = mkOption { @@ -51,7 +53,8 @@ in { options = { programs.nextcloud = userOptions; }; - })); + } + )); }; }; }; diff --git a/lib/modules/programs/oh-my-posh.nix b/lib/modules/programs/oh-my-posh.nix index ef6602bf..e272b897 100644 --- a/lib/modules/programs/oh-my-posh.nix +++ b/lib/modules/programs/oh-my-posh.nix @@ -16,7 +16,8 @@ let default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source)); }; }; - }); + } + ); commonOptions = { enable = mkEnableOption "Oh My Posh"; @@ -35,7 +36,8 @@ let default = [ ]; }; }; -in { +in +{ options = { valhalla = { programs.oh-my-posh = commonOptions; @@ -46,7 +48,8 @@ in { options = { programs.oh-my-posh = userOptions; }; - })); + } + )); }; }; }; diff --git a/lib/modules/programs/rclone.nix b/lib/modules/programs/rclone.nix index 8ad27eb3..31e87584 100644 --- a/lib/modules/programs/rclone.nix +++ b/lib/modules/programs/rclone.nix @@ -16,7 +16,8 @@ let default = null; }; }; - }); + } + ); commonOptions = { enable = mkEnableOption "rclone"; @@ -29,7 +30,8 @@ let default = { }; }; }; -in { +in +{ options = { valhalla.linux = { programs.rclone = commonOptions; @@ -40,7 +42,8 @@ in { options = { programs.rclone = userOptions; }; - })); + } + )); }; }; }; diff --git a/lib/modules/software.nix b/lib/modules/software.nix index 2f94dc98..e2ab4339 100644 --- a/lib/modules/software.nix +++ b/lib/modules/software.nix @@ -1,150 +1,156 @@ { lib, ... }: - let inherit (lib) mkOption types; - in { - imports = [ - ./programs.nix - ]; +let inherit (lib) mkOption types; +in { + imports = [ + ./programs.nix + ]; - options = { - valhalla = mkOption { - type = types.submodule ( - { config, ... }: - let - optionalAttrs = lib.attrsets.optionalAttrs; - cfg = config; - inherit (cfg.software) coding desktopExperience essential gaming server socialMedia; + options = { + valhalla = mkOption { + type = types.submodule ( + { config, ... }: + let + optionalAttrs = lib.attrsets.optionalAttrs; + cfg = config; + inherit (cfg.software) coding desktopExperience essential gaming server socialMedia; - mkPrograms = programs: builtins.foldl' ( - programs: name: programs // { - ${name}.enable = true; - }) {} programs; - in { - options = { - software = { - essential = mkOption { - type = types.bool; - description = "A value indicating whether essentials should be installed."; - default = false; - }; - - server = mkOption { - type = types.bool; - description = "A value indicating whether server applications should be installed."; - 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; - }; - }; + mkPrograms = programs: builtins.foldl' + ( + programs: name: programs // { + ${name}.enable = true; + } + ) + { } + programs; + in + { + options = { + software = { + essential = mkOption { + type = types.bool; + description = "A value indicating whether essentials 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" - ])); + server = mkOption { + type = types.bool; + description = "A value indicating whether server applications should be installed."; + 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 = { + 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" + ])); + }; + } + ); }; - } + }; +} diff --git a/lib/modules/users.nix b/lib/modules/users.nix index d5c0edd3..682da64f 100644 --- a/lib/modules/users.nix +++ b/lib/modules/users.nix @@ -25,7 +25,8 @@ let default = [ ]; }; }; - }); + } + ); linuxUserType = types.submodule ( { ... }: { @@ -36,7 +37,8 @@ let default = null; }; }; - }); + } + ); winUserType = types.submodule ( { ... }: { @@ -47,8 +49,10 @@ let default = false; }; }; - }); -in { + } + ); +in +{ options = { valhalla = { users = mkOption { diff --git a/lib/modules/windows.nix b/lib/modules/windows.nix index e0278f2c..1fcfc617 100644 --- a/lib/modules/windows.nix +++ b/lib/modules/windows.nix @@ -2,7 +2,8 @@ let inherit (lib) mkDefault mkEnableOption mkIf mkOption types; capitalize = (import ../text.nix { inherit lib; }).capitalize; -in { +in +{ options = { valhalla = { windows = { diff --git a/lib/text.nix b/lib/text.nix index 60e4833c..99ed6a4a 100644 --- a/lib/text.nix +++ b/lib/text.nix @@ -2,6 +2,6 @@ capitalize = text: let chars = lib.strings.stringToCharacters text; in lib.strings.concatStrings - ([ (lib.strings.toUpper (builtins.elemAt chars 0)) ] - ++ (lib.lists.drop 1 chars)); + ([ (lib.strings.toUpper (builtins.elemAt chars 0)) ] + ++ (lib.lists.drop 1 chars)); } diff --git a/profiles/machines/manuel/Generic/config.nix b/profiles/machines/manuel/Generic/config.nix index fdc25c94..ad4b0cc2 100644 --- a/profiles/machines/manuel/Generic/config.nix +++ b/profiles/machines/manuel/Generic/config.nix @@ -37,12 +37,13 @@ in { keyboardLayout = "ch"; i18n = { - localeSettings = let defaultLocale = "en_US.UTF-8"; - in { - LANG = "de_CH.UTF-8"; - LANGUAGE = defaultLocale; - LC_MESSAGE = defaultLocale; - }; + localeSettings = + let defaultLocale = "en_US.UTF-8"; + in { + LANG = "de_CH.UTF-8"; + LANGUAGE = defaultLocale; + LC_MESSAGE = defaultLocale; + }; }; software = { @@ -58,45 +59,46 @@ in { linux.programs.grub.enable = true; programs = { - git = let defaultBranch = "main"; - in { - inherit defaultBranch; + git = + let defaultBranch = "main"; + in { + inherit defaultBranch; - flow = { - mainBranch = defaultBranch; - devBranch = "dev"; - }; + flow = { + mainBranch = defaultBranch; + devBranch = "dev"; + }; - aliases = { - ahfange = "init"; - tuedezue = "add"; - beschuldig = "blame"; - zieh = "pull"; - druck = "push"; - machnah = "clone"; - hol = "fetch"; - zwiigab = "branch"; - buechiih = "commit"; - eich = "rebase"; - erd = "rebase"; - gahufwiifelde = "rebase"; - vergliich = "diff"; - tuezemme = "merge"; - versorg = "stash"; - markier = "tag"; - pflueckoepfel = "cherry-pick"; - pflueckhimbeeri = "cherry-pick"; - buechuus = "checkout"; - quaetsch = "merge --squash"; - pfudle = "push --force"; - beschuldigung = "blame"; - zwiigli = "branch"; - tagebuech = "log"; - versteck = "stash"; - zuestand = "status"; - markierig = "tag"; + aliases = { + ahfange = "init"; + tuedezue = "add"; + beschuldig = "blame"; + zieh = "pull"; + druck = "push"; + machnah = "clone"; + hol = "fetch"; + zwiigab = "branch"; + buechiih = "commit"; + eich = "rebase"; + erd = "rebase"; + gahufwiifelde = "rebase"; + vergliich = "diff"; + tuezemme = "merge"; + versorg = "stash"; + markier = "tag"; + pflueckoepfel = "cherry-pick"; + pflueckhimbeeri = "cherry-pick"; + buechuus = "checkout"; + quaetsch = "merge --squash"; + pfudle = "push --force"; + beschuldigung = "blame"; + zwiigli = "branch"; + tagebuech = "log"; + versteck = "stash"; + zuestand = "status"; + markierig = "tag"; + }; }; - }; }; }; }; diff --git a/profiles/machines/manuel/server.nix b/profiles/machines/manuel/server.nix index 83fc3f67..0c8145ba 100644 --- a/profiles/machines/manuel/server.nix +++ b/profiles/machines/manuel/server.nix @@ -38,12 +38,13 @@ in { keyboardLayout = "ch"; i18n = { - localeSettings = let defaultLocale = "en_US.UTF-8"; - in { - LANG = "de_CH.UTF-8"; - LANGUAGE = defaultLocale; - LC_MESSAGE = defaultLocale; - }; + localeSettings = + let defaultLocale = "en_US.UTF-8"; + in { + LANG = "de_CH.UTF-8"; + LANGUAGE = defaultLocale; + LC_MESSAGE = defaultLocale; + }; }; software = { diff --git a/profiles/users/manuel/desktop.nix b/profiles/users/manuel/desktop.nix index 73174d9b..73c913e5 100644 --- a/profiles/users/manuel/desktop.nix +++ b/profiles/users/manuel/desktop.nix @@ -29,20 +29,22 @@ windows.users.manuel = { programs = { nextcloud = { - folderSyncs = let - localPath = "C:/tools/RetroArch-Win64"; - remotePath = "/Saved Games/RetroArch"; - in [ - { - remotePath = "${remotePath}/Saves"; - localPath = "${localPath}/saves"; - virtualFiles = false; - } - { - remotePath = "${remotePath}/System"; - localPath = "${localPath}/system"; - } - ]; + folderSyncs = + let + localPath = "C:/tools/RetroArch-Win64"; + remotePath = "/Saved Games/RetroArch"; + in + [ + { + remotePath = "${remotePath}/Saves"; + localPath = "${localPath}/saves"; + virtualFiles = false; + } + { + remotePath = "${remotePath}/System"; + localPath = "${localPath}/system"; + } + ]; }; }; }; diff --git a/scripts/Arch/Config/SecureBoot/main.fish b/scripts/Arch/Config/SecureBoot/main.fish index c4b76e45..1ccdf2d0 100755 --- a/scripts/Arch/Config/SecureBoot/main.fish +++ b/scripts/Arch/Config/SecureBoot/main.fish @@ -20,11 +20,11 @@ begin sudo sed -i \ -e "/esp=/{" \ -e "a esp=$(echo "$efiDir" | string escape)" \ - -e "d" \ + -e d \ -e "}" \ -e "/bootloader_id=/{" \ -e "a bootloader_id=$(echo "$label" | string escape)" \ - -e "d" \ + -e d \ -e "}" \ /etc/secureboot.conf diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 4332a697..6b23f877 100755 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -61,7 +61,7 @@ begin and arch-chroot "$mountDir" hwclock --systohc and begin - getOSConfig i18n.localeSettings --json | \ + getOSConfig i18n.localeSettings --json | jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")' end | begin read LOCALES @@ -70,7 +70,7 @@ begin end and begin - getOSConfig i18n.localeSettings --json | \ + getOSConfig i18n.localeSettings --json | jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")' end | arch-chroot "$mountDir" tee /etc/locale.conf >/dev/null diff --git a/scripts/Arch/lib/deploy.fish b/scripts/Arch/lib/deploy.fish index 6998d6b0..ee872b86 100644 --- a/scripts/Arch/lib/deploy.fish +++ b/scripts/Arch/lib/deploy.fish @@ -147,7 +147,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action and yayinst propertree-git # mac .plist config file editor end - and if isProgramEnabled "thunderbird" && $isInstall + and if isProgramEnabled thunderbird && $isInstall yayinst thunderbird end @@ -200,7 +200,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action audius-client-bin end - and if isProgramEnabled "nextcloud" + and if isProgramEnabled nextcloud yayinst nextcloud-client end end @@ -210,11 +210,11 @@ function deploySoftware -d "Deploys a the specified software action" -a action if $isInstall if collectionActive socialMedia yayinst signal-desktop - + and begin yes y | runYay threema-desktop end - + and begin yes y | runYay nodejs end @@ -279,12 +279,12 @@ function deploySoftware -d "Deploys a the specified software action" -a action and sudo flatpak install -y flathub com.usebottles.bottles end end - + and if isProgramEnabled "osu!lazer" yayinst osu-lazer-bin end - and if isProgramEnabled "retroarch" + and if isProgramEnabled retroarch yayinst libretro end end diff --git a/scripts/Common/OS/backup.fish b/scripts/Common/OS/backup.fish index 285036e8..ad7848d6 100644 --- a/scripts/Common/OS/backup.fish +++ b/scripts/Common/OS/backup.fish @@ -20,15 +20,15 @@ function backupAction -V dir read -xP "Please specify the port of the SSH server (default 22): " VALHALLA_BACKUP_SERVER_PORT read -xP "Please specify the name of the user to log in to the SSH server: " VALHALLA_BACKUP_SERVER_USER read -xP "Please specify the path to the key file for logging in to the SSH server: " VALHALLA_BACKUP_SERVER_KEY - + if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ] set -x VALHALLA_BACKUP_SERVER_PORT 22 end - + if [ -n "$VALHALLA_BACKUP_SERVER_USER" ] set -x VALHALLA_BACKUP_SERVER "$VALHALLA_BACKUP_SERVER_USER@$VALHALLA_BACKUP_SERVER" end - + echo echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)" echo "For a seamless experience, please make sure that you are able to establish an unattended ssh connection using key authentication." diff --git a/scripts/Common/Software/docker/services/anki-sync/main.fish b/scripts/Common/Software/docker/services/anki-sync/main.fish index 4e39b2af..2ac5c103 100755 --- a/scripts/Common/Software/docker/services/anki-sync/main.fish +++ b/scripts/Common/Software/docker/services/anki-sync/main.fish @@ -12,7 +12,7 @@ begin initializeServiceInstallation $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 installDockerService $argv diff --git a/scripts/Common/Software/docker/services/drone/main.fish b/scripts/Common/Software/docker/services/drone/main.fish index 479169e1..2cde1bc7 100755 --- a/scripts/Common/Software/docker/services/drone/main.fish +++ b/scripts/Common/Software/docker/services/drone/main.fish @@ -52,8 +52,8 @@ begin end CI_NAME=$ciName \ - SECRET_ENV="$name.secret.env" \ - RUNNER_ENV="$name.runner.env" begin + SECRET_ENV="$name.secret.env" \ + RUNNER_ENV="$name.runner.env" begin begin printf "%s\n" \ DRONE_RPC_PROTO=http \ @@ -62,28 +62,28 @@ begin echo "DRONE_RPC_SECRET=$secret" | sudo tee "$root/$SECRET_ENV" >/dev/null - yq "$ciKey = $ciTemplate" "$tmpConfig" | \ - ENTRY="./data/$name:/data" yq "$ciKey.volumes = [ env(ENTRY) ]" | \ - yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | \ - PROTO=https yq "$ciEnv.DRONE_SERVER_PROTO = env(PROTO)" | \ - HOST=(getServiceDomain "$subdomain" "$domain") yq "$ciEnv.DRONE_SERVER_HOST = env(HOST)" | \ - yq "$dockerKey = $dockerTemplate" | \ - yq "$sshKey = $sshTemplate" | \ - yq "$dockerKey.depends_on = [ env(CI_NAME) ]" | \ + yq "$ciKey = $ciTemplate" "$tmpConfig" | + ENTRY="./data/$name:/data" yq "$ciKey.volumes = [ env(ENTRY) ]" | + yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | + PROTO=https yq "$ciEnv.DRONE_SERVER_PROTO = env(PROTO)" | + HOST=(getServiceDomain "$subdomain" "$domain") yq "$ciEnv.DRONE_SERVER_HOST = env(HOST)" | + yq "$dockerKey = $dockerTemplate" | + yq "$sshKey = $sshTemplate" | + yq "$dockerKey.depends_on = [ env(CI_NAME) ]" | sudo tee "$config" >/dev/null for key in $dockerKey $sshKey set -l file (mktemp) - yq "$key.depends_on = [ env(CI_NAME) ]" "$config" | \ - yq "$key.env_file |= . + [ env(RUNNER_ENV), env(SECRET_ENV) ]" | \ + yq "$key.depends_on = [ env(CI_NAME) ]" "$config" | + yq "$key.env_file |= . + [ env(RUNNER_ENV), env(SECRET_ENV) ]" | tee "$file" >/dev/null sudo cp "$file" "$config" rm "$file" 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 end end @@ -101,7 +101,7 @@ begin for i in (seq 1 3 (count $environments)) 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" end end diff --git a/scripts/Common/Software/docker/services/forgejo/main.fish b/scripts/Common/Software/docker/services/forgejo/main.fish index 56dfc6b3..c65b09a4 100755 --- a/scripts/Common/Software/docker/services/forgejo/main.fish +++ b/scripts/Common/Software/docker/services/forgejo/main.fish @@ -1,8 +1,8 @@ #!/bin/env fish begin set -l dir (status dirname) - set -l user "forgejo" - set -l domain "git" + set -l user forgejo + set -l domain git set -l server "$domain" "" set -l service $user source "$dir/../service.fish" @@ -23,21 +23,21 @@ begin set port (yq (getSSHPortKey) "$source" | mutatePort "$port") DOMAIN=(getServiceDomain $server) PW=$pw DB=Git USER=forgejo PW=$pw begin - set -l gitEnv "$(getServiceKey "$service").environment" - set -l actEnv "$(getServiceKey "runner").environment" - set -l dbEnv "$(getServiceKey "db").environment" + set -l gitEnv "$(getServiceKey "$service").environment" + set -l actEnv "$(getServiceKey "runner").environment" + set -l dbEnv "$(getServiceKey "db").environment" - PORT=$port yq "$(getSSHPortKey) = env(PORT)" "$source" | \ - yq "$gitEnv.FORGEJO__server__DOMAIN = env(DOMAIN)" | \ - yq "$gitEnv.FORGEJO__database__NAME = env(DB)" | \ - yq "$gitEnv.FORGEJO__database__USER = env(USER)" | \ - yq "$gitEnv.FORGEJO__database__PASSWD = env(PW)" | \ - yq "$dbEnv.MARIADB_DATABASE = env(DB)" | \ - yq "$dbEnv.MARIADB_USER = env(USER)" | \ - yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | \ - URL="https://$DOMAIN/" yq "$actEnv.GITEA_INSTANCE_URL = env(URL)" | \ - sudo tee "$overrides" >/dev/null - end + PORT=$port yq "$(getSSHPortKey) = env(PORT)" "$source" | + yq "$gitEnv.FORGEJO__server__DOMAIN = env(DOMAIN)" | + yq "$gitEnv.FORGEJO__database__NAME = env(DB)" | + yq "$gitEnv.FORGEJO__database__USER = env(USER)" | + yq "$gitEnv.FORGEJO__database__PASSWD = env(PW)" | + yq "$dbEnv.MARIADB_DATABASE = env(DB)" | + yq "$dbEnv.MARIADB_USER = env(USER)" | + yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | + URL="https://$DOMAIN/" yq "$actEnv.GITEA_INSTANCE_URL = env(URL)" | + sudo tee "$overrides" >/dev/null + end installDockerService $argv end @@ -49,7 +49,7 @@ begin set -l file (mktemp) set -l root (getServiceRoot $argv) 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 overrides (getServiceOverrides $argv) set -l envKey "$(getServiceKey "$service").environment" @@ -66,8 +66,8 @@ begin set uid (id -u $user) set gid (id -g $user) - and yq "$envKey.USER_UID = $uid" "$file" | \ - yq "$envKey.USER_GID = $gid" | \ + and yq "$envKey.USER_UID = $uid" "$file" | + yq "$envKey.USER_GID = $gid" | sudo tee "$config" >/dev/null mkdir -p "$dir" diff --git a/scripts/Common/Software/docker/services/jellyfin/main.fish b/scripts/Common/Software/docker/services/jellyfin/main.fish index af26845a..7710d69d 100755 --- a/scripts/Common/Software/docker/services/jellyfin/main.fish +++ b/scripts/Common/Software/docker/services/jellyfin/main.fish @@ -1,8 +1,8 @@ #!/bin/env fish begin set -l dir (status dirname) - set -l user "jellyfin" - set -l domain "media" + set -l user jellyfin + set -l domain media set -l server "$domain" "" set -l servarr radarr sonarr lidarr prowlarr set -l flood flood @@ -31,7 +31,7 @@ begin set -l port set -l file (mktemp) 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 overrides (getServiceOverrides $argv) set -l envKey "$(getServiceKey "$service").environment" @@ -57,13 +57,13 @@ begin set -l envKey "$(getServiceKey "$name").environment" sudo cp "$config" "$file" - and yq "$envKey.PUID = $uid" "$file" | \ - yq "$envKey.PGID = $gid" | \ + and yq "$envKey.PUID = $uid" "$file" | + yq "$envKey.PGID = $gid" | sudo tee "$config" >/dev/null end 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 for dir in "$root"/{downloads,config/{,jellyfin,flood,rtorrent,radarr,sonarr,lidarr,prowlarr},media/{,movies,series,music}} @@ -99,7 +99,7 @@ begin function getServiceLocationConfig -a domain s location -V service -V flood if [ "$s" = "$service" ] set -l argv $argv[4..] - + printf "%s\n" \ "location = / {" \ 'return 302 $scheme://$host/web/;' \ @@ -107,13 +107,13 @@ begin 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 "/socket" --comment "Proxy Jellyfin Websockets traffic" $argv + getServiceDefaultProxy $domain $s /socket --comment "Proxy Jellyfin Websockets traffic" $argv else if [ "$s" = "$flood" ] getServiceDefaultProxy $argv printf "%s\n" \ "location = /flood {" \ - 'return 302 $scheme://$host$uri/$is_args$args;' \ + 'return 302 $scheme://$host$uri/$is_args$args;' \ "}" else getServiceDefaultProxy $argv --path "$location" @@ -126,7 +126,7 @@ begin printf "%s\n" \ "# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \ "proxy_buffering off;" - else if [ "$location" = "/socket" ] + else if [ "$location" = /socket ] printf "%s\n" \ '# Websocket' \ "proxy_http_version 1.1;" \ diff --git a/scripts/Common/Software/docker/services/jellyfin/pvpn-cli.py b/scripts/Common/Software/docker/services/jellyfin/pvpn-cli.py index 426ffbad..e273616f 100644 --- a/scripts/Common/Software/docker/services/jellyfin/pvpn-cli.py +++ b/scripts/Common/Software/docker/services/jellyfin/pvpn-cli.py @@ -7,6 +7,7 @@ import subprocess import sys from protonvpn_cli.cli import FeatureEnum, protonvpn + def run_proton(args): exit( subprocess.run( @@ -17,6 +18,7 @@ def run_proton(args): PIPENV_VENV_IN_PROJECT=f"{1}", PVPN_CMD_ARGS=" ".join(args))).returncode) + protonvpn.ensure_connectivity() args = sys.argv[1:] @@ -56,9 +58,11 @@ else: try: session.ensure_valid() 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_TIER"] = f"{session.vpn_tier}" @@ -95,6 +99,7 @@ else: run_proton(["connect", server.name]) 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: run_proton(args) diff --git a/scripts/Common/Software/docker/services/minecraft/main.fish b/scripts/Common/Software/docker/services/minecraft/main.fish index 5b3895ef..0dc64a41 100644 --- a/scripts/Common/Software/docker/services/minecraft/main.fish +++ b/scripts/Common/Software/docker/services/minecraft/main.fish @@ -1,7 +1,7 @@ #!/bin/env fish begin set -l dir (status dirname) - set -l user "minecraft" + set -l user minecraft source "$dir/../service.fish" function installSW -V dir -V domain -V server -V service @@ -34,8 +34,8 @@ begin set -l envKey "$(getServiceKey "$service").environment" cp "$config" "$file" - and yq "$envKey.UID = $uid" "$file" | \ - yq "$envKey.GID = $gid" | \ + and yq "$envKey.UID = $uid" "$file" | + yq "$envKey.GID = $gid" | sudo tee "$config" >/dev/null end diff --git a/scripts/Common/Software/docker/services/nextcloud/main.fish b/scripts/Common/Software/docker/services/nextcloud/main.fish index 14e8a009..ea1c4f30 100644 --- a/scripts/Common/Software/docker/services/nextcloud/main.fish +++ b/scripts/Common/Software/docker/services/nextcloud/main.fish @@ -5,7 +5,7 @@ begin set -l domain cloud "" set -l service web set -l office collabora - set -l officeDomain "office" "" + set -l officeDomain office "" set -l server $service $domain set -l services \ @@ -68,13 +68,13 @@ begin set -l key "$turnKey.command" PW="--static-auth-secret=$turnPW" \ - DOMAIN="--realm=$domain" \ - yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" | \ - DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" | \ - URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" | \ + DOMAIN="--realm=$domain" \ + yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" | + DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" | + URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" | sudo tee "$overrides" >/dev/null end - + installDockerService $argv set turnPort (yq (getServicePortKey "$turn") "$overrides" | extractPort) set turnPort (yq "$portKey" "$overrides" | mutatePort "$turnPort") diff --git a/scripts/Common/Software/docker/services/ryot/main.fish b/scripts/Common/Software/docker/services/ryot/main.fish index 926b7140..7b294132 100644 --- a/scripts/Common/Software/docker/services/ryot/main.fish +++ b/scripts/Common/Software/docker/services/ryot/main.fish @@ -1,8 +1,8 @@ #!/bin/env fish begin set -l dir (status dirname) - set -l domain "tracker" "" - set -l service "ryot" + set -l domain tracker "" + set -l service ryot set -l source "$dir/docker-compose.overrides.yml" source "$dir/../service.fish" @@ -17,8 +17,8 @@ begin initializeServiceInstallation $argv sudo cp "$file" "$root" - URL=$dbUrl yq "$dbKey = env(URL)" "$source" | \ - PW=$pw yq ".services.db.environment.POSTGRES_PASSWORD = env(PW)" | \ + URL=$dbUrl yq "$dbKey = env(URL)" "$source" | + PW=$pw yq ".services.db.environment.POSTGRES_PASSWORD = env(PW)" | sudo tee (getServiceOverrides $argv) >/dev/null installDockerService $argv diff --git a/scripts/Common/Software/docker/services/teamspeak/main.fish b/scripts/Common/Software/docker/services/teamspeak/main.fish index c24d080a..c9a9b499 100644 --- a/scripts/Common/Software/docker/services/teamspeak/main.fish +++ b/scripts/Common/Software/docker/services/teamspeak/main.fish @@ -5,26 +5,26 @@ begin source "$dir/../service.fish" 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 db "TeamSpeak" + set -l db TeamSpeak set -l tsEnv "$(getServiceKey "$service").environment" set -l dbEnv "$(getServiceKey db).environment" initializeServiceInstallation $argv cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) USER="$service" begin - yq "$tsEnv.TS3SERVER_DB_USER = env(USER)" "$source" | \ - yq "$dbEnv.MARIADB_USER = env(USER)" + yq "$tsEnv.TS3SERVER_DB_USER = env(USER)" "$source" | + yq "$dbEnv.MARIADB_USER = env(USER)" end | \ - PW="$pw" begin - yq "$tsEnv.TS3SERVER_DB_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)" + PW="$pw" begin + yq "$tsEnv.TS3SERVER_DB_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 | sudo tee (getServiceOverrides $argv) >/dev/null installDockerService $argv diff --git a/scripts/Common/Software/docker/services/trackmania/main.fish b/scripts/Common/Software/docker/services/trackmania/main.fish index 0d3dc1fe..5bed87c0 100755 --- a/scripts/Common/Software/docker/services/trackmania/main.fish +++ b/scripts/Common/Software/docker/services/trackmania/main.fish @@ -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" - PW="$tmPW" yq "$(getServiceKey "tm").environment.TM_SUPERADMIN_PASSWORD = env(PW)" "$source" | \ - PW="$sqlPW" yq "$(getServiceKey "db").environment.MYSQL_PASSWORD = env(PW)" | \ + PW="$tmPW" yq "$(getServiceKey "tm").environment.TM_SUPERADMIN_PASSWORD = env(PW)" "$source" | + PW="$sqlPW" yq "$(getServiceKey "db").environment.MYSQL_PASSWORD = env(PW)" | sudo tee "$root/$(basename "$source")" >/dev/null installDockerService $argv @@ -33,5 +33,5 @@ begin echo "^docker-compose\.core\.overrides\.yml\$" end - runInstaller --force $argv --name "tm-forever" + runInstaller --force $argv --name tm-forever end diff --git a/scripts/Common/Software/docker/services/trackmania/tmforever-entrypoint.sh b/scripts/Common/Software/docker/services/trackmania/tmforever-entrypoint.sh index 1a74c6a9..bce5fdf6 100755 --- a/scripts/Common/Software/docker/services/trackmania/tmforever-entrypoint.sh +++ b/scripts/Common/Software/docker/services/trackmania/tmforever-entrypoint.sh @@ -29,30 +29,30 @@ serverOptions=( TM_TITLE name TM_COMMENT comment TM_HIDDEN hide_server - + \ TM_MAX_PLAYERS max_players TM_PLAYER_PASSWORD password - + \ TM_MAX_SPECTATORS max_spectators TM_SPECTATOR_PASSWORD password_spectator - + \ TM_LADDER_MODE ladder_mode TM_LADDER_LIMIT_MIN ladder_serverlimit_min TM_LADDER_LIMIT_MAX ladder_serverlimit_max - + \ TM_ENABLE_P2P_UPLOAD enable_p2p_upload TM_ENABLE_P2P_DOWNLOAD enable_p2p_download - + \ TM_CALLVOTE_TIMEOUT callvote_timeout TM_CALLVOTE_RATIO callvote_ratio - + \ TM_ALLOW_CHALLENGE_DOWNLOAD allow_challenge_download TM_AUTOSAVE_REPLAYS autosave_replays TM_AUTOSAVE_VALIDATION_REPLAYS autosave_validation_replays - + \ TM_REFEREE_PASSWORD referee_password TM_REFEREE_VALIDATION_MODE referee_validation_mode - + \ TM_USE_CHANGING_VALIDATION_SEED use_changing_validation_seed ) @@ -62,23 +62,23 @@ systemOptions=( TM_P2P_PORT server_p2p_port TM_CLIENT_PORT client_port TM_USE_NAT_UPNP use_nat_upnp - + \ TM_XMLRPC_PORT xmlrpc_port TM_XMLRPC_ALLOWED_REMOTE xmlrpc_allowremote - + \ TM_PACKMASK packmask - + \ TM_CONNECTION_UPLOADRATE connection_uploadrate TM_CONNECTION_DOWNLOADRATE connection_downloadrate - + \ TM_P2P_CACHE_SIZE p2p_cache_size - + \ TM_BLACKLIST_URL blacklist_url TM_GUESTLIST_FILENAME guestlist_filename TM_BLACKLIST_FILENAME blacklist_filename - + \ TM_ALLOW_SPECTATOR_RELAYS allow_spectator_relays - + \ TM_USE_PROXY use_proxy TM_PROXY_LOGIN proxy_login TM_PROXY_PASSWORD proxy_password diff --git a/scripts/Common/Software/docker/services/vaultwarden/main.fish b/scripts/Common/Software/docker/services/vaultwarden/main.fish index c96ba805..1b38bdb0 100644 --- a/scripts/Common/Software/docker/services/vaultwarden/main.fish +++ b/scripts/Common/Software/docker/services/vaultwarden/main.fish @@ -1,7 +1,7 @@ #!/bin/env fish begin set -l dir (status dirname) - set -l domain "passwords" + set -l domain passwords set -l source "$dir/docker-compose.overrides.yml" source "$dir/../service.fish" @@ -14,10 +14,10 @@ begin initializeServiceInstallation $argv cp "$dir/docker-compose.base.yml" (getServiceRoot $argv) - URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" | \ - ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | \ - URL=$dbUrl yq "$dbKey = env(URL)" | \ - PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" | \ + URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" | + ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | + URL=$dbUrl yq "$dbKey = env(URL)" | + PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" | sudo tee (getServiceOverrides $argv) >/dev/null installDockerService $argv diff --git a/scripts/Common/Software/docker/services/wekan/main.fish b/scripts/Common/Software/docker/services/wekan/main.fish index 042284f2..d21d6316 100755 --- a/scripts/Common/Software/docker/services/wekan/main.fish +++ b/scripts/Common/Software/docker/services/wekan/main.fish @@ -12,7 +12,7 @@ begin 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 installDockerService $argv diff --git a/scripts/Common/Software/docker/services/woodpecker/main.fish b/scripts/Common/Software/docker/services/woodpecker/main.fish index 7ecec926..3d905230 100755 --- a/scripts/Common/Software/docker/services/woodpecker/main.fish +++ b/scripts/Common/Software/docker/services/woodpecker/main.fish @@ -57,29 +57,29 @@ begin end CI_NAME=$ciName \ - SECRET_ENV="$name.secret.env" begin + SECRET_ENV="$name.secret.env" begin begin echo "WOODPECKER_AGENT_SECRET=$secret" end | sudo tee "$root/$SECRET_ENV" >/dev/null - yq "$ciKey = $ciTemplate" "$tmpConfig" | \ - DB="$dbName" yq "$ciKey.depends_on |= . + [ env(DB) ]" | \ - ENTRY="./data/$name/ci:/var/lib/woodpecker" yq "$ciKey.volumes = [ env(ENTRY) ]" | \ - yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | \ - yq "$agentKey = $agentTemplate" | \ - yq "$agentKey.depends_on |= . + [ env(CI_NAME) ]" | \ - yq "$agentKey.env_file |= . + [ env(SECRET_ENV) ]" | \ - SERVER="$ciName:9000" yq "$agentEnv.WOODPECKER_SERVER = env(SERVER)" | \ - yq "$dbKey = $dbTemplate" | \ - ENTRY="./data/$name/db:/var/lib/mysql" yq "$dbKey.volumes |= . + [ env(ENTRY) ]" | \ + yq "$ciKey = $ciTemplate" "$tmpConfig" | + DB="$dbName" yq "$ciKey.depends_on |= . + [ env(DB) ]" | + ENTRY="./data/$name/ci:/var/lib/woodpecker" yq "$ciKey.volumes = [ env(ENTRY) ]" | + yq "$ciKey.env_file |= . + [ env(SECRET_ENV) ]" | + yq "$agentKey = $agentTemplate" | + yq "$agentKey.depends_on |= . + [ env(CI_NAME) ]" | + yq "$agentKey.env_file |= . + [ env(SECRET_ENV) ]" | + SERVER="$ciName:9000" yq "$agentEnv.WOODPECKER_SERVER = env(SERVER)" | + yq "$dbKey = $dbTemplate" | + ENTRY="./data/$name/db:/var/lib/mysql" yq "$dbKey.volumes |= . + [ env(ENTRY) ]" | sudo tee "$config" >/dev/null - HOST="https://$domain" yq "$ciEnv.WOODPECKER_HOST = env(HOST)" "$tmpOverrides" | \ - 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)" | \ - USER="$dbUser" yq "$dbEnv.MARIADB_USER = env(USER)" | \ - PW="$pw" yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | \ - DB="$db" yq "$dbEnv.MARIADB_DATABASE = env(DB)" | \ + HOST="https://$domain" yq "$ciEnv.WOODPECKER_HOST = env(HOST)" "$tmpOverrides" | + 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)" | + USER="$dbUser" yq "$dbEnv.MARIADB_USER = env(USER)" | + PW="$pw" yq "$dbEnv.MARIADB_PASSWORD = env(PW)" | + DB="$db" yq "$dbEnv.MARIADB_DATABASE = env(DB)" | sudo tee "$overrides" >/dev/null end end @@ -97,7 +97,7 @@ begin for i in (seq 1 3 (count $environments)) 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" end end diff --git a/scripts/Common/Software/linux/main.fish b/scripts/Common/Software/linux/main.fish index cf6e2c32..4b90257a 100644 --- a/scripts/Common/Software/linux/main.fish +++ b/scripts/Common/Software/linux/main.fish @@ -5,6 +5,6 @@ begin function getUserBackupArgs 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 diff --git a/scripts/Common/Software/nuke-usb/nuke-usb.sh b/scripts/Common/Software/nuke-usb/nuke-usb.sh index 15952335..2215849f 100755 --- a/scripts/Common/Software/nuke-usb/nuke-usb.sh +++ b/scripts/Common/Software/nuke-usb/nuke-usb.sh @@ -11,6 +11,7 @@ sleep_secs="1" # * 'ehci-pci' - USB 2.0 # * 'xhci_hcd' - USB 3.0 echo "Looking for USB standards ..." + for usb_std in "$base/"?hci[-_]?c*; do echo "* USB standard '$usb_std' ..." @@ -25,4 +26,5 @@ for usb_std in "$base/"?hci[-_]?c*; do echo " done." done + echo "done." diff --git a/scripts/Common/Software/powershell/Main.ps1 b/scripts/Common/Software/powershell/Main.ps1 index 594bc325..3e779fe2 100644 --- a/scripts/Common/Software/powershell/Main.ps1 +++ b/scripts/Common/Software/powershell/Main.ps1 @@ -36,4 +36,4 @@ Start-SoftwareInstaller @args ` }).ToString()) -join "`n") ` -Append; } -}; + }; diff --git a/scripts/Windows/Drivers/Predator Z301C/Main.ps1 b/scripts/Windows/Drivers/Predator Z301C/Main.ps1 index bfbfa59d..f4fbaa56 100644 --- a/scripts/Windows/Drivers/Predator Z301C/Main.ps1 +++ b/scripts/Windows/Drivers/Predator Z301C/Main.ps1 @@ -9,7 +9,7 @@ Start-SoftwareInstaller -Force @args ` $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; 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; Remove-Item -Recurse $dir; diff --git a/scripts/Windows/Software/tobii-gamehub/GameHub.ahk b/scripts/Windows/Software/tobii-gamehub/GameHub.ahk index 0df72a3d..8073dc22 100644 --- a/scripts/Windows/Software/tobii-gamehub/GameHub.ahk +++ b/scripts/Windows/Software/tobii-gamehub/GameHub.ahk @@ -1,25 +1,24 @@ -InstallGameHub() -{ - SetDefaultMouseSpeed(100) - SetTitleMatchMode("RegEx") - windowTitle := "^Tobii Game Hub$" +InstallGameHub() { + SetDefaultMouseSpeed(100) + SetTitleMatchMode("RegEx") + windowTitle := "^Tobii Game Hub$" - Run("setup.exe") - WinWait(windowTitle, unset, 60) - WinActivate(windowTitle) - Sleep(2 * 1000) - MouseClick("Left", 485, 365) - MouseClick("Left", 600, 455) - MouseClick("Left", 533, 623) - MouseClick("Left", 936, 662) - Sleep(4 * 1000) - WinActivate(windowTitle) - MouseClick("Left", 1150, 60) - MouseClick("Left", 518, 203) - Sleep(10 * 1000) - WinActivate(windowTitle) - pid := WinGetPID() - Run("pwsh -c Stop-Process -Force " . pid) + Run("setup.exe") + WinWait(windowTitle, unset, 60) + WinActivate(windowTitle) + Sleep(2 * 1000) + MouseClick("Left", 485, 365) + MouseClick("Left", 600, 455) + MouseClick("Left", 533, 623) + MouseClick("Left", 936, 662) + Sleep(4 * 1000) + WinActivate(windowTitle) + MouseClick("Left", 1150, 60) + MouseClick("Left", 518, 203) + Sleep(10 * 1000) + WinActivate(windowTitle) + pid := WinGetPID() + Run("pwsh -c Stop-Process -Force " . pid) } SetWorkingDir(A_InitialWorkingDir) diff --git a/scripts/Windows/Software/tobii-ghost/Ghost.ahk b/scripts/Windows/Software/tobii-ghost/Ghost.ahk index 2e32f6f6..1aa0460c 100644 --- a/scripts/Windows/Software/tobii-ghost/Ghost.ahk +++ b/scripts/Windows/Software/tobii-ghost/Ghost.ahk @@ -1,22 +1,21 @@ -InstallGhost() -{ - SetDefaultMouseSpeed(100) - SetTitleMatchMode("RegEx") - windowTitle := "^Tobii Ghost$" +InstallGhost() { + SetDefaultMouseSpeed(100) + SetTitleMatchMode("RegEx") + windowTitle := "^Tobii Ghost$" - Run("setup.exe") - WinWait(windowTitle, unset, 60) - WinActivate(windowTitle) - MouseClick("Left", 44, 694) - MouseClick("Left", 330, 752) - WinWaitNotActive() - WinWait(windowTitle, unset, 20) - MouseClick("Left", 563, 397) - MouseClick("Left", 650, 497) - Sleep(10 * 1000) - WinActivate(windowTitle) - pid := WinGetPID() - Run("pwsh -c Stop-Process -Force " . pid) + Run("setup.exe") + WinWait(windowTitle, unset, 60) + WinActivate(windowTitle) + MouseClick("Left", 44, 694) + MouseClick("Left", 330, 752) + WinWaitNotActive() + WinWait(windowTitle, unset, 20) + MouseClick("Left", 563, 397) + MouseClick("Left", 650, 497) + Sleep(10 * 1000) + WinActivate(windowTitle) + pid := WinGetPID() + Run("pwsh -c Stop-Process -Force " . pid) } SetWorkingDir(A_InitialWorkingDir) diff --git a/scripts/Windows/Software/zoxide/Main.ps1 b/scripts/Windows/Software/zoxide/Main.ps1 index 55077997..f1dd1248 100644 --- a/scripts/Windows/Software/zoxide/Main.ps1 +++ b/scripts/Windows/Software/zoxide/Main.ps1 @@ -8,4 +8,4 @@ Start-SoftwareInstaller @args ` -Installer { Install-ChocoPackage zoxide; Install-WingetPackage junegunn.fzf; - }; \ No newline at end of file + }; diff --git a/scripts/Windows/lib/Deployment.ps1 b/scripts/Windows/lib/Deployment.ps1 index f3fc4c1e..778cb2e9 100644 --- a/scripts/Windows/lib/Deployment.ps1 +++ b/scripts/Windows/lib/Deployment.ps1 @@ -208,7 +208,7 @@ function Deploy-SoftwareAction { Install-ChocoPackage teamspeak; Remove-DesktopIcon "*TeamSpeak*"; } - elseif ($userInstall) { + elseif ($userInstall) { Install-WingetPackage ` Element.Element ` OpenWhisperSystems.Signal ` diff --git a/scripts/lib/Settings.ps1 b/scripts/lib/Settings.ps1 index 28fd2656..85468be5 100644 --- a/scripts/lib/Settings.ps1 +++ b/scripts/lib/Settings.ps1 @@ -186,7 +186,8 @@ $null = New-Module { $programs = & { if ($User) { return Get-UserConfig -UserName $User @args; - } else { + } + else { return Get-OSConfig @args; } } "programs"; @@ -207,7 +208,8 @@ $null = New-Module { try { (Get-ProgramConfig @PSBoundParameters).enable; - } catch { + } + catch { $false; } } diff --git a/scripts/lib/Software.ps1 b/scripts/lib/Software.ps1 index 255a1909..1faa5486 100644 --- a/scripts/lib/Software.ps1 +++ b/scripts/lib/Software.ps1 @@ -90,7 +90,7 @@ $null = New-Module { installer = $installHandler; arguments = $Arguments; context = $Context; - base = { & $runBase @args }; + base = { & $runBase @args }; }; switch ($Action) { diff --git a/scripts/lib/action.fish b/scripts/lib/action.fish index b465f419..3d4ea167 100644 --- a/scripts/lib/action.fish +++ b/scripts/lib/action.fish @@ -58,12 +58,12 @@ function runSetupUserAction -V dir echo "Creating setup user" and useradd \ - --comment "PortValhalla Setup User" \ - --system \ - --groups nix-users \ - --create-home \ - --uid (getOSConfig setupUser.id --json) \ - "$name" + --comment "PortValhalla Setup User" \ + --system \ + --groups nix-users \ + --create-home \ + --uid (getOSConfig setupUser.id --json) \ + "$name" and begin echo "$name ALL=(ALL:ALL) NOPASSWD: ALL" diff --git a/scripts/lib/nix.fish b/scripts/lib/nix.fish index 7f44084d..76f1fc99 100644 --- a/scripts/lib/nix.fish +++ b/scripts/lib/nix.fish @@ -1,7 +1,7 @@ begin set -l dir (status dirname) 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 nix-instantiate --eval --expr "{ path }: import path" --argstr path "$path" &>/dev/null diff --git a/scripts/lib/restoration.fish b/scripts/lib/restoration.fish index 0a414e28..b609f2f7 100644 --- a/scripts/lib/restoration.fish +++ b/scripts/lib/restoration.fish @@ -5,18 +5,18 @@ function backupFiles set -l path (getArchivePath $argv) set -l dir (dirname "$path") argparse -i "u/user=" "n/name=" -- $argv - + if runRestorationCommand test ! -d "$dir" runRestorationCommand mkdir -p "$dir" end - + if [ -n "$_flag_base_directory" ] set -a argv --base-directory "$_flag_base_directory" set -a tarArgs -C "$_flag_base_directory" else set -a tarArgs -P end - + sudo tar $tarArgs -cvz (fd $argv) | createArchive "$path" end end diff --git a/scripts/lib/software.fish b/scripts/lib/software.fish index aa1a5be5..29dbca60 100755 --- a/scripts/lib/software.fish +++ b/scripts/lib/software.fish @@ -41,7 +41,7 @@ begin argparse -i "$arg=" -- $args set -l argv $backup end - + if [ -z "$$varName" ] argparse -i "$arg=" -- $argv set -a args "--$arg" "$$varName" @@ -109,12 +109,12 @@ begin end function runInstallerAction -V dir -V actions - argparse -i "force" "name=" "action=" -- $argv + argparse -i force "name=" "action=" -- $argv set -l install set -l name $_flag_name set -l action $_flag_action set -l args $_flag_force --name "$name" - set -l dependencyFunction "installSWDependencies" + set -l dependencyFunction installSWDependencies set -l installDependencies source "$dir/settings.fish" @@ -149,8 +149,8 @@ begin if [ "$action" = "$actions[$i]" ] set -l message set -l function $actions[(math $i + 1)] - set -l preRun "__preRun" - set -l postRun "__postRun" + set -l preRun __preRun + set -l postRun __postRun functions -e $preRun functions -e $postRun diff --git a/scripts/test/arch-install.fish b/scripts/test/arch-install.fish index cc6c6623..1ac30ce9 100755 --- a/scripts/test/arch-install.fish +++ b/scripts/test/arch-install.fish @@ -2,7 +2,7 @@ set -l dir (status dirname) set -l container valhalla-test set -l containerDir "/var/lib/lxc/$container" -set -l valhallaRoot "opt/PortValhalla" +set -l valhallaRoot opt/PortValhalla sudo lxc-stop "$container" sudo lxc-destroy "$container" sudo lxc-create "$container" -t download -- --dist archlinux --release current --arch amd64 @@ -20,7 +20,7 @@ begin "# VPN" \ "lxc.cgroup.devices.allow = c 10:200 rwm" \ "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" diff --git a/winiso/README.md b/winiso/README.md index ad3f7c4b..ad7e1328 100644 --- a/winiso/README.md +++ b/winiso/README.md @@ -1,3 +1,3 @@ # winiso-valhalla -A project for generating a Windows installation medium. \ No newline at end of file +A project for generating a Windows installation medium.