Re: [Nix-dev] Nix expression built-in type limitations

2015-05-01 Thread Shea Levy
Hello,

 On Apr 30, 2015, at 4:45 PM, Terrance Kennedy terrancerkenn...@gmail.com 
 wrote:
 
 Hi,
 
 I'm working on a Python project to convert Python built-in types to Nix 
 built-in types and it raised some quesions on the limitations of built-in Nix 
 types. I've been able to gather some information using nix-repl and reading 
 the Nix expression parser code, but am not sure on the following:
 
 - Integer: Appear to be either 32 or 64 bit signed integer depending on the 
 underlying architecture. Is this correct?

Integers are mapped to the C++ long type [1].

 - String: From what I can tell, since Nix strings are based on C++ 
 std::string, they don't enforce or expect any kind of encoding. Is it 
 recommended or tested to put non-ASCII data (in any encoding) into a Nix 
 string? What about binary data?

Strings are stored as null-terminated char arrays[2]*. Any char besides 0 can 
safely be stored in them, but if you try to display them they will be treated as
ASCII.

 - Path: Are there any disallowed characters in a Nix path? How can one 
 represent paths with whitespace?
 

Path literals are determined by [3], but you can append a string to a path, so
e.g. (./. + /filename with spaces.txt) will result in a path with spaces in
the name.

 Cheers,
 - Terrance
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

* They also have associated context, which is irrelevant for the purposes of 
this
  question.
[1]: https://github.com/NixOS/nix/blob/1.8/src/libexpr/value.hh#L38
[2]: https://github.com/NixOS/nix/blob/1.8/src/libexpr/value.hh#L115
[3]: https://github.com/NixOS/nix/blob/1.8/src/libexpr/lexer.l#L82
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] gold linker in shell.nix

2015-05-01 Thread Nikita Karetnikov
How do I link with gold in nix-shell?
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] How to bootstrap a server using Nixops?

2015-05-01 Thread Jeffrey David Johnson
On Fri, 1 May 2015 08:46:14 +
Rob Vermaas rob.verm...@gmail.com wrote:

 Hi Jeff,
 
 
 On Thu, Apr 30, 2015 at 11:17 PM, Jeffrey David Johnson jef...@gmail.com
 wrote:
 
  It's possible I'm getting the wrong idea about what nixops is for, but I
  used
  it to set up an Amazon EC2 instance with the idea of logging into the
  server
  and administering it using local commands afterward.
 
 
 That's an interesting and unexpected usecase of nixops. I wouldn't use
 nixops at all if you plan on doing this. Why not just start instance in the
 Amazon AWS Console or using the command line tools of AWS? (for ami's see
 https://nixos.org/wiki/NixOS_on_Amazon_EC2)

You're right that looks more like what I wanted! Sorry just didn't see
it before. I'll post my scripts below for clarification but don't worry
about troubleshooting them. I wonder if the NixOps manual should
include a link to that page? Something like If you just want to
install NixOS on the server, see here instead. It's the kind of
distinction, like installing the OS itself to a USB drive vs installing
the LiveCD installer, that seems obvious in hindsight but new
people might miss.

  The initial install goes
  fine. Afterward I clone my nixcfg repo (including nixpkgs submodule) and
  try to
  set it up the way I would a physical machine, by copying everything from
  /etx/nixos/* into nixcfg/configs/cyno.nix and modifying it to
  point inside the repo:
 
  { config, pkgs, ... }:
 
  {
imports = [
  ../nixpkgs/nixos/modules/virtualization/amazon-config.nix
];
ec2.hvm = true;
services.journald.rateLimitBurst = 0;
  }
 
 
  When I do a `nixos-rebuild` (part of install.sh) though, it gives this
  error:
 
  [root@cyno:~/nixcfg]# ./install.sh test
  building Nix...
  error: getting status of
  ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
  such file or directory
  (use ‘--show-trace’ to show detailed location information)
  error: getting status of
  ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
  such file or directory
  (use ‘--show-trace’ to show detailed location information)
  building the system configuration...
  error: getting status of
  ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
  such file or directory
  (use ‘--show-trace’ to show detailed location information)
 
  Now I notice something strange:
  /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix
  exists, but
  `ls` throws an error when listing it:
 
  ls /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix
  ls: cannot access
  /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix: No
  such file or directory
 
  If I approach it slowly by listing /root/nixcfg, then
  /root/nixcfg/nixpkgs,
  all the way to the full path it *does* work. I googled around a little and
  according to this:
 
  http://superuser.com/questions/446280/no-such-file-or-directory
 
  The error can also mean a missing dynamically linked library. So I tried
  ldd as
  directed (though I don't understand the output), and got this:
 
  ldd $(which ls)
  linux-vdso.so.1 (0x7fff01dec000)
  libacl.so.1 =
  /nix/store/6mz0jhl389h7panazs5sayrydajia1s2-acl-2.2.52/lib/libacl.so.1
  (0x7f55d0f54000)
  libc.so.6 =
  /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/libc.so.6
  (0x7f55d0bb7000)
  libattr.so.1 =
  /nix/store/ndszpck395bi55jnz50ny99y4pvj6dqn-attr-2.4.47/lib/libattr.so.1
  (0x7f55d09b3000)
 
  /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/ld-linux-x86-64.so.2
  (0x7f55d115c000)
 
  Anyway I think there's something wrong with how the system is set up, but
  not
  sure what. Is there a correct way to bootstrap it to the point of using
  the same config as my other machines?
 
 
 Can you perhaps show us the contents of install.sh? Can you give us the AMI
 that was used (see AWS Console or commandline tools) ? Also, how did you
 copy the contents of /etc/nixos/* to /root/nixcfg ? I have never seen this
 behavior before, and tested something similar yesterday successfully.

install.sh is just a wrapper to point nixos-rebuild to my repo:

#!/usr/bin/env bash
# Automates rebuilding nixos from my repos.
# Takes the same args as nixos-rebuild.
# TODO also put NIXPKGS_CONFIG in here instead of home dir

NIXCFG=$(cd $(dirname ${BASH_SOURCE[0]})  pwd)
[[ -z $@ ]]  NIXARGS=test --fast || NIXARGS=$@

nixos-rebuild \
  -I mypkgs=${NIXCFG}/mypkgs \
  -I nixpkgs=${NIXCFG}/nixpkgs \
  -I nixos-config=${NIXCFG}/configs/$(hostname).nix \
  ${NIXARGS}

Sorry I should have been clearer about copied, I just meant I wrote
nixcfg/configs/cyno.nix to match what I thought the contents
of /etx/nixos did: import amazon-config.nix and set a couple other
settings. The other files seemed redundant with ones in nixpkgs,
which was the next thing I planned to figure out. I tried importing the
file with this notation too:

[Nix-dev] Some package outputs not linked into the system profile

2015-05-01 Thread Tim Williams
Hi all,

Last weekend I installed my first full NixOS system on my Thinkpad and
overall everything went relatively smoothly (I was brave enough to
try the unstable channel). I added all desired packages to
environment.systemPackages to start with, but have since noticed that
not all build outputs have been linked into the system
profile /run/current-system/sw and are thus not in my path. For
example, the poppler-utils package results in symlinks in bin and lib
if installed into my user profile via nix-env, but under the system
profile I can see only the library symlinks under lib. I've also
noticed this with other packages, e.g. none of the gtk themes in
gnome-themes-standard show up in share under the system profile, but
they do under the user profile. Can this behaviour be easily explained?
The workaround is obvious, but it would be nice to understand what is
going on.

Many thanks,
Tim
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] How to bootstrap a server using Nixops?

2015-05-01 Thread Rob Vermaas
Hi Jeff,


On Thu, Apr 30, 2015 at 11:17 PM, Jeffrey David Johnson jef...@gmail.com
wrote:

 It's possible I'm getting the wrong idea about what nixops is for, but I
 used
 it to set up an Amazon EC2 instance with the idea of logging into the
 server
 and administering it using local commands afterward.


That's an interesting and unexpected usecase of nixops. I wouldn't use
nixops at all if you plan on doing this. Why not just start instance in the
Amazon AWS Console or using the command line tools of AWS? (for ami's see
https://nixos.org/wiki/NixOS_on_Amazon_EC2)


 The initial install goes
 fine. Afterward I clone my nixcfg repo (including nixpkgs submodule) and
 try to
 set it up the way I would a physical machine, by copying everything from
 /etx/nixos/* into nixcfg/configs/cyno.nix and modifying it to
 point inside the repo:

 { config, pkgs, ... }:

 {
   imports = [
 ../nixpkgs/nixos/modules/virtualization/amazon-config.nix
   ];
   ec2.hvm = true;
   services.journald.rateLimitBurst = 0;
 }


 When I do a `nixos-rebuild` (part of install.sh) though, it gives this
 error:

 [root@cyno:~/nixcfg]# ./install.sh test
 building Nix...
 error: getting status of
 ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
 such file or directory
 (use ‘--show-trace’ to show detailed location information)
 error: getting status of
 ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
 such file or directory
 (use ‘--show-trace’ to show detailed location information)
 building the system configuration...
 error: getting status of
 ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No
 such file or directory
 (use ‘--show-trace’ to show detailed location information)

 Now I notice something strange:
 /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix
 exists, but
 `ls` throws an error when listing it:

 ls /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix
 ls: cannot access
 /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix: No
 such file or directory

 If I approach it slowly by listing /root/nixcfg, then
 /root/nixcfg/nixpkgs,
 all the way to the full path it *does* work. I googled around a little and
 according to this:

 http://superuser.com/questions/446280/no-such-file-or-directory

 The error can also mean a missing dynamically linked library. So I tried
 ldd as
 directed (though I don't understand the output), and got this:

 ldd $(which ls)
 linux-vdso.so.1 (0x7fff01dec000)
 libacl.so.1 =
 /nix/store/6mz0jhl389h7panazs5sayrydajia1s2-acl-2.2.52/lib/libacl.so.1
 (0x7f55d0f54000)
 libc.so.6 =
 /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/libc.so.6
 (0x7f55d0bb7000)
 libattr.so.1 =
 /nix/store/ndszpck395bi55jnz50ny99y4pvj6dqn-attr-2.4.47/lib/libattr.so.1
 (0x7f55d09b3000)

 /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/ld-linux-x86-64.so.2
 (0x7f55d115c000)

 Anyway I think there's something wrong with how the system is set up, but
 not
 sure what. Is there a correct way to bootstrap it to the point of using
 the same config as my other machines?


Can you perhaps show us the contents of install.sh? Can you give us the AMI
that was used (see AWS Console or commandline tools) ? Also, how did you
copy the contents of /etc/nixos/* to /root/nixcfg ? I have never seen this
behavior before, and tested something similar yesterday successfully.

Cheers,
Rob

-- 
Rob Vermaas

[email] rob.verm...@gmail.com
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Nix expression built-in type limitations

2015-05-01 Thread Terrance Kennedy
Hi,

I'm working on a Python project to convert Python built-in types to Nix
built-in types and it raised some quesions on the limitations of built-in
Nix types. I've been able to gather some information using nix-repl and
reading the Nix expression parser code, but am not sure on the following:

- Integer: Appear to be either 32 or 64 bit signed integer depending on the
underlying architecture. Is this correct?
- String: From what I can tell, since Nix strings are based on C++
std::string, they don't enforce or expect any kind of encoding. Is it
recommended or tested to put non-ASCII data (in any encoding) into a Nix
string? What about binary data?
- Path: Are there any disallowed characters in a Nix path? How can one
represent paths with whitespace?

Cheers,
- Terrance
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Some package outputs not linked into the system profile

2015-05-01 Thread Vladimír Čunát
Hi.

On 05/01/2015 09:30 PM, Tim Williams wrote:
 Can this behaviour be easily explained?

Explanation is easy: if a multiple-output derivation is used as a build
input or systemPackages, only the first output is meant (in the current
master).

Until recently, multiple outputs were rather rare, and a better
framework for them is currently brewed in the closure-size branch (by me
mostly so far). I would prefer to address such issues in that branch or
after its eventual merge.

Vladimir




smime.p7s
Description: S/MIME Cryptographic Signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] gold linker in shell.nix

2015-05-01 Thread Vladimír Čunát
On 05/01/2015 06:21 PM, Nikita Karetnikov wrote:
 How do I link with gold in nix-shell?

Stdenv should put ld.gold on PATH, so then it can be used just as
ld.gold is used, I guess.

Vladimir




smime.p7s
Description: S/MIME Cryptographic Signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev