Skip to content
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 “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

Nix package #7

Open
keenanweaver opened this issue Jun 26, 2024 · 3 comments
Open

Nix package #7

keenanweaver opened this issue Jun 26, 2024 · 3 comments

Comments

@keenanweaver
Copy link

Howdy! Saw your video about the project and was inspired to package it up for Nix and NixOS. I'll be glad to maintain the package. I'll probably also wait for a full non-RC release to submit it to the nixpkgs repo. I can automate the dialout group setting, but that requires a Nix module which would need some more research and effort.

If you wanted to include install instructions in the readme, the user can do several things:

Run temporarily with nix-shell or nix run:
nix-shell -p openfire-app --run 'OpenFIREapp'
or
nix run nixpkgs#openfire-app -- 'OpenFIREapp'

Install to system or user packages via configuration.nix (NixOS only)

environment.systemPackages = with pkgs; [ openfire-app ];
users.users.yourUserName.packages = with pkgs; [ openfire-app ];

Install to home via home.nix (Any OS, requires nix & home-manager)

home.packages = with pkgs; [ openfire-app ];

Here's the actual package I'll be submitting. Builds from source, creates the desktop item. Mostly used the AUR package as a guide.

{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  qtbase,
  qttools,
  qtserialport,
  qtsvg,
  icu,
  copyDesktopItems,
  makeDesktopItem,
  wrapQtAppsHook,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "openfire-app";
  version = "2.0-rc3";

  src = fetchFromGitHub {
    owner = "TeamOpenFIRE";
    repo = "OpenFIRE-App";
    rev = "v${finalAttrs.version}";
    hash = "sha256-uq4aXA6YFsKRcByy5LqJPtPnImC0nx0iRHKM3BSbOAU=";
  };

  nativeBuildInputs = [
    cmake
    qtbase
    qttools
    qtserialport
    qtsvg
    icu
    copyDesktopItems
    wrapQtAppsHook
  ];

  desktopItems = [
    (makeDesktopItem {
      name = "OpenFIREapp";
      exec = "OpenFIREapp";
      icon = "org.TeamOpenFIRE.OpenFIREapp";
      desktopName = "OpenFIRE App";
      categories = [ "Utility" ];
      comment = "Configuration utility for the OpenFIRE lightgun system";
    })
  ];

  postInstall = ''
    mkdir -p $out/share/icons/hicolor/scalable/apps
    cp $src/ico/openfire.svg $out/share/icons/hicolor/scalable/apps/org.TeamOpenFIRE.OpenFIREapp.svg
  '';

  meta = {
    description = "Reference configuration/testing app for the OpenFIRE project, built in Qt/C";
    homepage = "https://github.com/TeamOpenFIRE/OpenFIRE-App";
    license = lib.licenses.gpl3Only;
    longDescription = ''
      In order to use the program successfully, add your username to the 'dialout' group with:
      ```nix
      users.users.yourUserName.extraGroups = [ "dialout" ];
      ```
    '';
    maintainers = with lib.maintainers; [ keenanweaver ];
    mainProgram = "OpenFIREapp";
    platforms = lib.platforms.linux;
  };
})

Now I have to look into getting a lightgun!

@SeongGino
Copy link
Member

Hiya, and thanks for the support!

I certainly welcome third party packaging; but I don't personally use nix or even know how it works, which is the only thing keeping me from being more enthusiastic or offering any more assistance.

But any more OpenFIRE exposure among the greater Linux certainly gets my full blessing. :)

@keenanweaver
Copy link
Author

Well, if you're interested in dropping down the biggest Linux rabbit hole imaginable, I'd recommend it!

I could also look into building a flatpak, as I haven't done that before. I think between a deb, flatpak, AUR, & nix packages, pretty much all bases are covered.

@SeongGino
Copy link
Member

I'm already behind on making Linux videos as it is, so it will be a long while before I get into nix, aha. x_x

But yeah, so long as the packages all work, I welcome the contributions! My only worry is if Flatpak's sandbox might make it a problem for accessing the serial devices properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants