Files
Fabric/flake.nix
Kayvan Sylvan 333c8cd363 feat: Nix: bundle yt-dlp with fabric package + fabric-slim variant
- rename original fabric package to fabricSlim
- create fabric package as symlinkJoin of fabricSlim and yt-dlp
- add fabric-slim output for the slim variant
- update default package to point to bundled fabric
- enhance fabric meta description to note yt-dlp inclusion
- set mainProgram to fabric in bundled package
2025-12-19 23:34:19 -08:00

108 lines
3.0 KiB
Nix

{
description = "Fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
systems,
treefmt-nix,
gomod2nix,
...
}:
let
forAllSystems = nixpkgs.lib.genAttrs (import systems);
getGoVersion = system: nixpkgs.legacyPackages.${system}.go_latest;
treefmtEval = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
treefmt-nix.lib.evalModule pkgs (
{ ... }:
{
imports = [ ./nix/treefmt.nix ];
# Set environment variable to prevent Go toolchain auto-download
settings.global.excludes = [ ];
}
)
);
in
{
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper);
checks = forAllSystems (system: {
formatting = treefmtEval.${system}.config.build.check self;
});
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
goVersion = getGoVersion system;
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv {
pwd = ./.;
go = goVersion;
};
in
import ./nix/shell.nix {
inherit pkgs goEnv goVersion;
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
}
);
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
goVersion = getGoVersion system;
fabricSlim = pkgs.callPackage ./nix/pkgs/fabric {
go = goVersion;
inherit self;
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
fabric = pkgs.symlinkJoin {
name = "fabric-${fabricSlim.version}";
inherit (fabricSlim) version;
paths = [
fabricSlim
pkgs.yt-dlp
];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/fabric \
--prefix PATH : $out/bin
'';
meta = fabricSlim.meta // {
description = "${fabricSlim.meta.description} (includes yt-dlp)";
mainProgram = "fabric";
};
};
in
{
default = fabric;
inherit fabric;
"fabric-slim" = fabricSlim;
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
}
);
};
}