How to start using Nix(OS)

There is also another solution if you use flake and want to install the package system-wide (useful to test the .desktop file for instance and integration, or to use it until it is made available): you can add an input in your flake.nix like:

inputs.mqttx-pr.src = "github:gaelreyrol/nixpkgs/mqttx-init-1.9.4";

and in your configuration.nix, you should be able to add

environment.systemPackages = with pkgs; [
  # your other packages ...
   inputs.mqttx-pr.legacyPackages.${system}.mqttx
];

in your list of installed packages. To make sure that system is well defined, you certainly need to also add system in the first line of your configuration.nix like:

{ inputs, config, pkgs, lib, system, ... }:

and change in flake.nix the specialArgs line like:

specialArgs = { inherit inputs; inherit system; };

First of all it has to go through and it would be good if it didn’t write everywhere. Just like when compiling applications, where “sudo make install” first distributes files in the file system…

Führen Sie
git config --global user.email “you@example.com
git config --global user.name “Your Name”

That would be my personal github account??

Schwerwiegend: Konnte die E-Mail-Adresse nicht automatisch erkennen (‘wolf@schwoon-desktop.(none)’ erhalten)

I don’t understand what you mean, if you don’t want to pollute your home directory with a clone of nixpkgs, you can clone it in /tmp. The clone is a choice of nixpkgs-review, mostly to avoid losing time when reviewing many packages (otherwise, each review would download the whole nixpkgs project, that is not so small).

The git config command they ask you to type is just some information that identify your git commits, so you can put any value here (just any time you do a git commit, it will add this information to your commit)

Actually, I’m thinking that you can even do a test without nixpkgs-review, by running simply:

$ nix run github:gaelreyrol/nixpkgs/mqttx-init-1.9.4#mqttx

and if you like it, you can even install it imperatively (see above for declarative instructions) with:

$ nix profile install github:gaelreyrol/nixpkgs/mqttx-init-1.9.4#mqttx

Ok, added my mail and name and tried the first way… Seems to work, but can later check the connections…

No problem. 4 TB disk built in…

Actually just saw this NixOS on raspberry pi zero w - #11 by rnhmjoj, you might be interested if you still want a minimal image for your hp drive.

Great, feel free to report on th GH page that it is working then! Nix is always in need of reviewers so your help would be greatly appreciated.

Hello
To be honest, I haven’t yet managed to see a tree view of the topics where i can then use the mouse to look at that one that interests me. The MQTT Explorer can do that ootb and the console application mqttui can also do something similar.

Btw. Yesterday i would like to program my hamradio transceiver with “EDITCP”, but that is not available. I think that i’m not the only one that needs that program. Makes it sense to do a request for it like described here:
Package request

https://www.farnsworth.org/dale/codeplug/editcp/downloads/linux/

Tnx…

Sure, you can always submit a package request. I tried to package the binary, and it seems to work without any issue. To test it, just create a file editcp.nix containing:

# to load the udev rule, add me to services.udev.packages as well (I think you need both here and in
# environment.systemPackages), like:
# {
#   environment.systemPackages = [
#     # ...
#     pkgs.libsForQt5.callPackage ./editcp.nix {}
#   ];
#   services.udev.packages = [
#     pkgs.libsForQt5.callPackage ./editcp.nix {}
#   ];
# }
#

{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, wrapQtAppsHook
, libusb
}:

stdenv.mkDerivation rec {
  pname = "editcp";
  version = "1.0.31";

  src = fetchurl {
    url = "https://www.farnsworth.org/dale/codeplug/editcp/downloads/linux/editcp-${version}.tar.xz";
    sha256 = "sha256-wxj+PMJBynVub+X4W525BkbqMpG4H0afwJPhxF8TFko=";
  };

  nativeBuildInputs = [ autoPatchelfHook wrapQtAppsHook ];
  buildInputs = [ libusb ];
  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/lib/udev/rules.d/
    cp editcp $out/bin
    cp *.rules $out/lib/udev/rules.d/
  '';

  meta = with lib; {
    homepage = "https://github.com/dalefarnsworth-dmr/editcp";
    description = "";
    longDescription = ''
      
    '';
    license = licenses.gpl3;
    maintainers = with maintainers; [ tobiasBora ];
  };
}

and a file default.nix containing:

{ pkgs ? import <nixpkgs> {} }:
pkgs.libsForQt5.callPackage ./editcp.nix {}

then to try it:

$ nix-build
$ ./result/bin/editcp

Note that to actually use it, you might need to run it as root or install it via services.udev.packages in order to install the udev files, like:

# in your /etc/nixos/configuration.nix
 {
  environment.systemPackages = [
    # ...
    (pkgs.libsForQt5.callPackage ./editcp.nix {})
  ];
  services.udev.packages = [
    (pkgs.libsForQt5.callPackage ./editcp.nix {})
  ];
}

In that case, the default.nix is not helpful.

I also tried to build it from source, but I get an error undefined: NewDelayedCallStruct as reported here Building editcp under macOS/darwin · Issue #11 · dalefarnsworth-dmr/editcp · GitHub but I’m not sure how to avoid this issue.

Oh, thanks for your work. Tomorrow i can make a test… The editcp.nix is because my system is flake enabled? Until now i have no other nix file added…

No, completely unrelated to flake here. nix-build is a legacy nix command. To install it systemwise, you just need to write the editcd.nix (the name does not really matter if you adapt the callPackage line) in /etc/nixos/editcd.nix and add the above configuration to your configuration.nix. You also put everything in a single file but it is less readable, hence my use of editcd.nix.

yes, that works.

No, it does not need root, exept at the build because of:

Running phase: postPatchMkspecs
error: creating symlink from ‘/etc/nixos/result.tmp-3778-1380687920’ to ‘/nix/store/6qr0v8b97j71msa0580g8i48p115rqqa-editcp-1.0.31’: Permission denied

That means i have to remove the default.nix?

environment.systemPackages = [
    # ...
    pkgs.libsForQt5.callPackage ./editcp.nix {}
  ];

That looks like the line where i added my complete package “collection”, but with = with phks; above. Can i add that in addition , so there are two env…systempackages lines…

Yeah, that’s what I meant (I don’t even think it is legal to have this entry defined twice), just add (pkgs.libsForQt5.callPackage ./editcp.nix {}) in that list (actually, I forgot to add the parens above, make sure to add them. Also,with pkgs; just mean that you can remove the pkgs. if you want)

Great

I was not mentionning build time, but at run time since it might try to access hardware where you need root access or udev rules to allow access to them. If it works without, great. The error you got is just because you tried to run nix-build from the /etc/nixos folder, that is owned by root. But you can build with user rights in any folder owned by the user.

Well, if you don’t plan to run nix-build anymore but only nixos-rebuild switch, sure, you can remove it. If you want to debug this package further with nix-build, you can keep the default.nix: nix-build will just look for this file by default to know what to build; nixos-rebuild will look for other files (/etc/nixos/{flake.nix|configuration.nix}).

If you want a desktop entry (to launch from the Plasma application launcher), you can use instead:

# to load the udev rule, add me to services.udev.packages as well (I think you need both here and in
# environment.systemPackages), like:
# {
#   environment.systemPackages = [
#     # ...
#     (pkgs.libsForQt5.callPackage ./editcp.nix {})
#   ];
#   services.udev.packages = [
#     (pkgs.libsForQt5.callPackage ./editcp.nix {})
#   ];
# }
#

{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, wrapQtAppsHook
, libusb
, copyDesktopItems
, makeDesktopItem
}:

stdenv.mkDerivation rec {
  pname = "editcp";
  version = "1.0.31";

  src = fetchurl {
    url = "https://www.farnsworth.org/dale/codeplug/editcp/downloads/linux/editcp-${version}.tar.xz";
    sha256 = "sha256-wxj+PMJBynVub+X4W525BkbqMpG4H0afwJPhxF8TFko=";
  };

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      desktopName = "Editcp";
      exec = "editcp";
      icon = "editcp"; #
      comment = "Codeplug editor for the MD-380/MD-390/MD40/MD-UV380/MD-UV390 DMR radios";
      categories = [ "Development" "IDE" ];
    })
  ];
  
  nativeBuildInputs = [ autoPatchelfHook wrapQtAppsHook copyDesktopItems ];
  buildInputs = [ libusb ];
  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    mkdir -p $out/lib/udev/rules.d/
    cp editcp $out/bin
    cp *.rules $out/lib/udev/rules.d/

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/dalefarnsworth-dmr/editcp";
    description = "Codeplug editor for the MD-380/MD-390/MD40/MD-UV380/MD-UV390 DMR radios";
    license = licenses.gpl3;
    maintainers = with maintainers; [ tobiasBora ];
  };
}

Hmm, there is something wrong.

https://paste.simplylinux.ch/view/5beaaefb

You forgot the parenthesis around (pkgs.libsForQt5.callPackage ./editcp.nix {}) as explained above

omg… but without pkgs. in my case…?

both with pkgs. and without pkgs. will work.

and same, add parenthesis in the services.udev.packages part.

WTF. Its building now. In germany we say “wer lesen kann, ist klar im Vorteil”