Skip to content

Commit

Permalink
pkgs/{codium-reh -> vscodium-host}: add the web host
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Dec 27, 2024
1 parent 0cd052b commit cf53e07
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
build-packages:
strategy:
matrix:
package: [ ddns ]
package: [ ddns, vscodium-web-host, vscodium-remote-host ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
20 changes: 0 additions & 20 deletions pkgs/codium-reh/sources.json

This file was deleted.

10 changes: 10 additions & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@
codium-reh = pkgs.callPackage ./codium-reh { };
linux-fhs-python = pkgs.callPackage ./linux-fhs-python { };
ddns = pkgs.python3.pkgs.callPackage ./ddns { };
vscodium-remote-host = pkgs.callPackage ./vscodium-host {
pname = "vscodium-remote-host";
assetName = "vscodium-reh";
};

vscodium-web-host = pkgs.callPackage ./vscodium-host {
pname = "vscodium-web-host";
assetName = "vscodium-reh-web";
};

}
11 changes: 7 additions & 4 deletions pkgs/codium-reh/default.nix → pkgs/vscodium-host/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
fetchurl,
autoPatchelfHook,
gnutar,

pname,
assetName,
}:

let
inherit (stdenv.hostPlatform) system;
sources = builtins.fromJSON (builtins.readFile ./sources.json);
in
stdenv.mkDerivation {
pname = "vscodium-reh";
version = "1.95.3.24321";
inherit pname;
version = "1.96.2.24355";

sourceRoot = ".";

src = fetchurl sources."vscodium-reh".${system};
src = fetchurl sources.${assetName}.${system};

unpackPhase = ''
mkdir -p "$out"
Expand All @@ -31,5 +34,5 @@ stdenv.mkDerivation {
gnutar
];

passthru.updateScript = ./update-codium-reh.py;
passthru.updateScript = ./update.py;
}
38 changes: 38 additions & 0 deletions pkgs/vscodium-host/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"vscodium-reh": {
"x86_64-linux": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-linux-x64-1.96.2.24355.tar.gz",
"sha256": "1hc5xwqbmkv7bzziwvhwpdfv7zw4h6bclhwfcnbysq913027046c"
},
"aarch64-linux": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-linux-arm64-1.96.2.24355.tar.gz",
"sha256": "1i6rp6hg9d0xv4vrd8sjcj5qhraxbls8q2wdy0fl7gr3bbj6zaf8"
},
"x86_64-darwin": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-darwin-x64-1.96.2.24355.tar.gz",
"sha256": "082hprhriid23qsscn312bj8f899g8zxp3cbr5gzar4nhaff48ca"
},
"aarch64-darwin": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-darwin-arm64-1.96.2.24355.tar.gz",
"sha256": "13m0adp9aqqiy86psm3xhmms9yz3sn6sshhl02b9zlbc8by2ynlb"
}
},
"vscodium-reh-web": {
"x86_64-linux": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-web-linux-x64-1.96.2.24355.tar.gz",
"sha256": "0c7nqfvr3d0cij5dgi72a8r5gdhrxl2fpmyds24nrlz5r8f4p28h"
},
"aarch64-linux": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-web-linux-arm64-1.96.2.24355.tar.gz",
"sha256": "0vd2c13gxgd3asyb8cxg4wr7q9d9rwryy5hyizzdh15dn3h36kxc"
},
"x86_64-darwin": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-web-darwin-x64-1.96.2.24355.tar.gz",
"sha256": "0v2ww5gs713ynsx942fka69vb2r99yrrjqfip7w7rb3062r8qjy9"
},
"aarch64-darwin": {
"url": "https://github.com/VSCodium/vscodium/releases/download/1.96.2.24355/vscodium-reh-web-darwin-arm64-1.96.2.24355.tar.gz",
"sha256": "0jh2jrp0v4gv3pbk2xmszzw6afn1rkhlsw9j41jfvslp43a19sx8"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import subprocess
import re
import json
import requests


@dataclass
Expand Down Expand Up @@ -52,6 +51,8 @@ def prefetch(meta: VSCodiumMetadata):


def fetch_version_github(owner, repo):
import requests

response = requests.get(
f"https://github.com/{owner}/{repo}/releases/latest",
allow_redirects=False,
Expand All @@ -60,19 +61,26 @@ def fetch_version_github(owner, repo):


def main():
from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument("--version", default="latest")

args = parser.parse_args()

if args.version == "latest":
print("Fetching the latest version from github")
vscodium_ver = fetch_version_github("VSCodium", "vscodium")
else:
vscodium_ver = args.version

ROOT = os.path.dirname(os.path.realpath(__file__))
nix_path = os.path.join(ROOT, "default.nix")

if not os.path.isfile(nix_path):
print(f"ERROR: cannot find vscodium.nix in {ROOT}")
exit(1)

# Get the latest VSCodium version
vscodium_ver = os.environ.get(
"VSCODIUM_VERSION",
fetch_version_github("VSCodium", "vscodium"),
)

# Update the version in vscodium.nix
with open(nix_path, "r") as file:
content = file.read()
Expand All @@ -86,7 +94,7 @@ def main():

# Update hashes for various architectures
output = {}
for asset in ("vscodium-reh",):
for asset in ("vscodium-reh", "vscodium-reh-web"):
output[asset] = {}
for osname in ("linux", "darwin"):
for arch in ("x64", "arm64"):
Expand Down

0 comments on commit cf53e07

Please sign in to comment.