Add a flake.nix for Nix packaging; document nix install paths in README

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
randogoth 2026-09-10 17:04:47 +03:00
parent 16f5d7351f
commit 47606a64b7
3 changed files with 94 additions and 0 deletions

View file

@ -11,6 +11,20 @@ cargo build --release
# target/release/calcalist
```
With Nix flakes enabled:
```sh
nix build # ./result/bin/calcalist
# or: nix run . -- doctor
# or: nix profile install .
```
Or straight from the repo, without cloning it first:
```sh
nix profile install "git+https://code.randogoth.com/randogoth/CalCalist.git"
```
One runtime dependency is needed for CalDAV and iCal sync: **`pimsync` 0.5.x on `PATH`**.
Then check the environment, which is worth doing before writing any config:

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1789006805,
"narHash": "sha256-xB8mKMOx1IA9vTDNLmJZ6n4wCMq/cuWBBOzGCRnqxrU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8ce4ef6cb6f871616146b9fe26d2a5ae594e94fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View file

@ -0,0 +1,53 @@
{
description = "Aggregate and sync events between CalDAV, Google Calendar and iCal feeds";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forEachSystem = nixpkgs.lib.genAttrs systems;
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in
{
packages = forEachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
rec {
calcalist = pkgs.rustPlatform.buildRustPackage {
pname = "calcalist";
version = cargoToml.package.version;
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
# tests/caldav.rs spins up radicale and pimsync as real
# processes; it's a dev-time integration gate (devbox run
# check), not something a package build should re-run.
doCheck = false;
meta = {
description = cargoToml.package.description;
license = pkgs.lib.licenses.mit;
mainProgram = "calcalist";
platforms = pkgs.lib.platforms.linux;
};
};
default = calcalist;
}
);
apps = forEachSystem (system: rec {
calcalist = {
type = "app";
program = "${self.packages.${system}.calcalist}/bin/calcalist";
};
default = calcalist;
});
};
}