Dataflare icon indicating copy to clipboard operation
Dataflare copied to clipboard

[Feature Request] Package for NixOS

Open 0xhckr opened this issue 7 months ago • 13 comments

Describe the solution you'd like

Can we get this installing on NixOS?

0xhckr avatar Apr 30 '25 15:04 0xhckr

For Linux, there is currently only an AppImage version, but in the future we are considering providing deb and rpm, and maybe Flatpak. I am not familiar with NixOS, do you have any suggestions?

wyhaya avatar May 02 '25 06:05 wyhaya

NixOS is a Linux-based OS where everything is defined declaratively. If I wanted to install dataflare I would add it to my list of installed programs:

environment.systemPackages = with pkgs; [
  ...
  dataflare
  ...
];

and then rebuild the system

$ sudo nixos-rebuild switch

In this way you could install all the packages a system would need via a single text file. Basically everything to do with nix is installed into /nix/store/<some-hash>-derivation-name/<files>

Folders inside of /nix/store can contain everything from specific versions of a given library to different versions of the same binary for different purposes (think needing nodejs pre-18.0 for one project, and nodejs post-20.0 for your fancy custom app bar). It's very useful for creating reproducible systems.

In my case, NixOS helps me in the following ways:

  • It allows me to keep track of all the programs I've previously installed.
  • It centralizes the entire OS's configuration into a single folder I can commit to a git repository
  • It allows me to completely nuke my system and simply need to clone that git repository, run a couple commands, and be back up and running with all my prior settings and programs
  • It has a feature built in where if I mess something up in my configuration and being locked out of my system, I can just revert to a previous point in history without deleting any personal files like project data, pictures, documents etc.
  • It allows me to grab all the dependencies for a codebase when I'm developing on that codebase and unlinking the dependencies when I don't need them or when I need a different set of dependencies

However, as a result, every program that runs on NixOS has to be packaged specifically for it. You can take an .AppImage and turn it into a NixOS program (as has been done with code-cursor, the Cursor Code Editor, since the project is closed source and they provide .AppImages) though you usually get the most out of most programs when they are compiled for NixOS from source (but that's mostly for open source projects). An example of this is how vs-code can have all its extensions defined declaratively but cursor cannot since Cursor is shipped as an .AppImage and then turned into a NixOS package.

I'm still fairly new to the OS myself so my attempt at packaging the app wasn't the best though you may find more luck! This is the nix file needed to package for code-cursor if you're interested: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/co/code-cursor/package.nix

0xhckr avatar May 02 '25 18:05 0xhckr

Thank you for your suggestion. I have never learned about these before. I will give it a try!

wyhaya avatar May 03 '25 02:05 wyhaya

Coming back to this - I tried packaging it myself today but to no avail. I presumed it was an Electron App and tried a similar approach to how other electron apps are packaged when we only have access to the .AppImage but I'm getting an error:

Could not create default EGL display: EGL_BAD_PARAMETER. Aborting...

which means there's some library missing.

So is dataflare an electron app or is it built using something else? And if so, would it be possible to get some hints so I may package it?

0xhckr avatar Jun 05 '25 03:06 0xhckr

Could not create default EGL display: EGL_BAD_PARAMETER. Aborting...

This is a bug that I am currently unable to fix. It only occurs when running the AppImage.

So is dataflare an electron app or is it built using something else?

No, Dataflare is a Tauri App built using Web (webkit) + Rust.

And if so, would it be possible to get some hints so I may package it?

I am not really familiar with this, but running the following process might help you package it.

# As an executable program
chmod +x ./Dataflare.AppImage

# Extract AppImage contents
./Dataflare.AppImage --appimage-extract
cd squashfs-root

# Install patchelf (this is on Fedora, you can adjust as needed)
sudo dnf install patchelf

# Let Dataflare use the system default path
patchelf --remove-rpath usr/bin/dataflare

# Now we have an independent Dataflare binary file
# You should be able to see the Dataflare window
./usr/bin/dataflare

# Dataflare has some bugs on Wayland, and you can adjust it as needed.
GDK_BACKEND=x11 ./usr/bin/dataflare
GDK_BACKEND=wayland ./usr/bin/dataflare

# You may also need to install the items listed here
# https://v2.tauri.app/start/prerequisites/#linux

# NOTE: Datafalre will be unable to install updates

If the above steps are successfully executed, then dataflare should be able to run anywhere.

wyhaya avatar Jun 05 '25 06:06 wyhaya

No, Dataflare is a Tauri App built using Web (webkit) + Rust.

Cool! I'll try packaging it as a Tauri App once I'm back home later today. As far as I can recall, they have a separate set of dependencies - especially around rendering so that might be the answer to the EGL Display issues (though, if it's failing even running on a regular linux platform as an app image, that might be something in your guys' hands to fix. I recall the app gitbutler having a similar issue you could look into if you have the time)

0xhckr avatar Jun 05 '25 11:06 0xhckr

@wyhaya Does the website have any way of saving and serving previous versions?

Ideally we could do something like https://assets.dataflare.app/release/linux/x86_64/Dataflare.v2.1.0.AppImage as a download link so that when people go to download it on nixos, there's pinned versions they can access.

0xhckr avatar Jul 14 '25 18:07 0xhckr

but apart from that, I have dataflare running on NixOS. I'll be putting a PR up but it'd be best if it was created under your org for better visibility

0xhckr avatar Jul 14 '25 19:07 0xhckr

History versions

  • ~~https://assets.dataflare.app/release/linux/x86_64/Dataflare-1.7.0.AppImage~~
  • ...
  • https://assets.dataflare.app/release/linux/x86_64/Dataflare-2.3.2.AppImage

Latest version

  • https://assets.dataflare.app/release/linux/x86_64/Dataflare.AppImage
  • https://assets.dataflare.app/release/linux/x86_64/latest.json

AArch64

Just replace x86_64 with aarch64.

All versions (JSON)

  • ~~https://api.dataflare.app/release/versions~~

wyhaya avatar Jul 15 '25 02:07 wyhaya

awesome! that should work pretty well! I'll push up my repo in just a bit now that I'm home. There's a couple linux specific fixes we might want to implement but I'll create additional issues for those!

0xhckr avatar Jul 15 '25 02:07 0xhckr

Thank you!

https://github.com/NixOS/nixpkgs Can we submit it to the official repository? Is this different from creating a new repository under Dataflare organization?


However, there is an issue with the update program. Currently, the update program is limited to AppImage, so any user will encounter an error when updating Datafalre.

wyhaya avatar Jul 15 '25 02:07 wyhaya

https://github.com/hackr-sh/dataflare-nixos-flake it's here!

NixOS programs are never updated by the program itself - they're installed as a specific version and don't move from that version there unless the user updates the dependencies accordingly and then rebuilds. The implementation I have there is technically the best way to manage this since it's a flake - it can be pinned and individually updated.

To update any program on NixOS that's on it's own flake, a user would need to run the following two commands:

nix flake update <input-name>
nixos-rebuild switch --flake <path-to-system-config-flake>

which in the case of dataflare on my local system looks like:

nix flake update dataflare
nixos-rebuild switch --flake /home/hackr/nixos

0xhckr avatar Jul 15 '25 02:07 0xhckr

Conversely, by the way, if you were to update a single program on nixpkgs you'd either need to create a separate input specifically for that program and call it something like "nixpkgs-dataflare" or update all the apps altogether which results in most PCs sitting waiting for a couple minutes to a couple hours depending on their install size + CPU power waiting for all packages to redownload/rebuild and then install. It takes close to 50 minutes on my i9 laptop and about 15 minutes on my desktop Ryzen 9.

0xhckr avatar Jul 15 '25 02:07 0xhckr