travisbhartwell/nix-emacs

Getting: 'Warning: Cannot find nixos option file.'

Anton-Latukha opened this issue · 3 comments

Good day to you Travis.

Thank you for your package.

I have next setup and situation and try to figure it out:

Circumstances:

Syndrome:

When trying to search with helm-nixos-options, I on any input string get:

Error running timer: (error "In 'NixOS Options' source: 'nixos-options' must be a list, a symbol bond to a list, or a function returning a list ")

I also saw an error:

Warning: Cannot find nixos option file.

Can you help me out and say what is it.

It was not working on Archlinux with Nix.
But it is working on NixOS.

Probably - it needs to determine does runing on NixOS, and the error message should point-out that NixOS Options do not work without NixOS.

How hard would it be to get it to work on non-nixos systems? I do a lot of nix dev work on darwin.

I ran into this problem on NixOS and did a bit of digging. The nixos-options are generated as a json file and the path to that file is stored in a defvar. My issue was that my shell was spitting out some error-cruft that was being stored in that variable, and that of course didn't point to that correct file.

Your issue @gavinrogers might be that you don't have nix-build on your system? A potential solution would be generating the options file by hand, and then pointing the nixos-options-json-file variable at your file.

Here is the code responsible: https://github.com/travisbhartwell/nix-emacs/blob/master/nixos-options.el

As long as the nixos-options-json-file variable points at a file generated by the

export NIXPKGS_ALLOW_UNFREE=1; nix-build -Q --no-out-link '<nixpkgs/nixos/release.nix>' -A options 2>/dev/null

command, I'm guessing this should all just work.