Open domenkozar opened 2 months ago
I'm trying to do this.
devenv.nix
with output:
{ pkgs, ... }:
let
sysPkgs = with pkgs; [
git
radianWrapper
];
rPkgs = with pkgs.rPackages; [
checkmate
data_table
devtools
dplyr
glue
purrr
shiny
shinyjs
stringr
testthat
tibble
tidyselect
];
rScript = x: ''
Rscript -e "${x}"
'';
in
{
packages = sysPkgs ++ rPkgs;
enterShell = rScript "devtools::load_all('package')";
enterTest = rScript "devtools::test('package')";
languages.r.enable = true;
outputs.myPackage = pkgs.rPackages.buildRPackage {
name = "myPackage";
src = ./.
buildInputs = [ pkgs.R ] ++ rPkgs;
};
}
devenv.nix
consumer:
{ pkgs, myPackage, ... }:
let
sysPkgs = with pkgs; [
git
radianWrapper
];
rPkgs = with pkgs.rPackages; [
checkmate
devtools
purrr
rex
shinyWidgets
shinycssloaders
shinydashboard
shinyjs
waiter
];
rScript = x: ''
Rscript -e "${x}"
'';
in
{
packages = sysPkgs ++ rPkgs ++ [ myPackage ];
enterShell = rScript "devtools::load_all('package')";
enterTest = rScript "devtools::test('package')";
languages.r.enable = true;
}
devenv.yaml
consumer:
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
myPackage:
url: git+https://<repo-url>.git?ref=devenv&rev=4axs115b316b78cc4a9ac3b5bfaaccebfd71a861
and I'm getting the follwing error:
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:9:12:
8|
9| strict = derivationStrict drvAttrs;
| ^
10|
… while evaluating derivation 'devenv-shell'
whose name attribute is located at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/stdenv/generic/make-derivation.nix:331:7
… while evaluating attribute 'DEVENV_PROFILE' of derivation 'devenv-shell'
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:19:19:
18| value = commonAttrs // {
19| outPath = builtins.getAttr outputName strict;
| ^
20| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:9:12:
8|
9| strict = derivationStrict drvAttrs;
| ^
10|
… while evaluating derivation 'devenv-profile'
whose name attribute is located at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/stdenv/generic/make-derivation.nix:331:7
… while evaluating attribute 'passAsFile' of derivation 'devenv-profile'
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/trivial-builders/default.nix:69:9:
68| inherit buildCommand name;
69| passAsFile = [ "buildCommand" ]
| ^
70| ++ (derivationArgs.passAsFile or [ ]);
… while evaluating the attribute 'passAsFile'
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:76:5:
75| # XXX: The size is somewhat arbitrary
76| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
77| }
… while evaluating a branch condition
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:76:18:
75| # XXX: The size is somewhat arbitrary
76| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
77| }
… in the argument of the not operator
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:76:48:
75| # XXX: The size is somewhat arbitrary
76| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
77| }
… while calling the 'lessThan' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:76:48:
75| # XXX: The size is somewhat arbitrary
76| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
77| }
… while calling the 'stringLength' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:76:21:
75| # XXX: The size is somewhat arbitrary
76| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
77| }
… while calling the 'toJSON' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:58:12:
57| nativeBuildInputs buildInputs;
58| pkgs = builtins.toJSON (map (drv: {
| ^
59| paths =
… while calling the 'map' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/pkgs/build-support/buildenv/default.nix:58:29:
57| nativeBuildInputs buildInputs;
58| pkgs = builtins.toJSON (map (drv: {
| ^
59| paths =
… from call site
at «github:cachix/devenv/1f55f89ca32d617b7a7c18422e3c364cb003df3d»/src/modules/top-level.nix:15:13:
14| name = "devenv-profile";
15| paths = lib.flatten (builtins.map drvOrPackageToPaths config.packages);
| ^
16| ignoreCollisions = true;
… while calling 'flatten'
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:383:13:
382| */
383| flatten = x:
| ^
384| if isList x
… while calling the 'concatMap' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:385:10:
384| if isList x
385| then concatMap (y: flatten y) x
| ^
386| else [x];
… while calling anonymous lambda
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:385:21:
384| if isList x
385| then concatMap (y: flatten y) x
| ^
386| else [x];
… from call site
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:385:24:
384| if isList x
385| then concatMap (y: flatten y) x
| ^
386| else [x];
… while calling 'flatten'
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:383:13:
382| */
383| flatten = x:
| ^
384| if isList x
… while evaluating a branch condition
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:384:5:
383| flatten = x:
384| if isList x
| ^
385| then concatMap (y: flatten y) x
… while calling the 'isList' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/lists.nix:384:8:
383| flatten = x:
384| if isList x
| ^
385| then concatMap (y: flatten y) x
… while calling 'drvOrPackageToPaths'
at «github:cachix/devenv/1f55f89ca32d617b7a7c18422e3c364cb003df3d»/src/modules/top-level.nix:8:25:
7|
8| drvOrPackageToPaths = drvOrPackage:
| ^
9| if drvOrPackage ? outputs then
… while evaluating a branch condition
at «github:cachix/devenv/1f55f89ca32d617b7a7c18422e3c364cb003df3d»/src/modules/top-level.nix:9:5:
8| drvOrPackageToPaths = drvOrPackage:
9| if drvOrPackage ? outputs then
| ^
10| builtins.map (output: drvOrPackage.${output}) drvOrPackage.outputs
… from call site
at «github:cachix/devenv/1f55f89ca32d617b7a7c18422e3c364cb003df3d»/src/modules/top-level.nix:9:8:
8| drvOrPackageToPaths = drvOrPackage:
9| if drvOrPackage ? outputs then
| ^
10| builtins.map (output: drvOrPackage.${output}) drvOrPackage.outputs
… while calling anonymous lambda
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/types.nix:547:14:
546| merge = loc: defs:
547| map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
| ^
548| imap1 (m: def':
… while evaluating the attribute 'value'
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/modules.nix:857:27:
856| optionalValue =
857| if isDefined then { value = mergedValue; }
| ^
858| else {};
… while calling the 'throw' builtin
at «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/modules.nix:848:12:
847| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
848| in throw "A definition for option `${showOption loc}' is not of type `${type.description}'. Definition values:${showDefs allInvalid}"
| ^
849| else
error:
error: A definition for option `packages."[definition 4-entry 23]"' is not of type `package'. Definition values:
- In `/home/pawel_chabros/dev/frontend/anxtheme/.bare/devenv/devenv.nix': <function>
✖ Command produced the following output:
Error: × Command `/nix/store/kn810nyzgbladsx84w49nqvv2fhwqc3x-nix-devenv-
│ 2.24.0pre20240910_1e61e9f/bin/nix --show-trace --extra-experimental-features nix-
│ command --extra-experimental-features flakes --option warn-dirty false --keep-going
│ --max-jobs 8 --option eval-cache false print-dev-env --profile /home/pawel_chabros/
│ dev/frontend/anxtheme/.bare/devenv/.devenv/gc/shell --option extra-substituters
│ https://devenv.cachix.org --option extra-trusted-public-keys devenv.cachix.org-
│ 1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=` failed with with exit code 1
direnv: loading the environment failed
direnv: error exit status 1
Ok, I had to change myPackage
to myPackage.outputs.build.outputs.myPackage
. Is it correct?
This is currently not trivial to do and requires documentation. Leave a thumps up as usual for prioritization.