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

Abierto
#6,496 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
elixir, nixos, nodejs, tailwindcss

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
          '';

        };
      }
    );
}
Lenguaje dominante
Elixir
Estrellas
23.2k
Forks
3.2k
Merge medio
16 h 35 min
PR fusionados (30 d)
18

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de phoenixframework/phoenix

Todos los issues de phoenixframework/phoenix

Issues similares

Más issues de Elixir

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.