ctucx.git: nixfiles

ctucx' nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 { applyPatches, fetchgit, fetchYarnDeps, lib, stdenv, nodejs, yarn, yarn2nix-moretea, ... }:

stdenv.mkDerivation rec {
  pname   = "mastoFE-standalone";
  version = "0.0.0-${builtins.substring 0 6 rev}";
  rev     = "3962700726f58d946d5a6eed9e9bea63b8c2eb04";

  src = applyPatches {
    src = fetchgit {
      url = "https://iceshrimp.dev/iceshrimp/masto-fe-standalone";
      inherit rev;
      sha256 = "sha256-ed6qb5IiqHQEtGHbexqivf+x4aF1JYBZKPKtG5Ao6Gg";
    };
    patches = [
      ./0001-public-auth.js-hardcode-instance-url.patch
    ];
  };

  yarnOfflineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-ddEx2aBshkq83zcycOHUqg/CteCJTiE0jb3LCZdj5Z8=";
  };

  nativeBuildInputs = [
    nodejs
    yarn
    yarn2nix-moretea.fixup_yarn_lock
  ];

  configurePhase = ''
    export HOME=$(mktemp -d)
  '';

  buildPhase = ''
    export NODE_OPTIONS=--openssl-legacy-provider

    yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
    fixup_yarn_lock yarn.lock
    yarn install --offline \
      --frozen-lockfile \
      --ignore-engines --ignore-scripts
    patchShebangs .

    yarn build:production
  '';

  installPhase = ''
    cp -R ./public $out
  '';

}