Compare commits

..

No commits in common. "1a85ad210fb689309c3126d9cb107c980802f273" and "ec8d91536fbeb90a5e57fcb732f1ea70f62b8dbd" have entirely different histories.

7 changed files with 47 additions and 215 deletions

72
flake.lock generated
View file

@ -275,11 +275,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734279981, "lastModified": 1733318908,
"narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=", "narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785", "rev": "6f4e2a2112050951a314d2733a994fbab94864c6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -339,11 +339,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734344598, "lastModified": 1734043726,
"narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=", "narHash": "sha256-e9YAMReFV1fDPcZLFC2pa4k/8TloSXeX0z2VysNMAoA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "83ecd50915a09dca928971139d3a102377a8d242", "rev": "3066cc58f552421a2c5414e78407fa5603405b1e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -361,11 +361,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734093295, "lastModified": 1733484277,
"narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", "narHash": "sha256-i5ay20XsvpW91N4URET/nOc0VQWOAd4c4vbqYtcH8Rc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", "rev": "d00c6f6d0ad16d598bf7e2956f52c1d9d5de3c3a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -452,11 +452,11 @@
}, },
"nix-flatpak": { "nix-flatpak": {
"locked": { "locked": {
"lastModified": 1734128415, "lastModified": 1733863840,
"narHash": "sha256-HLwdVNxpuTsLlM3tCkpbQU6yCehdgf3kOS1G2SDlkzY=", "narHash": "sha256-OO/yx700wpyKjFmsNlxep57pUIVCA1OlfEN1qUrxgCY=",
"owner": "gmodena", "owner": "gmodena",
"repo": "nix-flatpak", "repo": "nix-flatpak",
"rev": "8bdc2540da516006d07b04019eb57ae0781a04b3", "rev": "eb6f90693f91a7ce082c0c2c78627049265bc599",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -472,11 +472,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734234111, "lastModified": 1733629314,
"narHash": "sha256-icEMqBt4HtGH52PU5FHidgBrNJvOfXH6VQKNtnD1aw8=", "narHash": "sha256-U0vivjQFAwjNDYt49Krevs1murX9hKBFe2Ye0cHpgbU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "311d6cf3ad3f56cb051ffab1f480b2909b3f754d", "rev": "f1e477a7dd11e27e7f98b646349cd66bbabf2fb8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -515,11 +515,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1734400565, "lastModified": 1733968579,
"narHash": "sha256-vfyvUlF1wVVXy/Au3fQpa8NMQbocg/oTgNuPS7MoesA=", "narHash": "sha256-Dy/VbXIX/QrZECXDj2nm2aFzxfX9c81v8WTGNqS8a84=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-vscode-extensions", "repo": "nix-vscode-extensions",
"rev": "c2efba4b42988d8573f914cad6431b5bd614935d", "rev": "bc2bfeeb438600386610c70aa37fb75ba390a569",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -578,11 +578,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1734119587, "lastModified": 1733759999,
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", "narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", "rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -607,11 +607,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1734412481, "lastModified": 1734047986,
"narHash": "sha256-U2CM2IisVgI+iKjkBw0KglyP7DwCIUwTBaz2bhMcTak=", "narHash": "sha256-Sgs+IBdeggoSPeiKHN40wW6/BgBDnersgdhLQK4fUR8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "30895485c3a31bb16ace513def4f3a36bfeb68c6", "rev": "d99bc6ebadce99dcb8b294c31fac96329b3bdf2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -629,11 +629,11 @@
"treefmt-nix": "treefmt-nix_2" "treefmt-nix": "treefmt-nix_2"
}, },
"locked": { "locked": {
"lastModified": 1734428898, "lastModified": 1734040021,
"narHash": "sha256-h/DZX8DkagqFNwqkfUQjwq3AulGj0QkLmtgy7vqKsE4=", "narHash": "sha256-nvuGMYd1+aTumHIUsbqCPSqYMFJ79dtoDch7wcq1MPE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "4cbefda7b0adf10110a901115222907910a9e8c4", "rev": "c0d4597c7b574ae59fcb0fd45966d760f3c70fc2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -652,11 +652,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1733773348, "lastModified": 1733411491,
"narHash": "sha256-Y47y+LesOCkJaLvj+dI/Oa6FAKj/T9sKVKDXLNsViPw=", "narHash": "sha256-315rJ7O9cOllPDaFscnJhcMleORHbxon0Kq9LAKJ5p4=",
"owner": "NuschtOS", "owner": "NuschtOS",
"repo": "search", "repo": "search",
"rev": "3051be7f403bff1d1d380e4612f0c70675b44fc9", "rev": "68e9fad70d95d08156cf10a030bd39487bed8ffe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -801,11 +801,11 @@
}, },
"staging-next": { "staging-next": {
"locked": { "locked": {
"lastModified": 1734427858, "lastModified": 1734177916,
"narHash": "sha256-4hGiE9xhSK7ZvBgCYbz0brucuJuy91UjbTn+AFkr4o8=", "narHash": "sha256-LOFqi+fqyev139weR+0W8YW2wasWZSDXPuVFM4HmYyo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "436a458fa7ebad39dab8f1fe730032ff330a2290", "rev": "145ffddb216135e76a32def79b19f46d1dcdbdc9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -868,11 +868,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1733761991, "lastModified": 1733440889,
"narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=", "narHash": "sha256-qKL3vjO+IXFQ0nTinFDqNq/sbbnnS5bMI1y0xX215fU=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085", "rev": "50862ba6a8a0255b87377b9d2d4565e96f29b410",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -62,11 +62,10 @@ in
order = [ order = [
"DuckDuckGo" "DuckDuckGo"
"Google (udm14)" "Google (udm14)"
"GitHub"
"ProtonDB"
"Nix Packages" "Nix Packages"
"Nix Options" "Nix Options"
"NixOS Wiki" "NixOS Wiki"
"ProtonDB"
"Modrinth Mods" "Modrinth Mods"
"Modrinth Modpacks" "Modrinth Modpacks"
"Modrinth Plugins" "Modrinth Plugins"
@ -86,6 +85,7 @@ in
"@g" "@g"
"@google" "@google"
"@udm14" "@udm14"
"udm14"
]; ];
}; };
"Nix Packages" = { "Nix Packages" = {
@ -107,6 +107,8 @@ in
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ definedAliases = [
"@np" "@np"
"pkgs"
"pkg"
]; ];
}; };
"Nix Options" = { "Nix Options" = {
@ -128,6 +130,8 @@ in
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ definedAliases = [
"@no" "@no"
"opts"
"opt"
]; ];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
@ -135,14 +139,7 @@ in
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ definedAliases = [
"@nw" "@nw"
]; "nix"
};
"GitHub" = {
urls = [ { template = "https://github.com/search?q={searchTerms}"; } ];
iconUpdateURL = "https://github.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = [
"@gh"
]; ];
}; };
"ProtonDB" = { "ProtonDB" = {
@ -151,6 +148,7 @@ in
updateInterval = 24 * 60 * 60 * 1000; # every day updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = [ definedAliases = [
"@pd" "@pd"
"proton"
]; ];
}; };
"Modrinth Mods" = { "Modrinth Mods" = {

View file

@ -49,7 +49,6 @@
iconTasks = { iconTasks = {
launchers = [ launchers = [
"applications:floorp.desktop" "applications:floorp.desktop"
"applications:ytmdesktop.desktop"
"applications:vesktop.desktop" "applications:vesktop.desktop"
"applications:steam.desktop" "applications:steam.desktop"
"applications:org.prismlauncher.PrismLauncher.desktop" "applications:org.prismlauncher.PrismLauncher.desktop"

View file

@ -185,6 +185,7 @@ rec {
adpyke.vscode-sql-formatter adpyke.vscode-sql-formatter
qwtel.sqlite-viewer qwtel.sqlite-viewer
yy0931.vscode-sqlite3-editor yy0931.vscode-sqlite3-editor
supermaven.supermaven # requires a supermaven subscription - https://supermaven.com/
leonardssh.vscord leonardssh.vscord
alefragnani.project-manager alefragnani.project-manager
mkhl.direnv mkhl.direnv
@ -199,10 +200,6 @@ rec {
formulahendry.auto-rename-tag formulahendry.auto-rename-tag
prunoideae.probejs prunoideae.probejs
d-koppenhagen.file-tree-to-text-generator d-koppenhagen.file-tree-to-text-generator
# Copilot
github.copilot
github.copilot-chat
]; ];
userSettings = { userSettings = {
"DO-NOT-EDIT-1" = "DO-NOT-EDIT-1" =
@ -427,7 +424,9 @@ rec {
"workbench.editorAssociations" = { "workbench.editorAssociations" = {
"*.db" = "sqlite3-editor.editor"; "*.db" = "sqlite3-editor.editor";
}; };
"vs-code-prettier-eslint.prettierLast" = false;
"typescript.updateImportsOnFileMove.enabled" = "always"; "typescript.updateImportsOnFileMove.enabled" = "always";
"supermaven.allowGitignore" = true;
"[javascript]" = { "[javascript]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"; "editor.defaultFormatter" = "esbenp.prettier-vscode";
}; };
@ -444,9 +443,6 @@ rec {
"[jsonc]" = { "[jsonc]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"; "editor.defaultFormatter" = "esbenp.prettier-vscode";
}; };
"github.copilot.enable" = {
"markdown" = true;
};
}; };
}; };
} }

View file

@ -57,7 +57,6 @@ let
ssh-to-age ssh-to-age
busybox busybox
nix-search nix-search
gh
python311 python311
python311Packages.python-lsp-server python311Packages.python-lsp-server

View file

@ -85,9 +85,6 @@
xontrib load direnv xontrib load direnv
xontrib load sh xontrib load sh
source-bash ${pkgs.nix-index}/etc/profile.d/command-not-found.sh source-bash ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
tmpfile = $(mktemp)
gh copilot alias -- bash > @(tmpfile)
source-bash @(tmpfile)
''; '';
package = pkgs.xonsh.override { package = pkgs.xonsh.override {
extraPackages = ps: [ extraPackages = ps: [

View file

@ -1,157 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell /etc/nixos/scripts/nix/python.nix -i python
import argparse
import os
import re
from pathlib import Path
from PIL import Image # type: ignore
image_path = Path("/home/cswimr/galaxypedia-image-export/consolidated/images")
target_path = Path("/home/cswimr/Projects/Galaxypedia/assets/images/ships")
name_separator_regex = r"[-|_|\s]?"
def copy_images(ship_name: str, fuzzy: bool = False) -> None:
ship_target_path = target_path / ship_name.replace(name_separator_regex, " ")
ship_target_path.mkdir(parents=True, exist_ok=True)
potential_image_tags: dict[str, str] = {
"icon": "icon",
"overview": "overview",
"trails": "trails",
"trails2": "trails2",
"trails3": "trails3",
"trails4": "trails4",
"trails5": "trails5",
"side": "side",
f"side{name_separator_regex}profile": "side",
"left": "left",
f"left{name_separator_regex}side": "left",
"right": "right",
f"right{name_separator_regex}side": "right",
"front": "front",
"back": "back",
"rear": "back",
"top": "top",
"topview": "top",
f"top{name_separator_regex}profile": "top",
"bottom": "bottom",
f"bottom{name_separator_regex}profile": "bottom",
"bott": "bottom",
f"under{name_separator_regex}profile": "bottom",
"warp": "warp",
"interior": "interior",
"int": "interior",
f"interior{name_separator_regex}alt": "interior-alt",
"interioralt": "interior-alt",
"interior1": "interior1",
"interior01": "interior1",
"interior2": "interior2",
"interior02": "interior2",
"interior3": "interior3",
"interior03": "interior3",
"interior4": "interior4",
"interior04": "interior4",
"interior5": "interior5",
"interior05": "interior5",
f"interior{name_separator_regex}left": "interior-left",
"interiorleft": "interior-left",
f"interior{name_separator_regex}right": "interior-right",
"interiorright": "interior-right",
f"interior{name_separator_regex}side1": "interior-side1",
f"interior{name_separator_regex}side2": "interior-side2",
f"interior{name_separator_regex}side3": "interior-side3",
f"interior{name_separator_regex}side4": "interior-side4",
f"interior{name_separator_regex}side5": "interior-side5",
f"bridge{name_separator_regex}side": "bridge-side",
"bridgeside": "bridge-side",
f"bridge{name_separator_regex}side1": "bridge-side1",
f"bridge{name_separator_regex}side2": "bridge-side2",
f"bridge{name_separator_regex}side3": "bridge-side3",
f"bridge{name_separator_regex}side4": "bridge-side4",
f"bridge{name_separator_regex}side5": "bridge-side5",
"hangaralt": "bay-alt",
"hangar": "bay",
"recolored": "recolored",
f"fighter{name_separator_regex}bay": "bay",
"bay1": "bay1",
"bay2": "bay2",
"bay3": "bay3",
"bay4": "bay4",
"bay5": "bay5",
"pilot": "pilot",
"pilotseat": "pilot",
"cockpit": "pilot",
"pilotroom": "pilotroom",
"hall": "hallway",
"hallway": "hallway",
"spinals": "spinals",
"torpedos": "spinals",
"torpedeos": "spinals",
}
pattern = re.compile(
rf"{'^' if not fuzzy else ''}(galaxy_)?{ship_name.lower()}{name_separator_regex}(?P<tag>{'|'.join(potential_image_tags.keys())})\.(png|webp|jpg|jpeg)$"
)
for image in image_path.glob("*"):
match = pattern.search(image.name.lower())
if match:
tag = potential_image_tags[
match.group("tag")
.lower()
.replace("-", "_")
.replace(" ", "_")
.replace("_", name_separator_regex)
]
with Image.open(image) as img:
if image.suffix.lower() in (".jpg", ".jpeg"):
print(f"{image.name} is lossy, skipping conversion!")
resulting_filename = f"{tag}.jpg"
img.save(ship_target_path / resulting_filename)
elif not image.suffix == ".webp":
resulting_filename = f"{tag}.webp"
img.save(
ship_target_path / resulting_filename,
format="WEBP",
lossless=True,
)
else:
resulting_filename = f"{tag}.webp"
img.save(ship_target_path / resulting_filename)
print(
f"Copied {image.name} to {ship_name.replace(name_separator_regex, ' ')}/{resulting_filename}"
)
dir_length = len(os.listdir(ship_target_path))
if dir_length == 0:
print(
f"No images found for {ship_name.replace(name_separator_regex, ' ')}, removing directory"
)
ship_target_path.rmdir()
else:
print(f"Copied {dir_length} images to {ship_target_path}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog=os.path.basename(__file__),
description="Copy images from the galaxypedia image export to the hugopedia assets directory.",
epilog=f"Example usage: {os.path.basename(__file__)} Deity",
)
parser.add_argument(
"ship_name",
help="The ship name to grab images for.",
)
parser.add_argument(
"--fuzzy",
"-f",
help="The path to the image directory to copy from.",
action="store_true",
)
args = parser.parse_args()
copy_images(
ship_name=args.ship_name.replace(" ", name_separator_regex), fuzzy=args.fuzzy
)