diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06ba3ff..38553de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,3 +35,33 @@ jobs: fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + nix-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v30 + + - name: Evaluate Nix package + run: | + nix-instantiate --eval --strict -E 'let pkgs = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-24.05.tar.gz") {}; in pkgs.callPackage ./nix/imgfloat-client.nix {}' > /dev/null + + debian-package: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - run: npm ci + + - name: Build Debian package + run: npx electron-builder --linux deb --publish=never diff --git a/README.md b/README.md index 64fd037..09a5cc0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ # Client Electron based desktop client for viewing the imgfloat broadcast dashboard. - -## "Why not use a web source?" - -TODO diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..f7a37d0 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,3 @@ +{ pkgs ? import { } }: + +pkgs.callPackage ./imgfloat-client.nix { } diff --git a/nix/imgfloat-client.nix b/nix/imgfloat-client.nix new file mode 100644 index 0000000..f080c21 --- /dev/null +++ b/nix/imgfloat-client.nix @@ -0,0 +1,48 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +, makeWrapper +, electron +}: + +buildNpmPackage rec { + pname = "imgfloat-client"; + version = "1.0.5"; + + src = fetchFromGitHub { + owner = "imgfloat"; + repo = "client"; + rev = "v${version}"; + hash = lib.fakeSha256; + }; + + npmDepsHash = lib.fakeSha256; + npmBuild = false; + npmFlags = [ "--ignore-scripts" ]; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ electron ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/imgfloat + cp -R src res package.json node_modules $out/share/imgfloat/ + + mkdir -p $out/bin + makeWrapper ${lib.getExe electron} $out/bin/imgfloat \ + --add-flags $out/share/imgfloat/src/main.js \ + --set-default ELECTRON_IS_DEV 0 + + runHook postInstall + ''; + + meta = with lib; { + description = "Electron based desktop client for viewing the imgfloat broadcast dashboard"; + homepage = "https://github.com/imgfloat/client"; + license = licenses.mit; + mainProgram = "imgfloat"; + platforms = platforms.linux; + maintainers = []; + }; +}