mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-20 08:57:53 +01:00
Compare commits
1 Commits
7ba8b47d7d
...
shellcheck
| Author | SHA1 | Date | |
|---|---|---|---|
| 81b458d59c |
@@ -184,11 +184,6 @@
|
|||||||
};
|
};
|
||||||
ildkule = stableNixosConfig "ildkule" { };
|
ildkule = stableNixosConfig "ildkule" { };
|
||||||
#ildkule-unstable = unstableNixosConfig "ildkule" { };
|
#ildkule-unstable = unstableNixosConfig "ildkule" { };
|
||||||
skrot = stableNixosConfig "skrot" {
|
|
||||||
modules = [
|
|
||||||
inputs.disko.nixosModules.disko
|
|
||||||
];
|
|
||||||
};
|
|
||||||
shark = stableNixosConfig "shark" { };
|
shark = stableNixosConfig "shark" { };
|
||||||
wenche = stableNixosConfig "wenche" { };
|
wenche = stableNixosConfig "wenche" { };
|
||||||
temmie = stableNixosConfig "temmie" { };
|
temmie = stableNixosConfig "temmie" { };
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ in {
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
# Delete files and directories that exists in the gallery that don't exist in the tarball
|
# Delete files and directories that exists in the gallery that don't exist in the tarball
|
||||||
filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf ${transferDir}/gallery.tar.gz | sed 's|/$||')))
|
filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf "${transferDir}/gallery.tar.gz" | sed 's|/$||')))
|
||||||
while IFS= read fname; do
|
while IFS= read -r fname; do
|
||||||
rm -f "$fname" ||:
|
rm -f "$fname" ||:
|
||||||
rm -f ".thumbnails/$fname.png" ||:
|
rm -f ".thumbnails/$fname.png" ||:
|
||||||
done <<< "$filesToRemove"
|
done <<< "$filesToRemove"
|
||||||
@@ -58,7 +58,7 @@ in {
|
|||||||
mkdir -p .thumbnails
|
mkdir -p .thumbnails
|
||||||
images=$(find . -type f -not -path "./.thumbnails*")
|
images=$(find . -type f -not -path "./.thumbnails*")
|
||||||
|
|
||||||
while IFS= read fname; do
|
while IFS= read -r fname; do
|
||||||
# Skip this file if an up-to-date thumbnail already exists
|
# Skip this file if an up-to-date thumbnail already exists
|
||||||
if [ -f ".thumbnails/$fname.png" ] && \
|
if [ -f ".thumbnails/$fname.png" ] && \
|
||||||
[ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ]
|
[ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ]
|
||||||
@@ -67,7 +67,7 @@ in {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Creating thumbnail for $fname"
|
echo "Creating thumbnail for $fname"
|
||||||
mkdir -p $(dirname ".thumbnails/$fname")
|
mkdir -p "$(dirname ".thumbnails/$fname")"
|
||||||
magick -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||:
|
magick -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||:
|
||||||
touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png"
|
touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png"
|
||||||
done <<< "$images"
|
done <<< "$images"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ in
|
|||||||
rm "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ||:
|
rm "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ||:
|
||||||
ln -T "$OUT_FILE" "$STATE_DIRECTORY/mysql-dump-latest.sql.zst"
|
ln -T "$OUT_FILE" "$STATE_DIRECTORY/mysql-dump-latest.sql.zst"
|
||||||
|
|
||||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do
|
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt "${toString (rotations + 1)}" ]; do
|
||||||
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ in
|
|||||||
rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||:
|
rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||:
|
||||||
ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
|
ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
|
||||||
|
|
||||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do
|
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt "${toString (rotations + 1)}" ]; do
|
||||||
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ in
|
|||||||
sed -i -e 's/24/60/g' "$out/repo/icon.tmpl"
|
sed -i -e 's/24/60/g' "$out/repo/icon.tmpl"
|
||||||
'';
|
'';
|
||||||
in ''
|
in ''
|
||||||
install -Dm444 ${logo-svg} ${cfg.customDir}/public/assets/img/logo.svg
|
install -Dm444 ${logo-svg} "${cfg.customDir}/public/assets/img/logo.svg"
|
||||||
install -Dm444 ${logo-png} ${cfg.customDir}/public/assets/img/logo.png
|
install -Dm444 ${logo-png} "${cfg.customDir}/public/assets/img/logo.png"
|
||||||
install -Dm444 ${./loading.apng} ${cfg.customDir}/public/assets/img/loading.png
|
install -Dm444 ${./loading.apng} "${cfg.customDir}/public/assets/img/loading.png"
|
||||||
install -Dm444 ${extraLinks} ${cfg.customDir}/templates/custom/extra_links.tmpl
|
install -Dm444 ${extraLinks} "${cfg.customDir}/templates/custom/extra_links.tmpl"
|
||||||
install -Dm444 ${extraLinksFooter} ${cfg.customDir}/templates/custom/extra_links_footer.tmpl
|
install -Dm444 ${extraLinksFooter} "${cfg.customDir}/templates/custom/extra_links_footer.tmpl"
|
||||||
install -Dm444 ${project-labels} ${cfg.customDir}/options/label/project-labels.yaml
|
install -Dm444 ${project-labels} "${cfg.customDir}/options/label/project-labels.yaml"
|
||||||
|
|
||||||
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" ${cfg.customDir}/templates/
|
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" "${cfg.customDir}/templates/"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
fp,
|
|
||||||
lib,
|
|
||||||
values,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
./disk-config.nix
|
|
||||||
(fp /base)
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.network.networks."enp2s0" = values.defaultNetworkConfig // {
|
|
||||||
matchConfig.Name = "enp2s0";
|
|
||||||
address = with values.hosts.skrot; [
|
|
||||||
(ipv4 + "/25")
|
|
||||||
(ipv6 + "/64")
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
system.stateVersion = "26.05"; # Did you read the comment?
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
disko.devices = {
|
|
||||||
disk = {
|
|
||||||
main = {
|
|
||||||
device = "/dev/sda";
|
|
||||||
type = "disk";
|
|
||||||
content = {
|
|
||||||
type = "gpt";
|
|
||||||
partitions = {
|
|
||||||
ESP = {
|
|
||||||
type = "EF00";
|
|
||||||
size = "1G";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
mountOptions = [ "umask=0077" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
plainSwap = {
|
|
||||||
size = "8G";
|
|
||||||
content = {
|
|
||||||
type = "swap";
|
|
||||||
discardPolicy = "both";
|
|
||||||
resumeDevice = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
root = {
|
|
||||||
size = "100%";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "ext4";
|
|
||||||
mountpoint = "/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
@@ -81,7 +81,7 @@ in
|
|||||||
|
|
||||||
if [[ ! -f ''${REGISTRATION_FILE} ]]; then
|
if [[ ! -f ''${REGISTRATION_FILE} ]]; then
|
||||||
echo "No registration file found at '$REGISTRATION_FILE'"
|
echo "No registration file found at '$REGISTRATION_FILE'"
|
||||||
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE}
|
cp --no-preserve=mode,ownership "${baseConfig}" ''${REGISTRATION_FILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "After if statement"
|
echo "After if statement"
|
||||||
@@ -116,7 +116,7 @@ in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
shred -u ''${REGISTRATION_FILE}
|
shred -u ''${REGISTRATION_FILE}
|
||||||
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE}
|
cp --no-preserve=mode,ownership "${baseConfig}" ''${REGISTRATION_FILE}
|
||||||
|
|
||||||
${lib.getExe pkgs.jq} '.as_token = "'$AS_TOKEN'" | .hs_token = "'$HS_TOKEN'" | .ooye.discord_token = "'$DISCORD_TOKEN'" | .ooye.discord_client_secret = "'$DISCORD_CLIENT_SECRET'"' ''${REGISTRATION_FILE} > ''${REGISTRATION_FILE}.tmp
|
${lib.getExe pkgs.jq} '.as_token = "'$AS_TOKEN'" | .hs_token = "'$HS_TOKEN'" | .ooye.discord_token = "'$DISCORD_TOKEN'" | .ooye.discord_client_secret = "'$DISCORD_CLIENT_SECRET'"' ''${REGISTRATION_FILE} > ''${REGISTRATION_FILE}.tmp
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ in
|
|||||||
script = let
|
script = let
|
||||||
openssl = lib.getExe pkgs.openssl;
|
openssl = lib.getExe pkgs.openssl;
|
||||||
in lib.concatMapStringsSep "\n" ({ name, value }: ''
|
in lib.concatMapStringsSep "\n" ({ name, value }: ''
|
||||||
mkdir -p $(dirname "${value.certificate}") $(dirname "${value.certificateKey}")
|
mkdir -p "$(dirname "${value.certificate}")" "$(dirname "${value.certificateKey}")"
|
||||||
if ! ${openssl} x509 -checkend 86400 -noout -in ${value.certificate}
|
if ! ${openssl} x509 -checkend 86400 -noout -in "${value.certificate}"
|
||||||
then
|
then
|
||||||
echo "Regenerating '${value.certificate}'"
|
echo "Regenerating '${value.certificate}'"
|
||||||
${openssl} req \
|
${openssl} req \
|
||||||
|
|||||||
@@ -85,10 +85,6 @@ in rec {
|
|||||||
ipv4 = pvv-ipv4 235;
|
ipv4 = pvv-ipv4 235;
|
||||||
ipv6 = pvv-ipv6 235;
|
ipv6 = pvv-ipv6 235;
|
||||||
};
|
};
|
||||||
skrot = {
|
|
||||||
ipv4 = pvv-ipv4 237;
|
|
||||||
ipv6 = pvv-ipv6 237;
|
|
||||||
};
|
|
||||||
temmie = {
|
temmie = {
|
||||||
ipv4 = pvv-ipv4 167;
|
ipv4 = pvv-ipv4 167;
|
||||||
ipv6 = pvv-ipv6 167;
|
ipv6 = pvv-ipv6 167;
|
||||||
|
|||||||
Reference in New Issue
Block a user