ctucx.git: nixfiles

ctucx' nixfiles

commit ca4947ba3902b6dce477b81c1306a0898fb9ed5e
parent f944167679c1ba247dc2fb620ba151eaecf5a972
Author: Katja (ctucx) <git@ctu.cx>
Date: Sat, 4 Jan 2025 16:53:23 +0100

pkgs: add `masto-fe-standalone`
4 files changed, 115 insertions(+), 1 deletion(-)
A
pkgs/masto-fe-standalone/0001-set-a-default-instance.patch
|
25
+++++++++++++++++++++++++
A
pkgs/masto-fe-standalone/0002-update-default-state.patch
|
36
++++++++++++++++++++++++++++++++++++
A
pkgs/masto-fe-standalone/default.nix
|
52
++++++++++++++++++++++++++++++++++++++++++++++++++++
M
pkgs/overlay.nix
|
3
++-
diff --git a/pkgs/masto-fe-standalone/0001-set-a-default-instance.patch b/pkgs/masto-fe-standalone/0001-set-a-default-instance.patch
@@ -0,0 +1,25 @@
+From 27c2c0ab2a37b3e36ca47a29ee8f4cdb807dd8e1 Mon Sep 17 00:00:00 2001
+From: "Katja (ctucx)" <git@ctu.cx>
+Date: Sat, 4 Jan 2025 01:01:49 +0100
+Subject: [PATCH 1/2] set a default instance
+
+---
+ public/login.html | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/public/login.html b/public/login.html
+index 5f07ba8b8..d3b7b25bd 100644
+--- a/public/login.html
++++ b/public/login.html
+@@ -6,7 +6,7 @@
+     <script src="/auth.js"></script>
+ </head>
+ <body>
+-<input type="text" id="instance" placeholder="yourinstance.tld">
++<input type="text" id="instance" placeholder="yourinstance.tld" value="https://zuggeschmack.de">
+ <button onclick="auth()" id="btn">Log in</button>
+ <span id="message"></span>
+ </body>
+-- 
+2.47.0
+
diff --git a/pkgs/masto-fe-standalone/0002-update-default-state.patch b/pkgs/masto-fe-standalone/0002-update-default-state.patch
@@ -0,0 +1,36 @@
+From c9b95daed5bb9e199740781be81826f87cdde8b0 Mon Sep 17 00:00:00 2001
+From: "Katja (ctucx)" <git@ctu.cx>
+Date: Sat, 4 Jan 2025 01:51:48 +0100
+Subject: [PATCH 2/2] update default state
+
+---
+ app/javascript/flavours/glitch/reducers/local_settings.js | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/app/javascript/flavours/glitch/reducers/local_settings.js b/app/javascript/flavours/glitch/reducers/local_settings.js
+index 39a910ef6..e62ea5c48 100644
+--- a/app/javascript/flavours/glitch/reducers/local_settings.js
++++ b/app/javascript/flavours/glitch/reducers/local_settings.js
+@@ -6,8 +6,8 @@ import { LOCAL_SETTING_CHANGE, LOCAL_SETTING_DELETE } from 'flavours/glitch/acti
+ import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
+ 
+ const initialState = ImmutableMap({
+-  layout    : 'mobile',
+-  stretch   : true,
++  layout    : 'single',
++  stretch   : false,
+   side_arm  : 'none',
+   side_arm_reply_mode : 'keep',
+   show_reply_count : false,
+@@ -63,7 +63,7 @@ const initialState = ImmutableMap({
+     media:      true,
+     visibility: true,
+   }),
+-  theme: 'mastodon-light',
++  theme: 'mastodon',
+ });
+ 
+ const hydrate = (state, localSettings) => state.mergeDeep(localSettings);
+-- 
+2.47.0
+
diff --git a/pkgs/masto-fe-standalone/default.nix b/pkgs/masto-fe-standalone/default.nix
@@ -0,0 +1,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
+  '';
+}+
\ No newline at end of file
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
@@ -17,5 +17,6 @@ final: prev:
 
   usbtan-cli               = final.callPackage ./usbtan-cli {};
   rofi-iwd-wifi-menu       = final.callPackage ./rofi-iwd-wifi-menu.nix {};
-  minecraft-bedrock-server = final.callPackage ./minecraft-bedrock-server.nix {};
+
+  masto-fe-standalone      = final.callPackage ./masto-fe-standalone {};
 }