Skip to content

Instantly share code, notes, and snippets.

@piq9117
Created May 25, 2026 17:28
Show Gist options
  • Select an option

  • Save piq9117/1c322f876dfae48185aa6d677e85fefc to your computer and use it in GitHub Desktop.

Select an option

Save piq9117/1c322f876dfae48185aa6d677e85fefc to your computer and use it in GitHub Desktop.
ollama dev env
{
description = "ollama dev";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
outputs = {self, nixpkgs}:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
nixpkgsFor = forAllSystems(system: import nixpkgs {
inherit system;
});
in {
packages = forAllSystems(system:
let
pkgs = nixpkgsFor.${system};
in {
generate-api = pkgs.writeScriptBin "generate-api" ''
GITROOT=$(git rev-parse --show-toplevel)
rm -rf $GITROOT/ollama/generated || true
mkdir $GITROOT/ollama/generated
${pkgs.oapi-codegen}/bin/oapi-codegen -package ollama_openapi -generate types,gin $GITROOT/ollama/docs/openapi.yaml > $GITROOT/ollama/generated/ollama_openapi.go
'';
});
devShells = forAllSystems(system:
let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
self.packages.${system}.generate-api
go
gopls
golangci-lint
delve
];
shellHook = ''
export PS1='[$PWD]\n❄ '
'';
};
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment