Re: [Nix-dev] Best practices for replacing channels with my own package set?

2015-06-01 Thread Jeffrey David Johnson
Hmm I have that too but it doesn't work. Is yours like this (with myhead
for mypkgs)?

$ ls ~/.nix-defexpr/ -al
...
lrwxrwxrwx  1 jefdaj users   22 Apr 17 10:46 mypkgs -> /path/to/mypkgs
...

I think I found the other/main problem: `NIX_PATH` isn't
sticking during `nixos-rebuild` because I put it in
`environment.variables` instead of `environment.sessionVariables`. I
guess it's normally set in both and `sessionVariables` takes priority?
If I set it in the shell with `export NIX_PATH=...` then `nix-env`
works again. It also works when placed in `sessionVariables` as Herwig
said, but that causes other havoc (messing up the locale etc.):

with import ;
{
  ...
  environment.sessionVariables = lib.mkForce {
"NIX_PATH" = "/path/to/mypkgs";
  };
  ...
}

Am I looking for a way to union that with the defaults or maybe
`mkForce` a single attribute?
Jeff

On Mon, 1 Jun 2015 21:37:01 -0700
James Cook  wrote:

> I have a symlink from ~/.nix-defexpr/myhead to the nixpkgs tree I want to use.
> 
> James
> 
> On 1 June 2015 at 17:35, Jeffrey David Johnson  wrote:
> > Nevermind, that sets NIX_PATH but nix-env still errors out with:
> >
> > nix-env: src/libexpr/eval.hh:57: void nix::Bindings::push_back(const 
> > nix::Attr&): Assertion `size_ < capacity' failed.
> > Aborted
> >
> > Unless explicitly given the -f option.
> > Jeff
> >
> > On Tue, 2 Jun 2015 00:31:35 +0200
> > Herwig Hochleitner  wrote:
> >
> >> I set NIX_PATH in environment.sessionVariables (with an mkForce, to
> >> override the builtin one). nix-env and everything else should pick it up,
> >> that way, since that's the location it's predefined.
> > ___
> > nix-dev mailing list
> > nix-dev@lists.science.uu.nl
> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Best practices for replacing channels with my own package set?

2015-06-01 Thread James Cook
I have a symlink from ~/.nix-defexpr/myhead to the nixpkgs tree I want to use.

James

On 1 June 2015 at 17:35, Jeffrey David Johnson  wrote:
> Nevermind, that sets NIX_PATH but nix-env still errors out with:
>
> nix-env: src/libexpr/eval.hh:57: void nix::Bindings::push_back(const 
> nix::Attr&): Assertion `size_ < capacity' failed.
> Aborted
>
> Unless explicitly given the -f option.
> Jeff
>
> On Tue, 2 Jun 2015 00:31:35 +0200
> Herwig Hochleitner  wrote:
>
>> I set NIX_PATH in environment.sessionVariables (with an mkForce, to
>> override the builtin one). nix-env and everything else should pick it up,
>> that way, since that's the location it's predefined.
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Best practices for replacing channels with my own package set?

2015-06-01 Thread Jeffrey David Johnson
Nevermind, that sets NIX_PATH but nix-env still errors out with:

nix-env: src/libexpr/eval.hh:57: void nix::Bindings::push_back(const 
nix::Attr&): Assertion `size_ < capacity' failed.
Aborted

Unless explicitly given the -f option.
Jeff

On Tue, 2 Jun 2015 00:31:35 +0200
Herwig Hochleitner  wrote:

> I set NIX_PATH in environment.sessionVariables (with an mkForce, to
> override the builtin one). nix-env and everything else should pick it up,
> that way, since that's the location it's predefined.​
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Best practices for replacing channels with my own package set?

2015-06-01 Thread Jeffrey David Johnson
Thanks, the mkForce was what I was missing!
Jeff

On Tue, 2 Jun 2015 00:31:35 +0200
Herwig Hochleitner  wrote:

> I set NIX_PATH in environment.sessionVariables (with an mkForce, to
> override the builtin one). nix-env and everything else should pick it up,
> that way, since that's the location it's predefined.​
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] release-15.06 branch happening in 2 weeks

2015-06-01 Thread Eelco Dolstra
Hi,

On 01/06/15 18:54, Domen Kožar wrote:

> Branch was just created: https://github.com/NixOS/nixpkgs/tree/release-15.06

I feel we should hold off for a day or two more to get systemd 220, gcc 4.9 and
Nix 1.9 in, and to revert some recent changes to Nixpkgs that I feel should not
make it into a stable release. Yeah, we could cherry-pick all those changes, but
that will be a lt of cherry-picking...

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] [PATCH] Add a ‘verifyStore’ RPC

2015-06-01 Thread Ludovic Courtès
Hello!

The patch below adds a ‘verifyStore’ RPC with the same signature as the
current LocalStore::verifyStore method.

Thanks,
Ludo’.

>From aef46c03ca77eb6344f4892672eb6d9d06432041 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 
Date: Mon, 1 Jun 2015 23:17:10 +0200
Subject: [PATCH] Add a 'verifyStore' remote procedure call.

---
 src/libstore/remote-store.cc| 10 ++
 src/libstore/remote-store.hh|  1 +
 src/libstore/store-api.hh   |  4 
 src/libstore/worker-protocol.hh |  3 ++-
 src/nix-daemon/nix-daemon.cc| 10 ++
 5 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 3b2825c..ab87d9d 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -587,6 +587,16 @@ void RemoteStore::optimiseStore()
 readInt(from);
 }
 
+bool RemoteStore::verifyStore(bool checkContents, bool repair)
+{
+openConnection();
+writeInt(wopVerifyStore, to);
+writeInt(checkContents, to);
+writeInt(repair, to);
+processStderr();
+return readInt(from) != 0;
+}
+
 void RemoteStore::processStderr(Sink * sink, Source * source)
 {
 to.flush();
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index 14209cb..030120d 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -85,6 +85,7 @@ public:
 
 void optimiseStore();
 
+bool verifyStore(bool checkContents, bool repair);
 private:
 AutoCloseFD fdSocket;
 FdSink to;
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 97a60a6..3764f3e 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -254,6 +254,10 @@ public:
 /* Optimise the disk space usage of the Nix store by hard-linking files
with the same contents. */
 virtual void optimiseStore() = 0;
+
+/* Check the integrity of the Nix store.  Returns true if errors
+   remain. */
+virtual bool verifyStore(bool checkContents, bool repair) = 0;
 };
 
 
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index 4b040b7..d037d74 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -42,7 +42,8 @@ typedef enum {
 wopQueryValidPaths = 31,
 wopQuerySubstitutablePaths = 32,
 wopQueryValidDerivers = 33,
-wopOptimiseStore = 34
+wopOptimiseStore = 34,
+wopVerifyStore = 35
 } WorkerOp;
 
 
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index bed7de0..b3552a9 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -519,6 +519,16 @@ static void performOp(bool trusted, unsigned int clientVersion,
 writeInt(1, to);
 break;
 
+case wopVerifyStore: {
+	bool checkContents = readInt(from) != 0;
+	bool repair = readInt(from) != 0;
+	startWork();
+	bool errors = store->verifyStore(checkContents, repair);
+	stopWork();
+	writeInt(errors, to);
+	break;
+}
+
 default:
 throw Error(format("invalid operation %1%") % op);
 }
-- 
2.2.1

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


Re: [Nix-dev] nix-shell for a custom haskell library

2015-06-01 Thread Peter Jones
Dmitry Malikov  writes:
> I'm trying to setup a development environment for a custom haskell library
> basing on a tutorial by Oliver Charles
> (http://wiki.ocharles.org.uk/Nix).

FWIW I've been playing with Nix and Haskell a lot lately trying to come
up with the perfect development environment.  This is what I have so
far.  Everything below is done with a recent copy of nixpkgs.

I have a shell function called nix-hs-build that does the following:

# Create a default.nix for the Haskell project in $PWD:
nix-shell -p haskellPackages.cabal2nix \
  --command "cabal2nix $PWD $@ > default.nix"

# Build the project:
nix-hs-shell --command  $(which hsbuild.sh) "$@"

The contents of hsbuild.sh can be found here:

  https://gist.github.com/pjones/7a6023d3567ff2ed49bf

The `nix-hs-shell` command is another shell function that just runs
nix-shell with cabal-install and hlint in the environment so that
hsbuild.sh can work.  Here are the details:

function nix-hs-shell () {
  override=~/.nixpkgs/envs/dev/haskell-cabal.nix
  nix-shell -I pwd=$PWD --pure "$@" $override
}


Where haskell-cabal.nix contains:

{ nixpkgs  ? import  {}
, compiler ? "ghc7101"
}:

let
  pkgs = nixpkgs.pkgs;
  ghc  = pkgs.haskell.packages.${compiler};
  f= import ;
  drv  = ghc.callPackage f {};
in
  (pkgs.haskell.lib.addBuildTools drv [
ghc.cabal-install
ghc.hlint
  ]).env

With those pieces I can just run `nix-hs-build` without having to create
any sort of *.nix file by hand.  If I change the project's cabal file
and run `nix-hs-build` it will work since it generates the default.nix
again.  I can also change compilers with a flag:

nix-hs-build --compiler ghc784

> How to get Network.EngineIO available inside a nix-shell in this case?

Using my setup above, the library would be installed in ./dist

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

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


Re: [Nix-dev] release-15.06 branch happening in 2 weeks

2015-06-01 Thread Domen Kožar
Branch was just created: https://github.com/NixOS/nixpkgs/tree/release-15.06

Please use Pull Requests to merge any changes into the branch that are not
minor bugfixes or security fixes. Tag them with 15.06 milestone.

Domen

On Mon, May 25, 2015 at 10:44 AM, Domen Kožar  wrote:

> One week.
>
> On Mon, May 18, 2015 at 11:54 AM, Domen Kožar  wrote:
>
>> Hi all,
>>
>> I plan to branch-off release-15.06 on 1st of June. Then we have a month
>> for testing it out.
>>
>> Are there any reasons we should postpone the release? I see closures-size
>> branch won't make it and I'm fine if systemd 220 is late a week or so.
>>
>> Domen
>>
>
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Best practices for replacing channels with my own package set?

2015-06-01 Thread Jeffrey David Johnson
I'd like all the nix tools to reference my package repository, which is
called mypkgs and re-exports nixpkgs with some custom ones added. I
base it on the latest nixos-unstable revision so there should be
binaries available.

Currently I set NIX_PATH using `environment.interactiveShellInit`. That
seems to work for everything except nix-env, so I alias it to `nix-env
-f /path/to/mypkgs`. But I'm a little worried there might be parts of
the system still depending on ~/.nix-defexpr, /etc/nixos etc. Anything
else I should be doing?
Jeff
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Is $NIX_OTHER_STORES still supported?

2015-06-01 Thread Eelco Dolstra
Hi Peter,

On 31/05/15 11:33, Peter Simons wrote:

> I've been trying to make my NixOS re-use another machine's store, but
> I've had no success. I've mounted the other machine's file system as
> follows:
> 
>   # mkdir /run/nix/remote-stores/other
>   # sshfs -o allow_root other:/ /run/nix/remote-stores/other
> 
> The other's /nix directory is visible:
> 
>   # ls -ld $NIX_OTHER_STORES
>   drwxr-xr-x 1 root root 4096 Mar 27  2014 /run/nix/remote-stores/other/nix
> 
> However, my nix-env operations never seem to access that store, even
> though I know for sure that it contains the derivations I'm installing.
> 
> Is there anything else I have to do to activate this feature?

It's not enabled by default. You need to set NIX_SUBSTITUTERS to include
copy-from-other-stores.pl.

Check out the NixOS installer, which uses it to ensure that binaries are copied
from the installation CD:

https://github.com/NixOS/nixos/blob/master/modules/installer/tools/nixos-install.sh

However, NIX_OTHER_STORES might be removed at some point because it doesn't work
well anymore for access to remote stores since Nix started used SQLite.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] fetchFromGithub

2015-06-01 Thread Vladimír Čunát
On 06/01/2015 08:42 AM, Arseniy Seroka wrote:
> But how to get revision number from this for future use?

Ah, I'm sorry, I didn't read all properly. I see now what you meant, and
I've got no better solution.


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] Overriding Haskell dependencies

2015-06-01 Thread Peter Simons
Hi Michael,

 > Is there an easy way to import that file in my config.nix?

configuration-common.nix is a function like any other; just "import" it
into your scope.


 > I figure I'll need something like
 >
 >   fix (extend stackagePackages commonConfiguration)
 >
 > as in nixpkgs/.../haskell-modules/default.nix?

Yes, I guess so. Even though I'm not quite sure why you'd want to
re-define hackage-packages.nix to begin with. Wouldn't it be easier to
customize the existing package set to your needs rather than re-defining
it from the ground up?

Best regards,
Peter

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


[Nix-dev] override a haskellngPackage in shell.nix

2015-06-01 Thread Cody Goodman
I'm doing something wrong, could anyone help me out?

shell.nix:

with (import  {}).pkgs;

# Try to override haskellngPackages.protocol-buffers
let packageOverrides = pkgs: rec {
   myHaskellPackages =
 let
   callPackage = pkgs.lib.callPackageWith myHaskellPackages;
 in
   pkgs.recurseIntoAttrs (pkgs.haskellPackages.override {
 extension = self : super : {
   protocol-buffers = self.callPackage
./protocol-buffers-fork-2.0.16/shell.nix  {};
 };
   });
 };
pkg = haskellngPackages.callPackage
({ mkDerivation, aeson, attoparsec, base, bytestring, containers
 , directory, either, filepath, http-media, MissingH, mtl, riak
 , safe, scientific, servant, servant-server, stdenv, text
 , text-show, time, unordered-containers, uuid, vector, wai, warp
 , xml, xml-conduit
 }:
 mkDerivation {
   pname = "my-project";
   version = "0.1.0.0";
   sha256 = "0";
   isLibrary = false;
   isExecutable = true;
   buildDepends = [
 aeson attoparsec base bytestring containers directory either
 filepath http-media MissingH mtl riak safe scientific servant
 servant-server text text-show time
unordered-containers uuid vector
 wai warp xml xml-conduit
   ];
   license = stdenv.lib.licenses.unfree;
 }) {};
in
  pkg.env
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev