phx.new pipeline doesn't work under NixOS for reasons of tailwindcss cannot be downloaded and run

オープン
#6,496 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
elixir, nixos, nodejs, tailwindcss

調査の方向性

Start by tracing the mix phx.new --install path that downloads and runs Tailwind CSS, then compare it with the NixOS setup and system packages described in the issue. Determine whether a project option can select system-provided tailwindcss and watchman; done means a standard NixOS environment can create and run a Phoenix project without the dynamic-linker failure.

索引モデルが issue の本文から書いたものです。

説明

A standard NixOS installation development environment for elixir (using beamMinimal28Packages.elixir_1_19, but also tested with older versions) , does not allow tailwindcss to run when downloaded by mix phx.new --install :

mix phx.new tailwindfail --no-ecto --install
...
$ mix phx.server
Compiling 14 files (.ex)
Generated tailwindfail app
Could not start dynamically linked executable: /home/tbrowne/scratch/teste/tailwindfail/_build/tailwind-linux-x64
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

The fix is quite involved but does work:
https://discourse.nixos.org/t/cannot-run-tailwind-css-with-elixir-phoenix-1-8-project/69651/4

Can this be made smoother somehow? For example a mix option that would automatically configure the project to use system-provided nix packages tailwindcss and watchman?

For completeness, here's my nix develop flake that works with the above fix.

{
  description = "A flake for building development environment of Phoenix project.";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/master";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      with pkgs; {
        devShells.default = mkShell {
          buildInputs = [
	    beamMinimal28Packages.elixir_1_19
            nodejs
	    tailwindcss_4
	    watchman
          ]
          ++ lib.optionals stdenv.isLinux [
            # For ExUnit Notifier on Linux.
            libnotify

            # For file_system on Linux.
            inotify-tools
          ]
          ++ lib.optionals stdenv.isDarwin ([
            # For ExUnit Notifier on macOS.
            terminal-notifier

            # For file_system on macOS.
            darwin.apple_sdk.frameworks.CoreFoundation
            darwin.apple_sdk.frameworks.CoreServices
          ]);

          shellHook = ''
            # allows mix to work on the local directory
            mkdir -p .nix-mix
            mkdir -p .nix-hex
            export MIX_HOME=$PWD/.nix-mix
            export HEX_HOME=$PWD/.nix-hex
            export ERL_LIBS=$HEX_HOME/lib/erlang/lib

            # concats PATH
            export PATH=$MIX_HOME/bin:$PATH
            export PATH=$MIX_HOME/escripts:$PATH
            export PATH=$HEX_HOME/bin:$PATH

            # enables history for IEx
            export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.erlang-history\"'"

            # Phoenix add phx.new if not already there
            pattern=".nix-mix/archives/phx_new*"
            files=$(compgen -G "$pattern")
            if [ -z "$files" ]; then
              mix archive.install hex phx_new
            fi
          '';

        };
      }
    );
}
主要言語
Elixir
スター
23.2k
フォーク
3.2k
平均マージ
16時間 35分
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phoenixframework/phoenix のほかの issue

phoenixframework/phoenix の issue をすべて見る

似ている issue

Elixir の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。