!fXpAvneDgyJuYMZSwO:nixos.org

Nix Data Science

270 Members
57 Servers

Load older messages


SenderMessageTime
11 Jul 2023
@brodriguesco:matrix.orgBruno Rodriguesthen that default.nix file could be used for reproducibility purposes10:14:18
@peddie:matrix.orgpeddiegot it22:13:55
12 Jul 2023
@futaki:matrix.orgfutaki left the room.08:46:24
@brodriguesco:matrix.orgBruno Rodrigues

So I've started playing with Nix. I am trying to build an environment with R and some packages installed (inside Docker, just to avoid interfering with my system). Here is the default.nix that I'm using:

with import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/e11142026e2cef35ea52c9205703823df225c947.tar.gz") {};
{
  myProject = stdenv.mkDerivation {
    name = "myProject";
    version = "1";
    src = if lib.inNixShell then null else nix;

    buildInputs = with rPackages; [
      R
      ggplot2
      knitr
    ];
  };
}

12:19:26
@brodriguesco:matrix.orgBruno Rodrigues I can drop into a nix shell using CMD nix-shell /home/renv/default.nix in the Dockerfile and then running a container 12:20:01
@brodriguesco:matrix.orgBruno Rodrigues

but when I try to build the environment first, and then drop into bash that doesn't work. So when I do

12:20:39
@brodriguesco:matrix.orgBruno Rodrigues *

but when I try to build the environment first, and then drop into bash that doesn't work. So when I do

12:20:48
@brodriguesco:matrix.orgBruno Rodrigues *

but when I try to build the environment first, and then drop into bash that doesn't work. So when I do

RUN nix-build /home/renv/default.nix
CMD ["bash"]

I get following error message

builder for '/nix/store/1csmqrnlgbyzm5kkjw2s9q348qpx3rqy-myProject.drv' failed to produce output path for output 'out' at '/nix/store/icf4fsmlcalyc2v5wiwn88x6f7xab46y-myProject'
12:21:37
@brodriguesco:matrix.orgBruno Rodriguessurely I'm missing something obvious, but can't find it 😅12:23:01
@brodriguesco:matrix.orgBruno Rodrigues *

but when I try to build the environment first, and then drop into bash that doesn't work. So when I do

RUN nix-build /home/renv/default.nix
CMD ["bash"]

I get following error message

112.8 unpacking sources
112.8 unpacking source archive /nix/store/2zdq28c97x3rqb7fqrrvwkdzh44pdq05-nix-2.13.3
113.0 source root is nix-2.13.3
113.0 patching sources
113.0 configuring
113.1 no configure script, doing nothing
113.1 building
113.1 no Makefile or custom buildPhase, doing nothing
113.1 installing
113.1 no Makefile or custom installPhase, doing nothing
113.1 post-installation fixup
113.4 error: builder for '/nix/store/1csmqrnlgbyzm5kkjw2s9q348qpx3rqy-myProject.drv' failed to produce output path for output 'out' at '/nix/store/icf4fsmlcalyc2v5wiwn88x6f7xab46y-myProject'
12:23:29
@brodriguesco:matrix.orgBruno Rodrigues

ok so some more googling led me to write this default.nix:

13:04:26
@brodriguesco:matrix.orgBruno Rodrigues *

ok so some more googling led me to write this default.nix:

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/e11142026e2cef35ea52c9205703823df225c947.tar.gz") {} }:

with pkgs;

let
  my-pkgs = rWrapper.override {
    packages = with rPackages; [ dplyr ggplot2 R];
  };
in
mkShell {
  buildInputs = [my-pkgs];
}

13:04:47
@brodriguesco:matrix.orgBruno Rodriguesand now it builds successfully13:05:00
@brodriguesco:matrix.orgBruno RodriguesI guess the issue was that before I wasn't creating an environment, because I wasn't using mkShell explicitely?13:05:51
@jb:vk3.wtfjbedo
In reply to @brodriguesco:matrix.org
I guess the issue was that before I wasn't creating an environment, because I wasn't using mkShell explicitely?
These general nix questions are better in #nix:nixos.org, but to answer your questions derivations have to produce all outputs, of which out is mandatory. Your expression above did not create the output path expected so your got an error when you tried to build it. mkShell is a wrapper around mkDerivation that simply dumps some text into the output path (see pkgs/build-support/mkShell/default.nix).
23:23:44
13 Jul 2023
@brodriguesco:matrix.orgBruno RodriguesAh great many thanks. I figured it had to do something with the fact that mkShell likely provided the required outputs, which I would have had to provide by hand otherwise07:52:14
@brodriguesco:matrix.orgBruno RodriguesI've joined the NixOS channel, I'll ask these types of questions in there in the future, thanks!07:52:56
17 Jul 2023
@petrichor:envs.netJez (he/him) ♾️ joined the room.14:29:47
@petrichor:envs.netJez (he/him) ♾️ ok, it's been a while since i looked at this, but i'm having a go at implementing a nix-flakes buildpack for repo2docker which will allow use of a git repo with a flake.nix on https://mybinder.org/ 14:32:09
@petrichor:envs.netJez (he/him) ♾️ story so far is that i got it working 2 years ago using the existing nix buildpack and edolstra's flake-compat, and to prove the long-term reproducibility of nix, it still builds and runs using repo2docker! https://codeberg.org/jezcope/binder-nix-flakes 14:34:22
@petrichor:envs.netJez (he/him) ♾️hmm, OK, first roadblock to doing anything with a reasonably recent nixpkgs is this: repo2docker does not work with jupyter-server v2 https://github.com/jupyter-server/jupyter_server/issues/103816:24:45
@petrichor:envs.netJez (he/him) ♾️ is there a standard way to install an old version of a python package? equivalent to pip install jupyter-server<2.0.0 16:25:54
@petrichor:envs.netJez (he/him) ♾️ I guess I should ask in #python:nixos.org 16:28:22
18 Jul 2023
@zimbatm:numtide.comJonas Chevalier changed their display name from zimbatm to Jonas Chevalier.11:06:32
20 Jul 2023
@brodriguesco:matrix.orgBruno Rodrigueshi again, I wrote two blog posts on Nix and R, maybe you’ll find them interesting :) any feedback welcome!14:40:00
@brodriguesco:matrix.orgBruno Rodrigueshttps://www.brodrigues.co/blog/2023-07-13-nix_for_r_part1/14:40:02
@brodriguesco:matrix.orgBruno Rodrigueshttps://www.brodrigues.co/blog/2023-07-19-nix_for_r_part2/14:40:10
@raitobezarius:matrix.orgraitobezarius
In reply to @petrichor:envs.net
is there a standard way to install an old version of a python package? equivalent to pip install jupyter-server<2.0.0
checking out an older nixpkgs
16:12:18
@raitobezarius:matrix.orgraitobezariusor not using nixpkgs16:12:26
@brodriguesco:matrix.orgBruno Rodriguesfellow Nixers, I'm a beginner and started a series of blog posts that might interest some of you. It focuses on R but I believe a lot of what I describe could be used for any language 16:19:15

Show newer messages


Back to Room ListRoom Version: 6