From b82c43538a632abe36ee76f253f5935d9feb73c7 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Fri, 31 May 2024 03:34:23 +0100 Subject: [PATCH 1/4] ci: we nix now Co-authored-by: isabelroses Co-authored-by: nullishamy --- .github/workflows/build.yml | 13 +++++------ .github/workflows/release.yml | 13 +++++------ .gitignore | 1 + default.nix | 41 +++++++++++++++++++++++++++++++++++ flake.lock | 27 +++++++++++++++++++++++ flake.nix | 24 ++++++++++++++++++++ shell.nix | 13 +++++++++++ 7 files changed, 116 insertions(+), 16 deletions(-) create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04fb5803..d961f711 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 . -Lv - 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..57d469fb --- /dev/null +++ b/default.nix @@ -0,0 +1,41 @@ +{ lib +, stdenvNoCC +, inkscape +, just +, xcursorgen +, hyprcursor +, zip +}: + +stdenvNoCC.mkDerivation { + name = "catppuccin-cursors"; + src = ./.; + 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 + ]; +} + From 4da24d99a96a88c9c59f3363b1dfb58f7827a393 Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Fri, 31 May 2024 03:42:19 +0100 Subject: [PATCH 2/4] poggers Co-authored-by: Isabel --- default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 57d469fb..7fbac637 100644 --- a/default.nix +++ b/default.nix @@ -9,7 +9,12 @@ stdenvNoCC.mkDerivation { name = "catppuccin-cursors"; - src = ./.; + src = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.intersection + (lib.fileset.fromSource (lib.sources.cleanSource ./.)) + (lib.fileset.unions [ ./src ./justfile ./build ./create_zips ]); + }; nativeBuildInputs = [ just xcursorgen From 072826ac55b3796625cb315902afef7759dd60a0 Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Fri, 31 May 2024 03:43:53 +0100 Subject: [PATCH 3/4] chore: remove verbose logging Co-authored-by: Isabel --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d961f711..517d9439 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build - run: nix build . -Lv + run: nix build . -L - name: Set outputs id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT From abfaea6b0113911e6710118362ff28623a149049 Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Fri, 31 May 2024 03:50:31 +0100 Subject: [PATCH 4/4] fix: add missing files Co-authored-by: Isabel --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 7fbac637..65124784 100644 --- a/default.nix +++ b/default.nix @@ -13,7 +13,7 @@ stdenvNoCC.mkDerivation { root = ./.; fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./.)) - (lib.fileset.unions [ ./src ./justfile ./build ./create_zips ]); + (lib.fileset.unions [ ./src ./justfile ./build ./create_zips ./AUTHORS ./LICENSE ]); }; nativeBuildInputs = [ just