I’m trying to set up OpenSnitch, but there are some packages that I declare as pkgs.name, but I find them as /nix/store/.../name-1.2.3-extracted or /nix/store/.../name-1.2.3-unwrapped, there is no such version for this packages in the Nix Repo, and the store location id is different. How can I declare this differences?
I also need help with the syntax of the JSON config file, I added services.opensnitch.settings = "/home/username/config.json";
but the syntax from upstream is not accepted and there’s no documentation for JSON syntax in NixOS.
This is just electron.unwrapped. As I said, pop open a REPL, poke around.
I literally gave you this one in my previous post.
Oh, this is an AppImage. Those suck. To get at this, and this often but doesn’t always work, try appimageTools.extract { inherit (tutanota-desktop) pname version src; }.
I checked the sources and saw ungoogled-chromium is just chromium with additional flags, this doesn’t appear anywhere, how could I find that out by myself?
I don’t know what a REPL is or what do you want me to do. electron.unwrapped is not in the repo, I only see electron, electron-bin and electron-chromedriver, none of which works.
Because this is a subtle point: a Nix expression that evaluates to a derivation, like electron, electron.unwrapped, or even appimageTools.extract { inherit (tutanota-desktop) pname version src; }, will look like «derivation /nix/store/....drv» in the REPL. But the path displayed there is the path of the derivation in the store; the path that the derivation is responsible for creating is called outPath (some derivations have other outputs, but let’s not get into that right now).
You can see outPath in the REPL by adding .outPath to the expression, as you saw me do above, but you also get the outPath when interpolating a derivation into a string, like with
This holds equally for more complicated expressions like appimageTools.extract { inherit (tutanota-desktop) pname version src; }. You can get its output path like this:
(appimageTools.extract { inherit (tutanota-desktop) pname version src; }).outPath
or like this:
"${appimageTools.extract { inherit (tutanota-desktop) pname version src; }}"
though in a config file, most of us would define a local variable like this:
let
tutanota-desktop-extracted = appimageTools.extract { inherit (tutanota-desktop) pname version src; };
in
"${tutanota-desktop-extracted}/tutanota-desktop"
All the nix repl stuff is wizardry to me. Anyway, adding .unwrapped after electron, thus ${pkgs.electron.unwrapped}, seems to work, I will try adding it to those packages from now on.
But I don’t understand the AppImage thing, it gives back this error error: undefined variable 'appimageTools'
I guess there’s probably a universal thing to append here too, but .extracted doesn’t work.
You’re among wizards now. Declining to face it will only keep you helpless. If you don’t want to learn the tools, this may not be the distro for you.
undefined variable means that appimageTools isn’t a name in scope. Nothing you put after that will help. In this case, appimageTools should be just another thing you get from pkgs, like your packages.
Can you paste a copy of what you’ve tried? Either config or REPL transcript? This really shouldn’t be a question of what you have installed or anything like that.
Or, some prefer just nix repl and then, after entering the REPL:
nix-repl> :l <nixpkgs>
Same effect either way. If you see Added 22925 variables. or some similarly large number, it worked. Among those 22k variables will be tutanota-desktop and appimageTools.
The blog post I linked before covers this and lots of other getting-started details.
Ok, that expression gave me the correct /nix/store path derivation as output. But how do I get the declarative option to get that path for the configuration.nix file?
I also tried with ungoogled-chromium and electron as you did, but I can’t see the options .browser and .unwrapped, I ony got those because of you.
If I try nix-repl> tutanota-desktop.extracted I get
error: attribute 'extracted' missing
Getting started? Really? That seems more like postgraduate stuff
Same thing. Use the REPL as a fast way to find the right expressions to use in your config. You’ll need to get things from pkgs, so for example, ungoogled-chromium.browser will have to be pkgs.ungoogled-chromium.browser, and more complicated expressions will need another pkgs. before each variable (or you can ‘cheat’ and preface the entire expression with with pkgs;, which is considered poor form in large expressions but for a one-liner can make things clearer IMO).
Okay, do you know about tab completion? (If you don’t, search it!) It works the same way in the Nix REPL as it does in a generic Linux terminal. (Other terminal tricks like using the up-arrow to summon up a previous line work in the REPL too.)
Yes, again, tutanota-desktop is derived from an AppImage, so you’ll need to use appimageTools to rederive the path to the extracted files.
Ok I think I get it now, so with electron and ungoogled-chromium I would have to guess what to put after the period and try one by one until I find the correct path,
but with Appimages this can’t be done and must be evaluated differently,
but adding something like ${pkgs.ungoogled-chromium.browser} won’t do and I need a more complicated expression. Correct?
But (appimageTools.extract { inherit (tutanota-desktop) pname version src; }).outPath is not accepted in the configuration file, so I don’t know how to invoke the whole thing. Does the rederivation happen in nix repl? If so how?
Yup, though if you know you’re looking for /nix/store/…-electron-unwrapped-33.3.0, and you see electron.unwrapped in the list of things after you type electron. and hit Tab, that’s a good guess to try first! Chromium is admittedly harder to figure out.
Well, that should work for ungoogled-chromium. But if you mean that you won’t find an equivalently simple expression for AppImage-based packages, that’s correct.
It should be, once you’ve either put pkgs. in front of all the variables, inherited them from pkgs, or used a with pkgs;. (The final .outPath is unnecessary if you’re interpolating.)