8000 NixOS · Issue #17 · ldelossa/way-shell · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

NixOS #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “ 8000 Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbrignall opened this issue May 30, 2024 · 14 comments
Open

NixOS #17

mbrignall opened this issue May 30, 2024 · 14 comments
Labels
help wanted Extra attention is needed

Comments

@mbrignall
Copy link

Hi there,

Great project!

Is there a plan to package this for NixOS?

Best,

M.

@ldelossa
Copy link
Owner

Hey there.

Not unless a community member contributes this. I will only maintain packages for the distro I currently use, which is Fedora.

@ldelossa ldelossa added help wanted Extra attention is needed labels Jun 3, 2024
@sudanchapagain
Copy link
sudanchapagain commented Jun 9, 2024
8000

With some help, i managed to build the binary with nix-shell. As in it's still using make but uses nix-shell to provide the paths for dependencies. However, i had to add a new entry to the Make file dependency

DEPS := libadwaita-1 \
		gtk4-layer-shell-0 \
		upower-glib \
		wireplumber-0.5 \
++		libpipewire-0.3 \
		json-glib-1.0 \
		libnm \
		libpulse \
		libpulse-simple \
		libpulse-mainloop-glib \

shell.nix:

with import <nixpkgs> {};
mkShell {
  name = "env";
  packages = [
    pkg-config
    gtk4
    libadwaita
    gtk4-layer-shell
    upower
    wireplumber
    pipewire.dev
    json-glib
    networkmanager.dev
    libpulseaudio
    wayland-protocols
    wayland-utils
    xwayland
    glib.dev
  ];
}

just add these to the root of repo run nix-shell & then make

NOTE: 1. I have not mapped exact dependencies in nix-shell. I should have used nix-locate or something as such it might contain unnecessary dependencies. 2. I have not ran the binary as i am in gnome and ran into a error which is i think is because i am not in sway.

@ldelossa
Copy link
Owner
ldelossa commented Jun 9, 2024

Very cool! Id love to help out more here but Im not too Nix savvy.

Your comments around running in Gnome is right. We fail if we can't take a few dbus names, which Gnome is almost definitely owning.

@sudanchapagain
Copy link

I just tried running it on sway but i got an error.

(way-shell:5405): GLib-GIO-ERROR **: 15:54:42.969: Settings schema 'org.ldelossa.way-shell.window-manager' is not installed
Trace/breakpoint trap (core dumped)

I am not sure why but i am assuming it's because it isn't installed in system as in it's not linked and is in nix store. idk.

@ldelossa
Copy link
Owner

@sudanchapagain The gschema file has not be integrated with your system.

Check out the makefile targets here:

.PHONY:
install-gschema:
	glib-compile-schemas $(DESTDIR)$(SCHEMADIR)

.PHONY:
install:
	install -D ./way-shell $(DESTDIR)$(BINDIR)/way-shell
	install -D ./way-sh/way-sh $(DESTDIR)$(BINDIR)/way-sh
	install -D data/org.ldelossa.way-shell.gschema.xml $(DESTDIR)$(SCHEMADIR)/org.ldelossa.way-shell.gschema.xml
	install -D contrib/systemd/way-shell.service $(DESTDIR)$(USERUNITDIR)/way-shell.service

After the install, a call to make install-gschema should be called to compile the gschema database.

For instance, we do this in a post scriptlet in the rpm spec file:

https://github.com/ldelossa/way-shell/blob/main/way-shell.spec#L64C1-L71C50

@sudanchapagain
Copy link

It's been long, i had exams. But today i have been trying to make a nixpkgs derivation. I have managed to compile the program and also generate the gschema file but it's not being used. I'm having huge skill issues with this, i'll see what i can do.

@ldelossa
Copy link
Owner

@sudanchapagain thanks!

Check out the RPM spec: https://github.com/ldelossa/way-shell/blob/main/way-shell.spec#L65-L69
We basically do an install and then install the gschema.

You may need to figure out where the gschema directory is on your system. Maybe this is covered in NixOS documentation somewhere? At the minimum you can probably just do a search for 'gschemas.compiled' file at the root of your OS, and find the directory that looks like a unix standard path like "/usr/share/..." or similar.

@sudanchapagain
Copy link

I did look at it, by generating gschema file i meant i managed to get the .xml file (it was not being generated last time or i never looked at it idk), in short i don't have the .compiled file.

In nix, the packages are sandboxed(?) and it exists in /nix/store/<someHash>-way-shell-<version>/. Each build generates a new hash as such new directory. The directory acts as the root for the package. /usr/share usr/bin all exists in that directory for each package for each build.

The issue i have right now is, during build for some reason, calling glib-compile-schemas $out/share/glib-2.0/schemas is not compiling the .xml even tho the build succeeds.

$out is the current build's hash directory on /nix/store

@ldelossa
Copy link
Owner

@sudanchapagain hmm, and you see that the way-shell gschema file is in that directory?

@sudanchapagain
Copy link

on each build directory i see this

.
└── usr
    ├── bin
    │   ├── way-sh
    │   └── way-shell
    ├── lib
    │   └── systemd
    │       └── user
    │           └── way-shell.service
    └── share
        └── glib-2.0
            └── schemas
                └── org.ldelossa.way-shell.gschema.xml

@ldelossa
Copy link
Owner
ldelossa commented Jul 23, 2024

Im not really sure how this should work with Nix.

On a non-Nix system, dconf-enabled applications would place their gschema files in a well-known system path. Then, you compile all schemas in that path into one database. Dconf is then pointed to this path for the database.

Maybe its worth looking at another project like WayBar which integrates with gschema/dconf as well. Maybe it has a nix build we can rip?

Or maybe SwayNotificationCenter: https://github.com/ErikReider/SwayNotificationCenter/blob/main/data/org.erikreider.swaync.gschema.xml

@sudanchapagain
Copy link
sudanchapagain commented Jul 23, 2024

Good suggestion, thank you!

I managed to get this far because i was ripping things from the gnome application's nixpkgs package.nix files.

I honestly couldn't understand the waybar's package.nix.

SwayNotificationCenter appears to simply call this file during build https://github.com/ErikReider/SwayNotificationCenter/blob/main/build-aux/meson/postinstall.py

@sudanchapagain
Copy link

I tried today too, couldn't do it. I opened a issue in nixpkgs repo for packaging request.

NixOS/nixpkgs#329583

@ldelossa
Copy link
Owner

Thanks! Lets see what the response is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0