diff --git a/README.md b/README.md index aba2467..6939fb8 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fc28473 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2fd4824 --- /dev/null +++ b/flake.nix @@ -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; + }); + }; +}