It is true that spiders and harvestmen are in the arachnida class, but so are scorpions. Spiders are all the guys in the araneae order. Harvestmen are all the guys in the opiliones order. So, harvestmen are not spiders.

THANK YOU

That was what I was missing. I am newish to C and had not heard of pkg-config. I will update my post and read more about it.

I did not know that about gcc and mkShell so that's good to know, thank you. Removing it did not solve the issue however.

It appears that wlroots and wlroots_0_19 evaluate to the same package and neither cause any errors when entering the dev shell. I tried the one with the version number though, but with the same issue. wlroots_0_19.dev also doesn't seem to exist.

I appreciate the suggestions though!

For now, I'm building using just gcc and make while I learn the intricacies of wayland/wlroots.

7
submitted 7 months ago* (last edited 7 months ago) by river_in_the_sky@lemmy.blahaj.zone to c/nix@programming.dev

RESOLVED: see the edit at the bottom of the post for the solution.

Forgive me if this is not the place to ask this question. If that is the case, I would appreciate some help finding the best place to ask.

I wish to start hacking together a wayland compositor in C and I figured wlroots would be a reasonable place to start. I'm using NixOS with flakes and wish to make a dev shell. Here is the flake.nix that I wrote and figured would work:

# flake.nix
{
  description = "wayland compositor";

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

  outputs =
    { self, nixpkgs, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };
    in {
      devShells."${system}".default =
        (pkgs.mkShell {
          buildInputs = with pkgs; [
            # c tools
            clang-tools
            gcc
            glibc
            gnumake
            gdb
            # wayland tools
            wayland
            wayland-protocols
            wayland-scanner
            wlroots
          ];
        });
    };
}

The problem I am having is that I have to include wlroots headers using:

# some c file
#include <wlroots-0.19/wlr/backend.h>
# note the prefix "wlroots-0.19/"

which differs from how other projects include the shared library on a non-NixOS system. For example, in tinywl, the example compositor in the wlroots repo, wlroots headers are included like this:

# tinywl.c
#include <wlr/backend.h>

Furthermore, even if I do include wlroots headers using the first path, I am unable to build anything since those headers have includes like in tinywl.c.

I might be a little bit out of my depth and that's okay, but I was hoping to have fun hacking together a wayland compositor.

Any help would be greatly appreciated.

EDIT: Per this comment I just needed to add pkg-config to my flake and use pkg-config --cflags wlroots-0.19 to get the right flags for my C compiler. The program still failed to build but only because wlroots depends on the pixman library, so once I included that in the flake as well, compilation succeeded. My flake looks like this now:

{
  description = "wayland compositor";

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

  outputs =
    { self, nixpkgs, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };
    in {
      devShells."${system}".default =
        (pkgs.mkShell {
          packages = with pkgs; [
            # for wayland
            pixman
            wlroots
            wayland
            wayland-protocols
            wayland-scanner
            # for c
            pkg-config
            clang-tools
            gcc
            glibc
            gnumake
            gdb
          ];
        });
    };
}

Does anyone know of any examples of flake-parts being used in a NixOS/home-manager configuration that one could learn from?

I think I still did not understand how flake-parts works by the end of the video or even what it is attempting to solve. I'm not sure how to apply this to my NixOS configuration or whether it's even useful for my type of setup (a small multi-user and multi-system setup for a couple personal machines and a home server).

to have a loneliness made for me... I find it comforting in a way. Somehow that seems better than if I was lonely but no one cared enough to make me so

What are those keycaps? I have searched in the past for completely flat keycaps to no avail

evil americ anfootball house

This makes me feel like I'm only just gaining consciousness from a hazy digital dream and I'm clinging onto it and trying to escape...

chungking express

I love these. What do you use the middle one for?

view more: next ›

river_in_the_sky

0 post score
0 comment score
joined 3 years ago