diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04fb5803..517d9439 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,13 +9,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: extractions/setup-just@v2 - - name: Install dependencies - run: sudo apt update && sudo apt install -y inkscape x11-apps - - name: Generate cursors - run: just all - - name: Build zips - run: just zip + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build + run: nix build . -L - name: Set outputs id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -23,4 +20,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: 'catppuccin-cursors-${{ steps.vars.outputs.sha_short }}' - path: releases/*.zip + path: result/*.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3972aa1e..1f1a5216 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,14 +26,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: extractions/setup-just@v2 - - name: Install dependencies - run: sudo apt update && sudo apt install -y inkscape x11-apps - - name: Generate cursors - run: just all - - name: Build zips - run: just zip + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build + run: nix build . -Lv - name: Add zips to release - run: gh release upload ${{ needs.release-please.outputs.tag_name }} releases/*.zip + run: gh release upload ${{ needs.release-please.outputs.tag_name }} result/*.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index c2c296b4..e21b16dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist/ pngs/ releases/ +result diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..65124784 --- /dev/null +++ b/default.nix @@ -0,0 +1,46 @@ +{ lib +, stdenvNoCC +, inkscape +, just +, xcursorgen +, hyprcursor +, zip +}: + +stdenvNoCC.mkDerivation { + name = "catppuccin-cursors"; + src = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.intersection + (lib.fileset.fromSource (lib.sources.cleanSource ./.)) + (lib.fileset.unions [ ./src ./justfile ./build ./create_zips ./AUTHORS ./LICENSE ]); + }; + nativeBuildInputs = [ + just + xcursorgen + inkscape + hyprcursor + zip + ]; + buildPhase = '' + runHook preBuild + + patchShebangs . + just all + just zip + + runHook postBuild + ''; + installPhase = '' + # $out is an automatically generated filepath by nix, + # but it's up to you to make it what you need. We'll create a directory at + # that filepath, then copy our sources into it. + mkdir $out + cp -rv ./releases/* $out + ''; + meta = { + description = "Catppuccin cursor theme based on Volantes"; + homepage = "https://github.com/catppuccin/cursors"; + license = lib.licenses.gpl2; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..8bd5b72e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", + "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 00000000..649f2e50 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = + { nixpkgs, ... }: + let + systems = ["aarch64-linux" "x86_64-linux"]; + forAllSystems = + function: + nixpkgs.lib.genAttrs systems ( + system: function nixpkgs.legacyPackages.${system} + ); + in + { + devShells = forAllSystems (pkgs: { + default = pkgs.callPackage ./shell.nix { }; + }); + + packages = forAllSystems (pkgs: rec { + default = catppuccin-cursors; + catppuccin-cursors= pkgs.callPackage ./default.nix { }; + }); + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..1c1bbd0a --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import { } }: + +pkgs.mkShell { + name = "dev-shell"; + buildInputs = with pkgs; [ + just + hyprcursor + inkscape + xorg.xcursorgen + zip + ]; +} +