Comments (5)
Yeah, I have ran into this issue myself. One way to address this problem is to interpolate the relative path to the Dhall expression, like this:
let
pkgs = import <nixpkgs> { };
inherit (pkgs) dhallToNix;
in
{ vbox = (dhallToNix "{ headless = True, vcpu = +2 } : ${../../../ops/VirtualBox.dhall}");
}
That will then ensure that Nix adds ../../../ops/VirtualBox.dhall
to the /nix/store
as some /nix/store/....-VirtualBox.dhall
path and Nix will then interpolate path that into the string giving you the following final Dhall expression
{ headless = True, vcpu = +2 } : /nix/store/...-VirtualBox.dhall
The other benefit of doing this is that Nix will then correctly detect that the VirtualBox.dhall
file is a build-time dependency of the Dhall expression, ensuring that the import will be present on any machine that evaluates that Dhall expression.
from dhall-nix.
Thanks. Our problem is that the ../../ops/VirtualBox.dhall
file also uses many other type-files in other places in the directory tree. Will this trick work for an entire directory tree?
from dhall-nix.
Oh, I see the issue. So if all of the Dhall expressions are located within a single subdirectory (such as ../../../ops
) and they all reference each other by relative paths then you can do this instead:
let
pkgs = import <nixpkgs> { };
inherit (pkgs) dhallToNix;
in
{ vbox = (dhallToNix "{ headless = True, vcpu = +2 } : ${../../../ops}/VirtualBox.dhall");
}
Then the entire ../../../ops
directory will be copied to the /nix/store
and the VirtualBox.dhall
dependency will be replaced with an absolute path within that directory. Every transitive dependency of VirtualBox.dhall
should be correctly referenced via relative paths.
from dhall-nix.
Thanks! works great!
from dhall-nix.
You're welcome! :)
from dhall-nix.
Related Issues (10)
- Could lib.recursiveUpdate be used for (∧)? HOT 1
- Get dhall-nix on stackage HOT 3
- Nix daemon out of memory error HOT 4
- `hnix-0.5.2` incompatible with `dhall-1.18.0` HOT 4
- Update to newest dhall (& hnix) HOT 1
- Types transform to {} HOT 2
- Instantiating example fails HOT 2
- Dhall types for higher-level nix concepts? HOT 3
- Package currently broken on nixpkgs-unstable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhall-nix.