[Nix-dev] Managing private Nix packages outside the Nixpkgs tree
Eike
eike at eknet.org
Sat Jan 17 18:49:56 CET 2015
Hello Matthias,
I wanted to manage my private packages as well and I got most
inspiration from aszlig's vuizvui (thank you!). I can show what I'm
doing to achieve this, but I'm new to nixos myself, so take this with a
good grain of salt.
AFAICS, its enough to specify your own definitions in
`nixpkgs.packageOverrides'. This takes the original package collection
and returns a map with new/overriden packages. I have this setup:
common.nix (imported in all machine configs):
nixpkgs = {
config = {
allowUnfree = true;
packageOverrides = import ./pkgs;
};
};
then ./pkgs/default.nix looks like this:
pkgs:
let
callPackage = pkgs.lib.callPackageWith(pkgs // custom);
custom = {
cdparanoiax = callPackage ./cdparanoiax {};
...other packages...
};
in custom
Since the callPackage function is redefined that way, you can have
dependencies between your own packages. Then each directory in pkgs is a
package definition just like it is done in nixpkgs. I can then add
`pkgs.cdparanoiax' to `environment.systemPackages'.
hth with the your first question, can't help with the second one…
Regards
Eike
Matthias Beyer writes:
> Hi nixos-ML,
>
> So, I tried to ask Sander van de Burg soem questions which are related
> to one blog article of him, but unfortunately my mail server bounced
> the mail back to me, telling me that his mail address is not valid.
>
> So, I'm posting the email here, hopefully I can get an answer on the
> topic from you guys:
>
> On 16-01-2015 23:52:36, Matthias Beyer wrote:
>> Hi Sander,
>>
>> I have a question which could be or is related to the problem you
>> solved in your blog post about managing private nix packages outside
>> of the nixpkgs tree.
>>
>> My Problem is that I want to build a package out of vim_configurable
>> and a set of vim plugins I specify myself and install the whole
>> package as system package. So basically, it should look like this in
>> my configuration.nix:
>>
>> systemPackages = [ ... myVimPackage ... ];
>>
>> I tried to follow the configuration here[0], but I'm completely lost
>> and I don't understand most of it.
>>
>> I specified my vim plugin packages like aszlig did here[1], but
>> returing only a set of plugin packages at the end, no vimrc (which I
>> want to out-source into another package, for modularity).
>>
>> My overall setup for my configuration looks like this:
>>
>> ~/config/nixos/ # dir with _all_ nixos confs
>> ./base-configuration.nix # default shell, bootloaded, etc
>> ./nox.nix # Machine "nox"
>> ./pkgs/ # Dir, holding package lists
>> ./basePackages.nix # whereas each of these returns an
>> ./desktopPackages.nix # array or packages
>> ./developPackages.nix
>> ./services # Dir, holding service definitions
>> ./redshift.nix
>> ./x.nix
>>
>> My `nox.nix` looks basically like this:
>>
>> { config, pkgs, ... }:
>>
>> let
>> configDir = /home/m/config/nixos;
>> in
>>
>> {
>> imports = [
>> # Base configuration
>> "${configDir}/base-configuration.nix"
>>
>> # Users
>> "${configDir}/users/m.nix"
>>
>> # Services
>> "${configDir}/services/x.i3.nix"
>> "${configDir}/services/redshift.nix"
>> ];
>>
>> # Define on which hard drive you want to install Grub.
>> boot.loader.grub.device = "/dev/sda";
>>
>> networking.hostName = "nox";
>>
>> environment.systemPackages = let
>> basePkgs = import "${configDir}/pkgs/basePackages.nix" pkgs;
>> devPkgs = import "${configDir}/pkgs/devPackages.nix" pkgs;
>> desktopPkgs = import "${configDir}/pkgs/desktopPackages.nix" pkgs;
>> in
>> basePkgs ++ devPkgs ++ desktopPkgs;
>>
>> }
>>
>> And I would like to put my vim package into basePackages.nix:
>>
>>
>> pkgs: [
>> pkgs.acpitool
>> pkgs.coreutils
>> pkgs.mosh
>> # here goes my vim package
>> # ...
>> ]
>>
>> ---
>>
>> So, in your blog post[2], you described how to maintain packages
>> outside of the nixos package tree, which is what I want, I guess.
>>
>> How to approach this?
>>
>> Is this even the right approach for the problem? Or am I heading
>> for the wrong way?
>>
>> The second part of the question would be how to write a package which
>> defines the vimrc file, as aszlig does here[3]? Is this even
>> feasible?
>>
>> I hope you can help me with my problem(s) and teach me how to do
>> things right!
>>
>> I'd love to say "See you at FOSDEM, then", but unfortunately my exams
>> are exactly around this weekend, so I can not participate! :-(
>> I hope there will be a nixos spring nearby my home some time, thought.
>>
>> [0]: https://github.com/aszlig/vuizvui
>> [1]: https://github.com/aszlig/vuizvui/blob/3e9771d4dce455fd68c8cadcbff6ba695625c372/pkgs/vim/default.nix#L5
>> [2]: http://sandervanderburg.blogspot.de/2014/07/managing-private-nix-packages-outside.html
>> [3]: https://github.com/aszlig/vuizvui/blob/master/pkgs/vim/default.nix#L236
>>
>> --
>> Mit freundlichen Grüßen,
>> Kind regards,
>> Matthias Beyer
>>
>> Proudly sent with mutt.
>> Happily signed with gnupg.
--
gpg: AD7AC35E
finger print: 137F BB0B 1639 D25F DC5D E59C B412 C5F5 AD7A C35E
More information about the nix-dev
mailing list