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   = "masto-fe-standalone";
  version = "0.0.0-${builtins.substring 0 6 rev}";
  rev     = "3481816b99ec9fb44e08cf0a5499ee3e2b78cc1c";

  src = applyPatches {
    src = fetchgit {
      url = "https://codeberg.org/superseriousbusiness/masto-fe-standalone";
      inherit rev;
      sha256 = "sha256-cfuaDFNfgmMoCJUMyermavqutxuTNRrpIdnlLQyXI7I=";
    };
    patches = [
      ./0001-set-a-default-instance.patch
      ./0002-update-default-state.patch
    ];
  };

  yarnOfflineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-OkjdQsq6DBZRVyoESCGR6xNnYnSO06E+ydbaBGtKG8w=";
  };

  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
  '';
}