Re: [Nix-dev] Import remote packages in NixOps/NixOS

2017-06-18 Thread Joachim Schiele
see also:
https://github.com/NixOS/nixops/issues/434#issuecomment-309281751

On 09.03.2016 00:15, Eric Sagnes wrote:
> Thank you, it works perfectly with the `{}` at the end of the import!
> 
> On Tue, Mar 08, 2016 at 05:24:02PM +0100, Rok Garbas wrote:
>> Hi,
>>
>> On Tue, Mar 8, 2016 at 6:42 AM, Eric Sagnes  wrote:
>>> It is possible to import foreign modules in NixOps by doing:
>>>
>>> ```
>>> {
>>>   network.description = "Web server";
>>>
>>>   webserver = { config, pkgs, ... }:
>>> let
>>>   myModuleSrc = (import  {}).fetchFromGitHub {
>>>   owner  = "me";
>>>   repo   = "myModule";
>>>   rev= "v1.0";
>>>   sha256 = "";
>>>   };
>>> in
>>> {
>>>   imports = [ "${myModuleSrc}/module.nix" ];
>>>   services.myModule.enable = true;
>>> };
>>> }
>>> ```
>>>
>>> Presupposing that the remote package provides a nix build expression,
>>> is it possible to directly import it in a similar way?
>>> Pseudo code that is not working:
>>>
>>> ```
>>> {
>>>   network.description = "Web server";
>>>
>>>   webserver = { config, pkgs, ... }:
>>> let
>>>   myPackageSrc = (import  {}).fetchFromGitHub {
>>>   owner  = "me";
>>>   repo   = "myPackage";
>>>   rev= "v1.0";
>>>   sha256 = "";
>>>   };
>>> in
>>> {
>>>   environment.systemPackages = [
>>> (import "${myPackageSrc}/release.nix")
>>>   ];
>>>
>>> };
>>> }
>>> ```
>>>
>>> (The above complains about coercing a function to a string.)
>>>
>>
>>
>> you can also just use builtins.fetchFromTarball.
>>
>> for above you probably will want to do
>>
>>   (import "${myPackagesSrc}/release.nix" { ... })
>>
>>
>> -- 
>> Rok Garbas - https://.garbas.si
> 


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


Re: [Nix-dev] Import remote packages in NixOps/NixOS

2016-03-08 Thread Eric Sagnes
Thank you, it works perfectly with the `{}` at the end of the import!

On Tue, Mar 08, 2016 at 05:24:02PM +0100, Rok Garbas wrote:
> Hi,
> 
> On Tue, Mar 8, 2016 at 6:42 AM, Eric Sagnes  wrote:
> > It is possible to import foreign modules in NixOps by doing:
> >
> > ```
> > {
> >   network.description = "Web server";
> >
> >   webserver = { config, pkgs, ... }:
> > let
> >   myModuleSrc = (import  {}).fetchFromGitHub {
> >   owner  = "me";
> >   repo   = "myModule";
> >   rev= "v1.0";
> >   sha256 = "";
> >   };
> > in
> > {
> >   imports = [ "${myModuleSrc}/module.nix" ];
> >   services.myModule.enable = true;
> > };
> > }
> > ```
> >
> > Presupposing that the remote package provides a nix build expression,
> > is it possible to directly import it in a similar way?
> > Pseudo code that is not working:
> >
> > ```
> > {
> >   network.description = "Web server";
> >
> >   webserver = { config, pkgs, ... }:
> > let
> >   myPackageSrc = (import  {}).fetchFromGitHub {
> >   owner  = "me";
> >   repo   = "myPackage";
> >   rev= "v1.0";
> >   sha256 = "";
> >   };
> > in
> > {
> >   environment.systemPackages = [
> > (import "${myPackageSrc}/release.nix")
> >   ];
> >
> > };
> > }
> > ```
> >
> > (The above complains about coercing a function to a string.)
> >
> 
> 
> you can also just use builtins.fetchFromTarball.
> 
> for above you probably will want to do
> 
>   (import "${myPackagesSrc}/release.nix" { ... })
> 
> 
> -- 
> Rok Garbas - https://.garbas.si

-- 
Eric Sagnes
サニエ エリック
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Import remote packages in NixOps/NixOS

2016-03-08 Thread Rok Garbas
Hi,

On Tue, Mar 8, 2016 at 6:42 AM, Eric Sagnes  wrote:
> It is possible to import foreign modules in NixOps by doing:
>
> ```
> {
>   network.description = "Web server";
>
>   webserver = { config, pkgs, ... }:
> let
>   myModuleSrc = (import  {}).fetchFromGitHub {
>   owner  = "me";
>   repo   = "myModule";
>   rev= "v1.0";
>   sha256 = "";
>   };
> in
> {
>   imports = [ "${myModuleSrc}/module.nix" ];
>   services.myModule.enable = true;
> };
> }
> ```
>
> Presupposing that the remote package provides a nix build expression,
> is it possible to directly import it in a similar way?
> Pseudo code that is not working:
>
> ```
> {
>   network.description = "Web server";
>
>   webserver = { config, pkgs, ... }:
> let
>   myPackageSrc = (import  {}).fetchFromGitHub {
>   owner  = "me";
>   repo   = "myPackage";
>   rev= "v1.0";
>   sha256 = "";
>   };
> in
> {
>   environment.systemPackages = [
> (import "${myPackageSrc}/release.nix")
>   ];
>
> };
> }
> ```
>
> (The above complains about coercing a function to a string.)
>


you can also just use builtins.fetchFromTarball.

for above you probably will want to do

  (import "${myPackagesSrc}/release.nix" { ... })


-- 
Rok Garbas - https://.garbas.si
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Import remote packages in NixOps/NixOS

2016-03-07 Thread Eric Sagnes
It is possible to import foreign modules in NixOps by doing:

```
{
  network.description = "Web server";

  webserver = { config, pkgs, ... }:
let
  myModuleSrc = (import  {}).fetchFromGitHub {
  owner  = "me";
  repo   = "myModule";
  rev= "v1.0";
  sha256 = "";
  };
in
{ 
  imports = [ "${myModuleSrc}/module.nix" ]; 
  services.myModule.enable = true;
};
}
```

Presupposing that the remote package provides a nix build expression,
is it possible to directly import it in a similar way?
Pseudo code that is not working:

```
{
  network.description = "Web server";

  webserver = { config, pkgs, ... }:
let
  myPackageSrc = (import  {}).fetchFromGitHub {
  owner  = "me";
  repo   = "myPackage";
  rev= "v1.0";
  sha256 = "";
  };
in
{ 
  environment.systemPackages = [
(import "${myPackageSrc}/release.nix")
  ];

};
}
```

(The above complains about coercing a function to a string.)

Cheers,
-- 
Eric Sagnes
サニエ エリック
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev