diff options
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/rm/rmfakecloud/package.nix | 36 | ||||
-rw-r--r-- | pkgs/by-name/rm/rmfakecloud/webui.nix | 37 |
2 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/by-name/rm/rmfakecloud/package.nix b/pkgs/by-name/rm/rmfakecloud/package.nix new file mode 100644 index 0000000000000..44d7b02d721da --- /dev/null +++ b/pkgs/by-name/rm/rmfakecloud/package.nix @@ -0,0 +1,36 @@ +{ lib, fetchFromGitHub, buildGoModule, callPackage, enableWebui ? true }: + +buildGoModule rec { + pname = "rmfakecloud"; + version = "0.0.18"; + + src = fetchFromGitHub { + owner = "ddvk"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-J8oB5C5FYZTVq9zopHoL6WYpfTyiiyrQ4YSGu+2eaKw="; + }; + + vendorHash = "sha256-S43qNDAlDWhrkfSffCooveemR1Z7KXS18t97UoolgBM="; + + ui = callPackage ./webui.nix { inherit version src; }; + + postPatch = if enableWebui then '' + mkdir -p ui/build + cp -r ${ui}/* ui/build + '' else '' + sed -i '/go:/d' ui/assets.go + ''; + + ldflags = [ + "-s" "-w" "-X main.version=v${version}" + ]; + + meta = with lib; { + description = "Host your own cloud for the Remarkable"; + homepage = "https://ddvk.github.io/rmfakecloud/"; + license = licenses.agpl3Only; + maintainers = with maintainers; [ pacien martinetd ]; + mainProgram = "rmfakecloud"; + }; +} diff --git a/pkgs/by-name/rm/rmfakecloud/webui.nix b/pkgs/by-name/rm/rmfakecloud/webui.nix new file mode 100644 index 0000000000000..98c4822a90b3a --- /dev/null +++ b/pkgs/by-name/rm/rmfakecloud/webui.nix @@ -0,0 +1,37 @@ +{ version, src, stdenv, lib, fetchYarnDeps, fixup-yarn-lock, yarn, nodejs }: + +stdenv.mkDerivation rec { + inherit version src; + + pname = "rmfakecloud-webui"; + + yarnOfflineCache = fetchYarnDeps { + yarnLock = "${src}/ui/yarn.lock"; + sha256 = "sha256-JLCrpzytMKejmW+WlM6yybsoIZiimiJdPG5dSIn1L14="; + }; + + nativeBuildInputs = [ fixup-yarn-lock yarn nodejs ]; + + buildPhase = '' + export HOME=$(mktemp -d) + cd ui + fixup-yarn-lock yarn.lock + yarn config --offline set yarn-offline-mirror ${yarnOfflineCache} + yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress + patchShebangs node_modules + export PATH=$PWD/node_modules/.bin:$PATH + ./node_modules/.bin/react-scripts build + mkdir -p $out + cd .. + ''; + + installPhase = '' + cp -r ui/build/* $out + ''; + + meta = with lib; { + description = "Only the webui files for rmfakecloud"; + homepage = "https://ddvk.github.io/rmfakecloud/"; + license = licenses.agpl3Only; + }; +} |