Skip to content

Commit

Permalink
Merge pull request #581 from jim3692/add-flake
Browse files Browse the repository at this point in the history
Add flake
  • Loading branch information
ericcurtin authored Jan 12, 2025
2 parents cdd1369 + f715a32 commit 7b5e3ce
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
};

outputs = { self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

mkRamalama = pkgs: with pkgs;
callPackage
(
{ ramalamaOverrides ? { }
, llamaCppOverrides ? { }
}:
python3Packages.buildPythonPackage ({
name = "ramalama";
src = ./.;
dependencies = [ (llama-cpp.override llamaCppOverrides) ];
} // ramalamaOverrides)
)
{ llamaCppOverrides.vulkanSupport = true; }
;

ramalama = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
package = mkRamalama pkgs;
in {
inherit package;
app = {
type = "app";
program = toString (pkgs.writeShellScript "ramalama" "${package}/bin/ramalama \"$@\"");
};
}
);
in {
packages = forAllSystems (system: {
ramalama = ramalama.${system}.package;
default = ramalama.${system}.package;
});

apps = forAllSystems (system :{
ramalama = ramalama.${system}.app;
default = ramalama.${system}.app;
});
};
}

0 comments on commit 7b5e3ce

Please sign in to comment.