Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-04 Thread John Ramsden
Oh I see, that clear things up a bit.

On Wed, May 3, 2017, at 11:50 PM, Marc Weber wrote:
> configuration.nix option nixpkgs.config is what ~/.nixpkgs/config.nix is
> for the user in case you missed it.
> 
> Thus:
> 
>   nixpkgs.config.allowUnfree = true;
>   nixpkgs.config.packageOverrides = p: .. 
> 
> You don't have to use config.nix if this is all you need.
> 
> Marc Weber

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-04 Thread Marc Weber
configuration.nix option nixpkgs.config is what ~/.nixpkgs/config.nix is for 
the user in case you missed it.

Thus:

  nixpkgs.config.allowUnfree = true;
  nixpkgs.config.packageOverrides = p: .. 

You don't have to use config.nix if this is all you need.

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-04 Thread Marc Weber
1) misc.* is best looked by using ctagsWrapped on nixpkgs then looking
  for misc. (or use grep)

  You'll find pkgs/misc/misc.nix:

collection = {list, name} : runCommand "collection-${name}" {} ''
  mkdir -p $out/nix-support
  echo ${builtins.toString list} > 
$out/nix-support/propagated-user-env-packages
'';

2)
  If you had a look at other examples you'd try such:

  { ... }:
  {

allowUnfree = true;

packageOverrides: p: {
  myCollection = pkgs.misc.collection {
name = "graphic";
list = [pkgs.vlc];
  }
}
  }

  then you can nix-env -iA myCollection or such

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-04 Thread Nawal Husnoo
Using that repo, I have been able to reach what I was looking for: my
system config uses configuration.nix, just for the system, and internet
facing stuff, where I really want to follow the release channel to make
sure I use the latest.

For my user stuff, I now have a config.nix:

$ cat ~/.config/nixpkgs/config.nix
# nix-env -i all
# https://github.com/kamilchm/.nixpkgs/blob/master/config.nix

with import  {};

{
allowUnfree = true;

packageOverrides = pkgs_: with pkgs_; {
eterm = import ./eterm {
inherit (pkgs) stdenv fetchurl pkgconfig imlib2 libast;
libX11 = xorg.libX11;
libXext = xorg.libXext;
libXaw = xorg.libXaw;
};



all = with pkgs; buildEnv {
name = "all";
paths = [
eterm
vlc
];
};
};
}

where the vlc is being pulled from the system channel, but the Eterm is
being built with my modified version of the original, to include the
unicode bits:

$ cat ~/data/nixos/user/eterm/default.nix
{ stdenv, fetchurl
, libX11, libXext, libXaw
, pkgconfig, imlib2, libast }:

stdenv.mkDerivation rec {
name = "eterm-${version}";
version = "0.9.6";
srcName = "Eterm-${version}";

src = fetchurl {
url = "http://www.eterm.org/download/${srcName}.tar.gz;;
sha256 = "0g71szjklkiczxwzbjjfm59y6v9w4hp8mg7cy99z1g7qcjm0gfbj";
};

configureFlags = "--enable-multi-charset=utf-8";

buildInputs = [ libX11 libXext libXaw pkgconfig imlib2 ];
propagatedBuildInputs = [ libast ];

meta = with stdenv.lib; {
description = "Terminal emulator";
homepage = "http://www.eterm.org;;
license = licenses.bsd2;
maintainers = [ maintainers.AndersonTorres ];
platforms = platforms.linux;
};
}

I install all of the above with nix-env -i all, as a user - so this is, if
I understand correcly, per-user as you are seeking too. Does that make
sense?
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-04 Thread John Ramsden
On Wed, May 3, 2017, at 10:33 PM, Kamil Chmielewski wrote:
> Hi John,
> you could find my https://github.com/kamilchm/.nixpkgs helpfull.
> I use config.nix to manage user pacakges and dofiles and link them
> into ~ with simple script
> https://github.com/kamilchm/.nixpkgs/blob/master/install.sh> Best regards,
> Kamil
> 

This was one of the examples I actually found in my searching.  I was
planning on integrating some of your ideas into my configuration.
I was more looking for an explanation of how config.nix and profile.nix
works though.
I guess what I'm getting from this, if I'm understanding correctly, is
that if I want to manage my packages in this way I need to wrap them in
a function that installs all of the packages as a package.
Also, that there's no way to do configuration on a per-user basis.

---

Regarding my comment about not wanting to use nix-env, what I meant is I
don't like to install packages from the shell on a per package basis, it
makes me feel like I don't know what exactly is on the system. I like
having the configuration be as close to what is in my /etc/nixos/ files.
I was hoping there was a way to do the equivalent on a per user basis
when I run nixos-rebuild, it sounds like that is in the works.  What
does the expected date look like for nixup?
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Nawal Husnoo
$ cat ~/.config/nixpkgs/config.nix
with import  {};

{
allowUnfree = true;

graphicCollection = misc.collection {
name = "foo" ;
packages = [
   vlc
];
};
}


$ nix-env -i misc.collection.graphicCollection
error: selector ‘misc.collection.graphicCollection’ matches no
derivations


On 4 May 2017 at 06:31, Marc Weber  wrote:

>
> > I don't like the idea of using nix-env,
> Why? You can also have your own declarative set of packages "per user".
> that's also something config.nix can do:
> graphicCollection = misc.collection { name = ... ; packages = [ ... . ]}
> (from head)
>
> nix-env -i graphicCollection
>
> works well for me :)
>
> Marc Weber
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Marc Weber
Or ask google "nix/os/nixpkgs config.nix" to find samples and get
inspiration from
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Kamil Chmielewski
Hi John,

you could find my https://github.com/kamilchm/.nixpkgs helpfull.
I use config.nix to manage user pacakges and dofiles and link them into ~
with simple script
https://github.com/kamilchm/.nixpkgs/blob/master/install.sh

Best regards,
Kamil

2017-05-04 3:55 GMT+02:00 John Ramsden :

> Thanks, for the information.
>
> Marc Weber mentioned
>
> 1) you can install system wide (nixos-rebuild ..)
>> 2) you can install as user into ~/.nix-profile.nix
>>
>>~/.config.nix is to "customize" user nixpkgs by
>>- setting settings such as allowUnfree
>>- override mplayer to use library X
>>- add your own packages FOO
>>
>
> In that case, if I did list my own packages in ~/.nix-profile.nix, would
> that install only into that user profile?
>
> When I run nixos-rebuild switch does that rebuild the user profiles as
> well?
>
> I don't like the idea of using nix-env, and I have strayed away from it on
> NixOS, the idea of having all my configuration explicitly written out in
> configuration files is part of what I like about Nix.
>
> ---
>   John Ramsden
>
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Marc Weber

> I don't like the idea of using nix-env,
Why? You can also have your own declarative set of packages "per user".
that's also something config.nix can do:
graphicCollection = misc.collection { name = ... ; packages = [ ... . ]} (from 
head)

nix-env -i graphicCollection

works well for me :)

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread John Ramsden

Thanks, for the information.

Marc Weber mentioned


1) you can install system wide (nixos-rebuild ..)
2) you can install as user into ~/.nix-profile.nix

   ~/.config.nix is to "customize" user nixpkgs by
   - setting settings such as allowUnfree
   - override mplayer to use library X
   - add your own packages FOO


In that case, if I did list my own packages in ~/.nix-profile.nix, would 
that install only into that user profile?


When I run nixos-rebuild switch does that rebuild the user profiles as well?

I don't like the idea of using nix-env, and I have strayed away from it 
on NixOS, the idea of having all my configuration explicitly written out 
in configuration files is part of what I like about Nix.


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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Roger Qiu

Here's some links for reference:

* https://github.com/NixOS/nixpkgs/issues/1750

* https://github.com/sheenobu/nix-home

* 
http://sandervanderburg.blogspot.com.au/2013/09/managing-user-environments-with-nix.html


* 
https://www.reddit.com/r/NixOS/comments/5hd8ok/how_to_handle_nixos_and_i3_config_files/


I like to think of a nix-shell as a messy stateful environment to 
install all sorts of things, and a user-profile as a slightly less messy 
stateful environment. It's like the IO monad of Nix. So right now you 
can use config.nix to install and rebuild packages, while using other 
ways to manage config files.


Note that there are many parts of the OS that is still not completely 
declarative and pure-functional even when using configuration.nix. But 
it's better than nothing.


On 3/05/2017 4:29 PM, John Ramsden wrote:
I've been looking for some information about how exactly the 
$HOME/.nixpkgs/config.nix file works. How exactly is it intended to be 
used? Up until now I've been managing my entire system from 
/etc/nixos, but it would be nice to have a place where I can add 
something that happens only to a single user. For example, setting up 
dotfiles, or use our services. Can the config.nix file be used for 
that? Is it effectively a /etc/nixos/configuration.nix that is 
intended to be used for a single user?


I have found little bits of information about it here and there, for 
example in the nix pills. but nothing that really explains what it is 
used for in detail. Could someone point me where I can find this 
information?




--
Founder of Matrix AI
https://matrix.ai/
+61420925975

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Marc Weber
> $HOME/.nixpkgs/config.nix file works.
1) you can install system wide (nixos-rebuild ..)
2) you can install as user into ~/.nix-profile.nix

  ~/.config.nix is to "customize" user nixpkgs by
  - setting settings such as allowUnfree
  - override mplayer to use library X
  - add your own packages FOO

See here:
http://stackoverflow.com/questions/36000514/how-to-override-2-two-packages-in-nixos-configuration-nix

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


Re: [Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread Guillaume Maudoux (Layus)

Hi John,

I guess the reason you are not receiving many answers is that your 
question highlights some misconceptions, and some design issues with nix.


There does not exist any declarative configuration file for user 
environments. /etc/nixos/configuration.nix is amazing, but has not been 
parted to user environments. Installing user packages is done with 
nix-env, in an imperative fashion, and updates are based on packages 
names (nix-env -u) as explained on the [wiki]. Please see the discussion 
on [GitHub](1) about that precise topic.


To get declarative user environments, you can look at the pull-request 
for [NixUP] (nix user profiles), or use a trick to manage packages 
declaratively in a custom environment. The [wiki] has such an example. I 
personally maintain a [~/.nixpkgs/packages.nix] that I edit, install and 
activate with the following one-liner. The command replaces all the 
installed packages with the given ones (-ir). I could alias it to 
nixuser-rebuild ;-).


vim ~/.nixpkgs/packages.nix && nix-env -f ~/.nixpkgs/packages.nix 
-ir -Qk && i3-msg restart


NixUP and/or the coming update to nix (1.12) /should/ make this 
management easier.


I hope this makes it clearer!

Regards,

-- Layus.


[NixUP]: https://github.com/NixOS/nixpkgs/pull/9250
[1]: https://github.com/NixOS/nixpkgs/issues/1750
[wiki]: 
https://nixos.org/wiki/Howto_keep_multiple_packages_up_to_date_at_once
[~/nixpkgs/packages.nix]: 
https://gist.github.com/layus/427356ab4e7f46565d984686a311ca91#file-packages-nix


On 03/05/17 08:29, John Ramsden wrote:
I've been looking for some information about how exactly the 
$HOME/.nixpkgs/config.nix file works. How exactly is it intended to be 
used? Up until now I've been managing my entire system from 
/etc/nixos, but it would be nice to have a place where I can add 
something that happens only to a single user. For example, setting up 
dotfiles, or use our services. Can the config.nix file be used for 
that? Is it effectively a /etc/nixos/configuration.nix that is 
intended to be used for a single user?


I have found little bits of information about it here and there, for 
example in the nix pills. but nothing that really explains what it is 
used for in detail. Could someone point me where I can find this 
information?




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


[Nix-dev] The .nixpkgs/config.nix file and user configuration

2017-05-03 Thread John Ramsden
I've been looking for some information about how exactly the 
$HOME/.nixpkgs/config.nix file works. How exactly is it intended to be 
used? Up until now I've been managing my entire system from /etc/nixos, 
but it would be nice to have a place where I can add something that 
happens only to a single user. For example, setting up dotfiles, or use 
our services. Can the config.nix file be used for that? Is it 
effectively a /etc/nixos/configuration.nix that is intended to be used 
for a single user?


I have found little bits of information about it here and there, for 
example in the nix pills. but nothing that really explains what it is 
used for in detail. Could someone point me where I can find this 
information?


--
  John Ramsden

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