From 5bf7c061b290cedca32d275e3dd45569214e272f Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Sun, 10 May 2026 23:16:12 +0200 Subject: [PATCH] chore: add Nix flake dev shell (xcbeautify, swiftlint, swiftformat on macOS) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c9e2964 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "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" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1778003029, + "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..915e4de --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "CentralCloud OnCall Mobile — ntfy iOS app (Swift/Xcode, macOS only)"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + nixConfig = { + extra-substituters = [ + "https://cache.centralcloud.com/default" + ]; + extra-trusted-public-keys = [ + "default:ywfU21WX06iOn2Ec2lae1jYh4w8LO4IQkmp06vJzsk8=" + ]; + }; + + outputs = { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system;}; + isDarwin = pkgs.stdenv.isDarwin; + in { + devShells.default = pkgs.mkShell { + packages = + [ + pkgs.git + pkgs.jq + ] + ++ pkgs.lib.optionals isDarwin [ + # macOS-only: Xcode toolchain is managed outside Nix via xcode-select + pkgs.xcbeautify # prettier xcodebuild output + pkgs.swiftlint # Swift linting + pkgs.swiftformat # Swift formatting + ]; + + shellHook = '' + echo "CentralCloud OnCall Mobile (iOS) dev shell" + ${pkgs.lib.optionalString isDarwin '' + echo " xcbeautify : $(xcbeautify --version 2>/dev/null || echo 'available')" + echo " swiftlint : $(swiftlint --version 2>/dev/null || echo 'available')" + echo "" + echo "Build: xcodebuild -scheme ntfy -destination 'generic/platform=iOS' | xcbeautify" + echo "Note : Xcode must be installed via xcode-select (not managed by Nix)" + ''} + ${pkgs.lib.optionalString (!isDarwin) '' + echo "" + echo "NOTE: iOS builds require macOS + Xcode. This shell provides only" + echo " scripting utilities on Linux/other platforms." + ''} + ''; + }; + }); +}