diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml new file mode 100644 index 0000000000000000000000000000000000000000..c1800663f9f528eeab7dbd6a74a96aa9a094d888 --- /dev/null +++ b/.github/workflows/update-flake.yml @@ -0,0 +1,26 @@ +name: Update flake.lock + +on: + push: + branches: [master] + paths: [go.sum] + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: DeterminateSystems/nix-installer-action@main + + - name: Update flake.lock + run: nix flake update + + - name: Commit changes + run: | + git diff --quiet flake.lock && exit 0 + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add flake.lock + git commit -m "chore: update flake.lock [skip ci]" + git push diff --git a/docs/docs/installation.md b/docs/docs/installation.md index 13689467047952dea86b65debfa08ec6ac93ecd0..abd1d1490e88f2a66243b6cc549caa4e114924f1 100644 --- a/docs/docs/installation.md +++ b/docs/docs/installation.md @@ -64,6 +64,20 @@ You can install Matcha via Flatpak using the following command: flatpak install https://matcha.floatpane.com/matcha.flatpakref ``` +### Nix + +You can run Matcha directly using [Nix](https://nixos.org/) flakes: + +```bash +nix run github:floatpane/matcha +``` + +Or install it into your profile: + +```bash +nix profile install github:floatpane/matcha +``` + ### Manual Binary Download You can download pre-compiled binaries from the [Releases page](https://github.com/floatpane/matcha/releases). diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000000000000000000000000000000000..54f30822fbaf8346260c841162584f2972937ee6 --- /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": 1772525000, + "narHash": "sha256-M7kpjimt0jdEQzmin6ptszf8ev7TVzibyZNSLaLquMM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "72b1d820cb0149b40a35aa077b4b6d60cd1b23c3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "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 0000000000000000000000000000000000000000..fdc1d1badf1473a61575a53fa19b6fde58736576 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "matcha — a beautiful and functional email client for the terminal"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages = rec { + matcha = pkgs.buildGoModule.override { go = pkgs.go_1_26; } { + pname = "matcha"; + version = self.shortRev or "dev"; + + src = ./.; + + vendorHash = "sha256-fZnAZwwQH2WNewS4pEkl7Bko4smdgo5omkdtA1voXkY="; + + env.CGO_ENABLED = 0; + + ldflags = [ + "-s" + "-w" + "-X main.version=${self.shortRev or "dev"}" + "-X main.commit=${self.rev or "dirty"}" + "-X main.date=1970-01-01T00:00:00Z" + ]; + + meta = { + description = "A beautiful and functional email client for the terminal"; + homepage = "https://github.com/floatpane/matcha"; + license = pkgs.lib.licenses.mit; + mainProgram = "matcha"; + }; + }; + default = matcha; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + go_1_26 + gopls + gotools + ]; + }; + } + ) // { + overlays.default = final: _prev: { + matcha = self.packages.${final.system}.matcha; + }; + }; +}