Struggling with Meson and Flakes

I’m working on a library called libtokyo and I’m including files for nix. I decided I would learn how to use Flakes as I’ve heard its a better way of doing things. So I’ve come up with this nix file:

{
  description = "A libadwaita wrapper for ExpidusOS with Tokyo Night's styling";
  outputs = { self, nixpkgs }:
    let
      supportedSystems = [
        "aarch64-linux"
        "aarch64-darwin"
        "i686-linux"
        "riscv64-linux"
        "x86_64-linux"
        "x86_64-darwin"
      ];
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
      nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
    in
    {
      packages = forAllSystems (system:
        let
          pkgs = nixpkgsFor.${system};
        in
        {
          default = pkgs.stdenv.mkDerivation rec {
            name = "libtokyo";
            src = self;
            outputs = [ "out" "dev" ];

            nativebuildInputs = with pkgs; [ meson ninja pkg-config vala glib sass ];
            buildInputs = with pkgs; [ libadwaita ];

            enableParallelBuilding = true;

            meta = with pkgs.lib; {
              homepage = "https://github.com/ExpidusOS/libtokyo";
              license = with licenses; [ gpl3Only ];
              maintainers = [ "Tristan Ross" ];
            };
          };
        });

      devShells = forAllSystems (system:
        let
          pkgs = nixpkgsFor.${system};
        in
        {
          default = pkgs.mkShell {
            buildInputs = with pkgs; [
              meson
              ninja
              pkg-config
              vala
              nodejs
              gcc
              libadwaita.dev
              libadwaita.devdoc
            ];

            shellHooks = ''
              export PATH="$PWD/node_modules/.bin/:$PATH"
              alias run="npm run"
            '';
          };
        });
    };
}

I get no issues with nix develop and the nix flake commands but when I execute nix build, I get this output:

error: builder for '/nix/store/nbw87nqqhm3bwqv16224pafdsr8bcnv9-libtokyo.drv' failed with exit code 2;
       last 10 log lines:
       > source root is source
       > patching sources
       > configuring
       > no configure script, doing nothing
       > building
       > no Makefile, doing nothing
       > glibPreInstallPhase
       > installing
       > install flags: SHELL=/nix/store/3j918i1nbwhby0y38bn2r438rjhh8f4d-bash-5.1-p16/bin/bash gsettingsschemadir=/nix/store/llcs68z73k4kpd8plmh8cwymcarqgihc-libtokyo/share/gsettings-schemas/libtokyo/glib-2.0/schemas/ pkgconfigdir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/lib/pkgconfig m4datadir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/share/aclocal aclocaldir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/share/aclocal install
       > make: *** No rule to make target 'install'.  Stop.
       For full logs, run 'nix log /nix/store/nbw87nqqhm3bwqv16224pafdsr8bcnv9-libtokyo.drv'.

Running nix log /nix/store/nbw87nqqhm3bwqv16224pafdsr8bcnv9-libtokyo.drv outputs:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/7m6lslj3ms24is746avxhv9nvz585ppl-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
no Makefile, doing nothing
@nix { "action": "setPhase", "phase": "glibPreInstallPhase" }
glibPreInstallPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
install flags: SHELL=/nix/store/3j918i1nbwhby0y38bn2r438rjhh8f4d-bash-5.1-p16/bin/bash gsettingsschemadir=/nix/store/llcs68z73k4kpd8plmh8cwymcarqgihc-libtokyo/share/gsettings-schemas/libtokyo/glib-2.0/schemas/ pkgconfigdir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/lib/pkgconfig m4datadir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/share/aclocal aclocaldir=/nix/store/x6ziid0pvn4dxz1dmsg94w9mj287qy37-libtokyo-dev/share/aclocal install
make: *** No rule to make target 'install'.  Stop.

So I am stuck, I’ve looked at other people using Meson and it looks like nix should automatically notice meson and use it but it looks like that’s not true. Since I also see Meson working fine in nixpkgs, it seems like there’s something wrong which I cannot tell that’s related to my flake.nix.

1 Like

You’ve misspelt nativeBuildInputs, meaning that the meson and ninja setup hooks are not executed.

1 Like

Ah, thanks. I didn’t notice that at all, pesky typos lol.