From 5a0ca845340dd6f8d9f56b015c5a32903c43c5c5 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 27 Feb 2026 23:24:56 +0100 Subject: [PATCH 1/4] fc-scripts: more fine-grained packaging It makes sense to put each individual script into its own derivation, as some of the scripts require certain other dependencies that others don't. --- home/modules/packages.nix | 8 ++++- packages/fc-scripts.nix | 76 ++++++++++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 13 deletions(-) diff --git a/home/modules/packages.nix b/home/modules/packages.nix index 3c9583d..c23ea80 100644 --- a/home/modules/packages.nix +++ b/home/modules/packages.nix @@ -85,8 +85,14 @@ let nix-output-monitor # putting this here as a plain `nix` alternative - fc-scripts # this might turn out to be useful even in non-work environments? ] + ++ (with fc-scripts; [ + + git-tree-sync + ssh-multi-proxy + mosh-tunnel + mosh-dualstack-proxy # this might turn out to be useful even in non-work environments? + ]) ++ lib.optionals pkgs.stdenv.isLinux [ xclip smbnetfs # for FUSE smb mounting diff --git a/packages/fc-scripts.nix b/packages/fc-scripts.nix index f8725ed..f360471 100644 --- a/packages/fc-scripts.nix +++ b/packages/fc-scripts.nix @@ -1,27 +1,79 @@ { + lib, fetchFromGitHub, - runCommand, python3, stdenvNoCC, + makeWrapper, + git, + openssh, + mosh, }: -stdenvNoCC.mkDerivation { - pname = "fc-scripts"; - version = "20260202"; +let src = fetchFromGitHub { owner = "flyingcircusio"; repo = "scripts"; rev = "887f066006829fc3ee44b3cfbe748c578ea2e7c1"; hash = "sha256-mrL/dULb0NKw8cH9ferzfDdRjhWANrWQg/u7FNCtzWw="; }; + version = "20260202"; + mkFcScriptDrv = + { + pname, + propagatedBuildInputs, + ... + }@args: + stdenvNoCC.mkDerivation (finalAttrs: { + inherit (args) + pname + propagatedBuildInputs + ; + inherit src version; # not passed via function args, but can be overridden later via overrideAttrs + dontBuild = true; + dontConfigure = true; + buildInputs = [ python3 ]; + nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ python3 ]; - dontBuild = true; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall + mkdir -p $out/bin + install -m 0755 ${pname}* $out/bin/${pname} + '' + + lib.optionalString (finalAttrs.propagatedBuildInputs != [ ]) '' + wrapProgram $out/bin/${pname} --prefix PATH : \ + ${lib.makeBinPath finalAttrs.propagatedBuildInputs} + '' + + "runHook postInstall"; - mkdir -p $out/bin - cp *.py $out/bin/ + meta.mainProgram = pname; + }); +in +{ + git-tree-sync = mkFcScriptDrv { + pname = "git-tree-sync"; + propagatedBuildInputs = [ + git + openssh + ]; + }; + ssh-multi-proxy = mkFcScriptDrv { + pname = "ssh-multi-proxy"; + propagatedBuildInputs = [ openssh ]; + }; + mosh-tunnel = mkFcScriptDrv { + pname = "mosh-tunnel"; + propagatedBuildInputs = [ + (python3.withPackages (ps: [ ps.asyncio-dgram ])) + mosh + openssh + ]; + }; + mosh-dualstack-proxy = mkFcScriptDrv { + pname = "mosh-dualstack-proxy"; + propagatedBuildInputs = [ + python3 + mosh + openssh + ]; + }; - runHook postInstall - ''; } From 5acb380fc01abacddf91dc52ff036b7cbfb6a872 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 27 Feb 2026 23:36:23 +0100 Subject: [PATCH 2/4] home/git: add alias for `git tree-sync sync` I decided to implement this as a shell alias, to allow directly referencing the package here instead of relying on it to be in path. --- home/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/common.nix b/home/common.nix index 1bce7b0..2203fbe 100644 --- a/home/common.nix +++ b/home/common.nix @@ -47,6 +47,7 @@ programs.git = { enable = true; settings = { + alias.ts = "!${lib.getExe pkgs.fc-scripts.git-tree-sync} sync"; credential.helper = "cache"; push.default = "simple"; push.forceIfIncludes = true; # avoid accidental force overrides when remote is autofetched in background From a87738a2ff6b7207ada783444cc15b3aa632c116 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 27 Feb 2026 23:24:56 +0100 Subject: [PATCH 3/4] fc-scripts: more fine-grained packaging It makes sense to put each individual script into its own derivation, as some of the scripts require certain other dependencies that others don't. --- home/modules/packages.nix | 8 +++- packages/fc-scripts.nix | 77 +++++++++++++++++++++++++++++++++------ 2 files changed, 72 insertions(+), 13 deletions(-) diff --git a/home/modules/packages.nix b/home/modules/packages.nix index 3c9583d..c23ea80 100644 --- a/home/modules/packages.nix +++ b/home/modules/packages.nix @@ -85,8 +85,14 @@ let nix-output-monitor # putting this here as a plain `nix` alternative - fc-scripts # this might turn out to be useful even in non-work environments? ] + ++ (with fc-scripts; [ + + git-tree-sync + ssh-multi-proxy + mosh-tunnel + mosh-dualstack-proxy # this might turn out to be useful even in non-work environments? + ]) ++ lib.optionals pkgs.stdenv.isLinux [ xclip smbnetfs # for FUSE smb mounting diff --git a/packages/fc-scripts.nix b/packages/fc-scripts.nix index f8725ed..0fb4926 100644 --- a/packages/fc-scripts.nix +++ b/packages/fc-scripts.nix @@ -1,27 +1,80 @@ { + lib, fetchFromGitHub, - runCommand, python3, stdenvNoCC, + makeWrapper, + git, + openssh, + mosh, }: -stdenvNoCC.mkDerivation { - pname = "fc-scripts"; - version = "20260202"; +let src = fetchFromGitHub { owner = "flyingcircusio"; repo = "scripts"; rev = "887f066006829fc3ee44b3cfbe748c578ea2e7c1"; hash = "sha256-mrL/dULb0NKw8cH9ferzfDdRjhWANrWQg/u7FNCtzWw="; }; + version = "20260202"; + mkFcScriptDrv = + { + pname, + propagatedBuildInputs, + python ? python3, + ... + }@args: + stdenvNoCC.mkDerivation (finalAttrs: { + inherit (args) + pname + propagatedBuildInputs + ; + inherit src version; # not passed via function args, but can be overridden later via overrideAttrs + dontBuild = true; + dontConfigure = true; + buildInputs = [ python ]; # the python interpreter utilised by patchShebangs + nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ python3 ]; - dontBuild = true; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall + mkdir -p $out/bin + install -m 0755 ${pname}* $out/bin/${pname} + '' + + lib.optionalString (finalAttrs.propagatedBuildInputs != [ ]) '' + wrapProgram $out/bin/${pname} --prefix PATH : \ + ${lib.makeBinPath finalAttrs.propagatedBuildInputs} + '' + + "runHook postInstall"; - mkdir -p $out/bin - cp *.py $out/bin/ + meta.mainProgram = pname; + }); +in +{ + git-tree-sync = mkFcScriptDrv { + pname = "git-tree-sync"; + propagatedBuildInputs = [ + git + openssh + ]; + }; + ssh-multi-proxy = mkFcScriptDrv { + pname = "ssh-multi-proxy"; + propagatedBuildInputs = [ openssh ]; + }; + mosh-tunnel = mkFcScriptDrv { + pname = "mosh-tunnel"; + propagatedBuildInputs = [ + mosh + openssh + ]; + python = python3.withPackages (ps: [ ps.asyncio-dgram ]); + }; + mosh-dualstack-proxy = mkFcScriptDrv { + pname = "mosh-dualstack-proxy"; + propagatedBuildInputs = [ + python3 + mosh + openssh + ]; + }; - runHook postInstall - ''; } From 5e489fb7c89455f603b86457d927821c6095b9db Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 27 Feb 2026 23:36:23 +0100 Subject: [PATCH 4/4] home/git: add alias for `git tree-sync sync` I decided to implement this as a shell alias, to allow directly referencing the package here instead of relying on it to be in path. --- home/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/common.nix b/home/common.nix index 1bce7b0..2203fbe 100644 --- a/home/common.nix +++ b/home/common.nix @@ -47,6 +47,7 @@ programs.git = { enable = true; settings = { + alias.ts = "!${lib.getExe pkgs.fc-scripts.git-tree-sync} sync"; credential.helper = "cache"; push.default = "simple"; push.forceIfIncludes = true; # avoid accidental force overrides when remote is autofetched in background