Tried to package a program...maybe too big a project

Hi all,

Watched jonringer’s youtube video on packaging a program and read the documentation.md in the github. Also, I have read on some of the forums that packaging a program can be a good way to learn Nix a bit more. RStudio is currently about a year behind so I thought I’d try that. I think it may be a bigger project than I anticipated.

I git pulled the nixpkgs github and edited the rstudio default.nix, changing the RStudio version number and SHA256. However, when I run nix build I get the following error:

error: cannot evaluate a function that has an argument without a value ('fetchurl')
       Nix attempted to evaluate a function as a top level expression; in
       this case it must have its arguments supplied either by default
       values, or passed explicitly with '--arg' or '--argstr'. See
       https://nixos.org/manual/nix/stable/language/constructs.html#functions.

       at /home/danny/Documents/Projects/nixpkgs/pkgs/applications/editors/rstudio/default.nix:4:3:

            3| , mkDerivation
            4| , fetchurl
             |   ^
            5| , fetchpatch

and when I try nixpkgs-review wip I get the error

error:
       … while querying the derivation named 'RStudio-2023.06.1+524'

       … while calling the 'getAttr' builtin

         at //builtin/derivation.nix:19:19: (source not available)

       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'RStudio-2023.06.1+524'
         whose name attribute is located at /home/danny/.cache/nixpkgs-review/rev-707e33fc722ee9efd53c8f671f03443ad44fa4dd-dirty-3/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:300:7

       … while evaluating attribute 'preConfigure' of derivation 'RStudio-2023.06.1+524'

         at /home/danny/.cache/nixpkgs-review/rev-707e33fc722ee9efd53c8f671f03443ad44fa4dd-dirty-3/nixpkgs/pkgs/applications/editors/rstudio/default.nix:165:5:

          164|
          165|     preConfigure = ''
             |     ^
          166|       mkdir dependencies/dictionaries

       … while evaluating derivation 'source'
         whose name attribute is located at /home/danny/.cache/nixpkgs-review/rev-707e33fc722ee9efd53c8f671f03443ad44fa4dd-dirty-3/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:300:7

       error: invalid character in Base64 string: ''

I think these could be due to the mathJaxSrc and rsconnectSrc but I am unable to find a new mathJaxSrc link and updated SHA256 (old link works) and not sure the rev and SHA256 values for rsconnectSrc. The reason why I want to find these is I am thinking they may have been updated since the last update of this package as well. I am not sure about the second error. I would appreciate some thoughts and help.

Please let me know if there is any feedback or anything else I need to provide and thank you in advance!

Can you post your diff?

2 Likes

Hi Sandro,

Yes apologies. Posted below

diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index 2d8b3c2bb09..164a4924c68 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -39,17 +39,17 @@
 
 let
   pname = "RStudio";
-  version = "2022.07.1+554";
-  RSTUDIO_VERSION_MAJOR  = "2022";
-  RSTUDIO_VERSION_MINOR  = "07";
+  version = "2023.06.1+524";
+  RSTUDIO_VERSION_MAJOR  = "2023";
+  RSTUDIO_VERSION_MINOR  = "06";
   RSTUDIO_VERSION_PATCH  = "1";
-  RSTUDIO_VERSION_SUFFIX = "+554";
+  RSTUDIO_VERSION_SUFFIX = "+524";

Let me know if there is anything further needed!

that looks innocent, but no idea unless I would dig deeper into this

1 Like

Thanks for taking the time to have a look. Do you have any recommendations/further reading to try and troubleshoot? I understand if you’d have too much going on to dig deeper in this.

An update - I think I’ve solved the fetchurl issue (argument without a value) by using nix build .#rstudio which I believe is pointing to flake to define this variable.

However, I am still getting the invalid character is Base64 string: ’ which I am not sure where that is coming from. I have retyped these characters but may give that a god again

Solved by help in the NixOS Discord. Simply had to set all three hash values to hash = “”. Apparently incorrect hash values can lead to this type of error. Still having issues with now with a patch failing to apply…but I think that needs to be separate thread? If anyone has any feedback if that should be discussed here or moved to a separate topic that’d be awesome!