Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surfingkeys is broken #99

Open
NoRePercussions opened this issue Sep 24, 2024 · 1 comment
Open

Surfingkeys is broken #99

NoRePercussions opened this issue Sep 24, 2024 · 1 comment

Comments

@NoRePercussions
Copy link
Collaborator

Surfingkeys broke while being updated to MV3.

This also brings to my attention that I'd prefer to build from source for an extension that can log my keystrokes.

A dream2nix configuration for the chrome extension is attached in the comments, but I may think about how I want to actually include it. Potentially it is time for my own NUR instance.

@NoRePercussions
Copy link
Collaborator Author

flake.nix

{
  description = "Surfingkeys extension builder";

  inputs = {
    dream2nix.url = "github:nix-community/dream2nix";
    nixpkgs.follows = "dream2nix/nixpkgs";
  };

  outputs = {
    self,
    dream2nix,
    nixpkgs,
  }: let
    eachSystem = nixpkgs.lib.genAttrs [
      "aarch64-darwin"
      "aarch64-linux"
      "x86_64-darwin"
      "x86_64-linux"
    ];
  in {
    packages = eachSystem (system: {
      default = dream2nix.lib.evalModules {
        packageSets.nixpkgs = nixpkgs.legacyPackages.${system};
        modules = [
          ./default.nix
          {
            paths.projectRoot = ./.;
            paths.projectRootFile = "flake.nix";
            paths.package = ./.;
          }
        ];
      };
    });
  };
}

default.nix

{
  lib,
  config,
  dream2nix,
  ...
}: {
  imports = [
    dream2nix.modules.dream2nix.nodejs-package-json-v3
    dream2nix.modules.dream2nix.nodejs-granular-v3
  ];

  mkDerivation = {
    src = builtins.fetchGit {
      shallow = true;
      url = "https://github.com/brookhong/Surfingkeys";
      rev = "965301c079852f9d310145d823628d107e940588";
    };

    # by default we run `npm build` in buildPhaseNodejs,
    # which runs tests which fail without chromium
    preBuildPhases = lib.mkForce [];
    buildPhase = ''
      npm run build:prod
    '';

    preInstallPhases = lib.mkForce [];
    installPhase = ''
      mkdir -p "''${out}"
      cp -r "''${nodeModules}/surfingkeys/dist/production/chrome/." "''${out}"
    '';
  };

  deps = {nixpkgs, ...}: {
    inherit
      (nixpkgs)
      fetchFromGitHub
      stdenv
      ;
  };

  nodejs-granular-v3.overrides.puppeteer.env.PUPPETEER_SKIP_DOWNLOAD = 1;

  name = "surfingkeys";
  version = "0.0.0";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant