Replies: 3 comments
|
I mashed this together and have been using it without issue for about a month. I never noticed there should be a desktop version as I only really care for web-based apps for remote hosting :) Original snippetclone repo and add the flake there,{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ nixpkgs, ... }:
let
lib = nixpkgs.lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = lib.genAttrs systems;
version = "0.0.15";
mkT3code =
pkgs:
let
src = pkgs.fetchFromGitHub {
owner = "pingdotgg";
repo = "t3code";
rev = "f82bae16680206e4be20baf3d835941aa68611cf";
hash = "sha256-HOPiA8X/FzswKGmOuYKog3YIn5iq5rJ/7kDoGhN11x0=";
};
nodeModules = pkgs.stdenvNoCC.mkDerivation {
pname = "t3code-node_modules";
inherit version;
inherit src;
strictDeps = true;
nativeBuildInputs = [
pkgs.bun
pkgs.nodejs
pkgs.writableTmpDirAsHomeHook
];
dontConfigure = true;
dontFixup = true;
postPatch = ''
for packageJson in \
packages/contracts/package.json \
packages/shared/package.json
do
substituteInPlace "$packageJson" \
--replace-fail '"prepare": "effect-language-service patch",' '"prepare": "true",'
done
'';
buildPhase = ''
runHook preBuild
bun install \
--ignore-scripts \
--no-progress \
--frozen-lockfile \
--filter ./apps/server \
--filter ./apps/web \
--filter ./packages/contracts \
--filter ./packages/shared
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"
find . -type d -name node_modules -exec cp -R --parents {} "$out" \;
runHook postInstall
'';
outputHash = "sha256-cOI7vID7tqLQMUJ2iUH4fOQI2EBZwu8T3tax6Y3UTkQ=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
in
pkgs.stdenv.mkDerivation {
pname = "t3code";
inherit version;
inherit src;
strictDeps = true;
nativeBuildInputs = [
pkgs.bun
pkgs.makeBinaryWrapper
pkgs.node-gyp
pkgs.nodejs
pkgs.python3
pkgs.writableTmpDirAsHomeHook
];
configurePhase = ''
runHook preConfigure
cp -R ${nodeModules}/. .
chmod -R u+rwX node_modules
patchShebangs node_modules
cd node_modules/.bun/node-pty@*/node_modules/node-pty
node-gyp rebuild
node scripts/post-install.js
cd "$NIX_BUILD_TOP/$sourceRoot"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
bun run --cwd apps/web build
bun run --cwd apps/server build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/libexec/t3code/apps/server"
cp -R --no-preserve=mode node_modules "$out/libexec/t3code/"
cp -R --no-preserve=mode apps/server/{node_modules,dist} "$out/libexec/t3code/apps/server/"
rm -f \
"$out/libexec/t3code/apps/server/node_modules/@t3tools/contracts" \
"$out/libexec/t3code/apps/server/node_modules/@t3tools/shared" \
"$out/libexec/t3code/apps/server/node_modules/@t3tools/web"
for wsDir in "$out"/libexec/t3code/node_modules/.bun/ws@*/node_modules/ws; do
ln -s "$wsDir" "$out/libexec/t3code/apps/server/node_modules/ws"
break
done
makeWrapper ${lib.getExe pkgs.nodejs} "$out/bin/t3" \
--add-flags "$out/libexec/t3code/apps/server/dist/index.mjs"
runHook postInstall
'';
};
in
{
packages = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
t3code = mkT3code pkgs;
}
);
};
}I then made an alternative flake, just to experiment which I try to add options to enable more binaries like gitlab, jujutsu etc. using options: t3code.override {
enableClaude = true;
enableJujutsu = true;
enableAzureDevOps = true;
} |
0 replies
|
bump to 0.23: flake.nix slight changes required due to updated project structure...: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
As a Nixos user, I wanted this lovely application to work nicely on my system. It was important to me to be able to make it declarative. Hence, I created a flake to make this possible. I'm still ironing things out but I was able to install the desktop version (AppImage) on my system and make it discoverable with launchers. I'm still working on the t3 (local browser) version and I want be able to provide it on arm as well for darwin-nix users.
Here is the link: https://github.com/Sawrz/t3code-nix
@t3dotgg @juliusmarminge If you want to provide the flake by yourself and maintain it, I don't mind and would transfer the repo to you guys. The only thing I care, is to use this lovely application on my system =)
Thank you for making t3code open-source and allowing other developers increasing their productivity. Today is like christmas and I'm five again!
All reactions