Home

tailwind-ctp @4ce9431cbb4e9e5dceadfbc413fbd34e7305fe8e - refs - log -
-
https://git.jolheiser.com/tailwind-ctp.git
TailwindCSS + Catppuccin
tailwind-ctp / flake.nix
- raw -
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
{
  description = "TailwindCSS + Catppuccin";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
  };

  outputs =
    { self, nixpkgs }:
    let
      systems = [
        "x86_64-linux"
        "i686-linux"
        "x86_64-darwin"
        "aarch64-linux"
        "armv6l-linux"
        "armv7l-linux"
      ];
      forAllSystems = f: nixpkgs.lib.genAttrs systems f;
    in
    {
      packages = forAllSystems (
        system:
        let
          pkgs = nixpkgs.legacyPackages.${system};
          v3 =
            let
              drv = pkgs.buildNpmPackage {
                pname = "tailwind-ctp_3";
                version = "0.0.0";
                src = ./.;
                npmDepsHash = "sha256-Fm6c7bZ8raEJw06YZA6iMRoGwWU9RVkPGd5vCjXUAsA=";
                dontNpmBuild = true;
                installPhase = ''
                  mkdir -p $out
                  cp -r . $out/
                '';
              };
            in
            pkgs.writeShellApplication {
              name = "tailwind-ctp_3";
              runtimeInputs = [ pkgs.nodejs ];
              text = ''
                node ${drv}/index.js "$@"
              '';
            };
          v4drv = pkgs.stdenv.mkDerivation (finalAttrs: {
            pname = "catppuccin-tailwind";
            version = "1.0.0";
            src = pkgs.fetchFromGitHub {
              owner = "catppuccin";
              repo = "tailwindcss";
              rev = "v1.0.0";
              hash = "sha256-pitujxZBOk2imG48qPZ82QPLEQXp4BscLDC/zOPAiWM=";
            };
            nativeBuildInputs = with pkgs; [
              nodejs
              pnpm_9.configHook
            ];
            pnpmDeps = pkgs.pnpm_9.fetchDeps {
              inherit (finalAttrs) pname version src;
              fetcherVersion = 2;
              hash = "sha256-AtciqsfUfWjHGohirKtKMIGMxW7BfwirxKG7HbwMrf8=";
            };
            buildPhase = ''
              runHook preBuild
              pnpm build
              runHook postBuild
            '';
            installPhase = ''
              runHook preInstall
              mkdir -p $out
              cp -r packages/catppuccin-tailwindcss/*.css $out/
              runHook postInstall
            '';
          });
          v4css =
            flavor:
            let
              css = pkgs.writeText "tailwind-ctp-css-${flavor}" ''
                @import "tailwindcss";
                @import "${v4drv}/${flavor}.css";
              '';
            in
            pkgs.writeShellApplication {
              name = "tailwind-ctp-${flavor}";
              runtimeInputs = [
                pkgs.tailwindcss_4
              ];
              text = ''
                tailwindcss -i ${css} "$@"
              '';
            };
        in
        {
          default = v3;
          inherit v3;
          v4 = v4css "mocha";
          v4mocha = v4css "mocha";
          v4frappe = v4css "frappe";
          v4macchiato = v4css "macchiato";
        }
      );
    };
}