Unverified Commit 1ec2917c authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

Merge pull request #211022 from LostAttractor/kuro

kuro: init at 9.0.0
parents 4fba3511 76fc5cb1
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, mkYarnPackage
, electron
}:

mkYarnPackage rec {
  pname = "kuro";
  version = "9.0.0";

  src = fetchFromGitHub {
    owner = "davidsmorais";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-9Z/r5T5ZI5aBghHmwiJcft/x/wTRzDlbIupujN2RFfU=";
  };

  packageJSON = ./package.json;
  yarnLock = ./yarn.lock;
  yarnNix = ./yarn.nix;

  ELECTRON_SKIP_BINARY_DOWNLOAD = "1";

  nativeBuildInputs = [
    makeWrapper
    copyDesktopItems
  ];

  postBuild = ''
    pushd deps/kuro

    yarn --offline run electron-builder \
      --dir \
      -c.electronDist=${electron}/lib/electron \
      -c.electronVersion=${electron.version}

    popd
  '';

  installPhase = ''
    runHook preInstall

    # resources
    mkdir -p "$out/share/lib/kuro"
    cp -r ./deps/kuro/dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/kuro"

    # icons
    install -Dm644 ./deps/kuro/static/Icon.png $out/share/icons/hicolor/1024x1024/apps/kuro.png

    # executable wrapper
    makeWrapper '${electron}/bin/electron' "$out/bin/kuro" \
      --add-flags "$out/share/lib/kuro/resources/app.asar" \
      --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
      --inherit-argv0

    runHook postInstall
  '';
  # Do not attempt generating a tarball for contents again.
  # note: `doDist = false;` does not work.
  distPhase = "true";

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      exec = pname;
      icon = pname;
      desktopName = "Kuro";
      genericName = "Microsoft To-Do Client";
      comment = meta.description;
      categories = [ "Office" ];
      startupWMClass = pname;
    })
  ];

  meta = with lib; {
    description = "An unofficial, featureful, open source, community-driven, free Microsoft To-Do app";
    homepage = "https://github.com/davidsmorais/kuro";
    license = licenses.mit;
    maintainers = with maintainers; [ ChaosAttractor ];
    inherit (electron.meta) platforms;
  };
}
+149 −0
Original line number Diff line number Diff line
{
  "name": "kuro",
  "productName": "Kuro",
  "version": "9.0.0",
  "description": "Elegant Microsoft To-Do desktop app (Ao fork)",
  "license": "MIT",
  "repository": "davidsmorais/kuro",
  "author": {
    "name": "davidsmorais",
    "email": "david@dsmorais.com",
    "url": "https://github.com/davidsmorais"
  },
  "maintainers": [
    {
      "name": "davidsmorais",
      "email": "david@dsmorais.com",
      "url": "https://github.com/davidsmorais"
    }
  ],
  "scripts": {
    "postinstall": "electron-builder install-app-deps",
    "icons": "electron-icon-maker --input=./static/Icon.png --output=./build/",
    "test": "xo && stylelint 'src/style/*.css'",
    "release": "yarn version && rm -rf dist build && yarn icons && electron-builder --publish never",
    "build-snap": "electron-builder --linux snap",
    "build-win": "electron-builder --win",
    "start": "electron ."
  },
  "dependencies": {
    "auto-launch": "^5.0.1",
    "electron-context-menu": "^3.6.1",
    "electron-debug": "^1.4.0",
    "electron-dl": "^2.0.0",
    "electron-store": "^8.1.0",
    "lodash": "^4.17.21"
  },
  "devDependencies": {
    "electron": "^22.1.0",
    "electron-builder": "^23.6.0",
    "electron-icon-maker": "^0.0.5",
    "stylelint": "^14.9.1",
    "xo": "^0.53.1"
  },
  "xo": {
    "envs": [
      "browser",
      "node"
    ],
    "rules": {
      "n/prefer-global/process": 0,
      "unicorn/prefer-module": 0,
      "unicorn/no-for-loop": 0,
      "unicorn/no-array-for-each": 0,
      "import/extensions": 0,
      "object-curly-spacing": 0,
      "quote-props": 0,
      "unicorn/prefer-query-selector": 0,
      "quotes": [
        "error",
        "double"
      ]
    },
    "space": 2
  },
  "stylelint": {
    "rules": {
      "block-closing-brace-empty-line-before": "never",
      "block-closing-brace-newline-after": "always",
      "block-no-empty": true,
      "block-opening-brace-space-before": "always",
      "color-hex-case": "upper",
      "color-hex-length": "long",
      "color-no-invalid-hex": true,
      "comment-no-empty": true,
      "declaration-block-semicolon-space-before": "never",
      "indentation": 2,
      "max-empty-lines": 0,
      "no-duplicate-selectors": true
    }
  },
  "build": {
    "appId": "com.davidsmorais.kuro",
    "snap": {
      "title": "Kuro"
    },
    "files": [
      "**/*",
      "!media${/*}",
      "!docs${/*}"
    ],
    "win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64"
          ]
        }
      ],
      "icon": "icons/win/icon.ico",
      "publish": {
        "provider": "github",
        "releaseType": "release"
      }
    },
    "linux": {
      "category": "Office",
      "icon": "icons/png",
      "description": "Kuro is an unofficial, featureful, open source, community-driven, free Microsoft To-Do app, used by people in more than 120 countries. (Ao fork)",
      "synopsis": "Elegant Microsoft To-Do desktop app (Ao fork)",
      "publish": {
        "provider": "github",
        "releaseType": "release"
      },
      "target": [
        {
          "target": "AppImage",
          "arch": [
            "x64"
          ]
        },
        {
          "target": "deb",
          "arch": [
            "x64"
          ]
        },
        {
          "target": "pacman",
          "arch": [
            "x64"
          ]
        },
        {
          "target": "rpm",
          "arch": [
            "x64"
          ]
        },
        {
          "target": "snap",
          "arch": [
            "x64"
          ]
        }
      ]
    }
  }
}
+5757 −0

File added.

Preview size limit exceeded, changes collapsed.

+6485 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -31556,6 +31556,10 @@ with pkgs;
  kupfer = callPackage ../applications/misc/kupfer { };
  kuro = callPackage ../applications/misc/kuro {
    electron = electron_22;
  };
  kvirc = libsForQt5.callPackage ../applications/networking/irc/kvirc { };
  lame = callPackage ../development/libraries/lame { };