[Nix-dev] Newbie experiences with NixOS

Vladimír Čunát vcunat at gmail.com
Tue Sep 9 20:37:58 CEST 2014


Hi,
I address some of the issues you wrote:

On 09/09/2014 07:24 PM, Gergö Barany wrote:
> - I found it puzzling that the package channel is to be set imperatively on
>    the command line rather than in the configuration file. This breaks the
>    nice property of the entire configuration being in one or more config
>    files.

I think the decision when to update the channel(s) needs to be done 
imperatively, as it is inherently impure and in many cases one does 
*not* want to update the channel (one may not want to update everything 
because of some minor config change).

Moreover, channels are also per-user, whereas configuration.nix is only 
global. ~/.nixpkgs/config.nix might be a suitable per-user place to add 
configuration of channel locations, although I don't feel strongly about 
that.

> - In the manual, it would be nice to have Appendix B avaiable as a single
>    HTML page separate from the rest of the manual. (Told you these were
>    minor comments.) That would make full-text search for some options easier.

Personally, I use "man configuration.nix" for that purpose. Also, IIRC 
the manual will be split into one page per section; I saw a preview of 
that a week or two ago, but apparently it is not so on the main web yet. 
Moreover, some web app for nixos option is being worked on, I think.


> Configuration:
>
> - I haven't gone very deep here, but if I add a user in configuration.nix
>    and do nixos-rebuild, and then modify the configuration to add extraGroups
>    (such as wheel) for that user and run nixos-rebuild --switch again, then
>    the extra group setting just seems to be ignored; the user is not added to
>    the group.
>    (Would it be OK to file this as a bug against nixpkgs? If not, what github
>    project should it be?)

It certainly belongs to the nixpkgs repository. I don't know these 
details, as I only use it on a single-user system with imperative user 
management.

> Package installation:
>
> - ghc. I didn't care about the exact version, just hoped that a
>    "meta-package" named "ghc" would work. Here's a complete config file I
>    tried:
> 	[...]
> When running "nixos-rebuild build" on this, it failed with:
> error: cannot coerce a set to a string, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix:98:79
>
> Needless to say, I never touched that file. If I recall correctly,
> specifying a *concrete* ghc package name did work. Using a generic name
> imperatively worked: "nix-env -i ghc" selects a derivation automagically and
> installs it.

The attribute path pkgs.ghc is *not* a package (which is a bit 
counter-intuitive naming, I guess). It is an attrmap of all ghc versions 
we build. nix-env without -A takes package names, which is something 
different than attribute paths.

I think haskellPackages.ghc is the preferred attribute path to the 
default ghc.


> - clementine (a music player). The issue here was that by default it depends
>    on the unfree libspotify package, but there is an option to install it
>    without this library. However, it didn't work for me:
>
> { config, pkgs, ... }:
> {
> # [...]
>    config.clementine.spotify = false;
>    environment.systemPackages = with pkgs; [
>      wget vim
>      clementine
>    ];
> }
>
> Trying to build this fails with:
> error: Module `/etc/nixos/configuration.nix' has an unsupported attribute `boot'.
>
> This appears to be some sort of internal error in nixos-rebuild, maybe with
> parsing the config file?

1) It should be nixpkgs.config.clementine.spotify = false; The error 
message is very unhelpful, I agree. I presume it is because the config 
attribute is reused in the attribute map when processing it.

2) I see the clementine on 14.04 branch still doesn't look at that 
setting. It always builds with spotify. On master it's without spotify 
by default and can be overridden by the config.


> - swt (a Java GUI toolkit, needed by some Java programs). Trying to install
>    this (with a config file as above, only with "swt" in the package list)
>    tries to download http://eclipse.ialto.com/eclipse/downloads/drops/R-3.7.2-201202080800/swt-3.7.2-gtk-linux-x86.zip
>    and fails, since that file (and the directory it is supposed to be in)
>    doesn't exist. A file with that name is available from a more official
>    source at
>    http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.7.2-201202080800/swt-3.7.2-gtk-linux-x86.zip
>    I tried remounting the package store read-write and copying this file to
>    the expected place, but the installer didn't pick it up from there, it
>    tried the broken mirror again. Is there a way to inject a manually
>    downloaded file into the build process, or to specify another download
>    URL, short of modifying the Nix expression for the package?

The paths in nix store have to be sanitized and registered by nix. For 
similar purposes there is the nix-prefetch-url command. In master we 
already use a valid URL, so I ported the change to 14.04.
( 
http://archive.eclipse.org/eclipse/downloads/drops/R-3.7.2-201202080800/swt-3.7.2-gtk-linux-x86.zip 
)


Vladimir


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3251 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140909/81512b10/attachment.bin 


More information about the nix-dev mailing list