Skip to content

Commit 9ee3277

Browse files
aster-voidclaude
andcommitted
flake: add nix flake for building
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 3de258b commit 9ee3277

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,25 @@ Self-updating cron scheduler that pulls job definitions from git.
44

55
## Installation
66

7+
### Cargo
8+
79
```bash
810
cargo install --path .
911
```
1012

13+
### Nix
14+
15+
```bash
16+
# Run directly
17+
nix run github:aster-void/rollcron -- /path/to/repo
18+
19+
# Install to profile
20+
nix profile install github:aster-void/rollcron
21+
22+
# Development shell
23+
nix develop
24+
```
25+
1126
## Quick Start
1227

1328
1. Create `rollcron.yaml` in your repository:
@@ -45,6 +60,10 @@ rollcron https://github.com/user/repo --pull-interval 300
4560
### rollcron.yaml
4661

4762
```yaml
63+
runner: # Optional: global settings
64+
working_dir: ./scripts # Working directory (relative to job dir)
65+
timezone: Asia/Tokyo # Timezone for cron schedules (default: UTC)
66+
4867
jobs:
4968
<job-id>: # Key is the job ID (used for directories)
5069
name: "Display Name" # Optional: display name (defaults to job ID)
@@ -58,6 +77,15 @@ jobs:
5877
delay: 1s # Initial delay (default: 1s), exponential backoff
5978
```
6079
80+
### Runner
81+
82+
Global settings that apply to all jobs:
83+
84+
| Field | Description |
85+
|-------|-------------|
86+
| `working_dir` | Working directory for all jobs (relative to job snapshot dir) |
87+
| `timezone` | Timezone for cron schedule interpretation (e.g., `Asia/Tokyo`, `America/New_York`) |
88+
6189
### Concurrency
6290

6391
Controls behavior when a job is triggered while a previous instance is still running:

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4+
};
5+
6+
outputs =
7+
{ self, nixpkgs }:
8+
let
9+
systems = [
10+
"x86_64-linux"
11+
"aarch64-linux"
12+
"x86_64-darwin"
13+
"aarch64-darwin"
14+
];
15+
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
16+
in
17+
{
18+
packages = forAllSystems (pkgs: {
19+
rollcron = pkgs.rustPlatform.buildRustPackage {
20+
pname = "rollcron";
21+
version = "0.1.0";
22+
src = ./.;
23+
cargoLock.lockFile = ./Cargo.lock;
24+
nativeBuildInputs = [ pkgs.makeWrapper ];
25+
postInstall = ''
26+
wrapProgram $out/bin/rollcron \
27+
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.git pkgs.gnutar ]}
28+
'';
29+
};
30+
default = self.packages.${pkgs.system}.rollcron;
31+
});
32+
33+
devShells = forAllSystems (pkgs: {
34+
default = pkgs.mkShell {
35+
packages = [
36+
pkgs.cargo
37+
pkgs.rustc
38+
pkgs.rust-analyzer
39+
pkgs.git
40+
];
41+
};
42+
});
43+
};
44+
}

0 commit comments

Comments
 (0)