Add flake #1

Merged
brian.mckenna merged 2 commits from flake into main 2026-02-15 12:30:51 +00:00
3 changed files with 160 additions and 12 deletions
Showing only changes of commit 85fd3adec4 - Show all commits

View File

@ -20,18 +20,7 @@ jobs:
(github.event_name == 'issue_comment' && github.event.issue.pull_request) (github.event_name == 'issue_comment' && github.event.issue.pull_request)
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Claude Code CLI
run: curl -fsSL https://claude.ai/install.sh | bash
- name: Download os-ai-pr-bot
run: |
curl -fsSL -o /usr/local/bin/os-ai-pr-bot \
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/latest/assets/os-ai-pr-bot" \
-H "Authorization: token ${GITHUB_TOKEN}"
chmod +x /usr/local/bin/os-ai-pr-bot
- name: Run Claude Bot - name: Run Claude Bot
env: env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: os-ai-pr-bot run: nix run --accept-flake-config .#

116
flake.lock generated Normal file
View File

@ -0,0 +1,116 @@
{
"nodes": {
"claude-code-nix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1770951502,
"narHash": "sha256-MtgcZ9wZQYCZoLQTbhqn770iQC1h8+46bx6Q1HtZSv4=",
"owner": "sadjow",
"repo": "claude-code-nix",
"rev": "a697f13682fc60cda6e93eada4a9e2e4c7bac62e",
"type": "github"
},
"original": {
"owner": "sadjow",
"repo": "claude-code-nix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1770843696,
"narHash": "sha256-LovWTGDwXhkfCOmbgLVA10bvsi/P8eDDpRudgk68HA8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2343bbb58f99267223bc2aac4fc9ea301a155a16",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"claude-code-nix": "claude-code-nix",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

43
flake.nix Normal file
View File

@ -0,0 +1,43 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
claude-code-nix = {
url = "github:sadjow/claude-code-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, claude-code-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
claude-code = claude-code-nix.packages.${system}.claude-code;
# Build the Haskell package
unwrapped = pkgs.haskell.lib.justStaticExecutables
(pkgs.haskellPackages.callCabal2nix "os-ai-pr-bot" ./. {});
# Wrap with claude on PATH
wrapped = pkgs.runCommand "os-ai-pr-bot" {
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper ${unwrapped}/bin/os-ai-pr-bot $out/bin/os-ai-pr-bot \
--prefix PATH : ${pkgs.lib.makeBinPath [ claude-code ]}
'';
in {
packages.default = wrapped;
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.cabal-install
pkgs.haskellPackages.ghc
pkgs.zlib
pkgs.pkg-config
claude-code
];
};
}
);
}