Guest User

Untitled

a guest
Oct 15th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. { pkgs, ... }:
  2.  
  3. let
  4.  
  5. # This is a neat trick that clever taught me on #nixos. Here we
  6. # re-import nixpkgs (using our fixed nixpkgs via pkgs.path) and
  7. # force the system to be x86_64-linux, which in turn causes this
  8. # derivation always to be built on x86_64-linux, regardless of the
  9. # system it was intended to be built for (as long as we use
  10. # nixpkgs.x instead of pkgs.x in the derivation!).
  11. #
  12. # We do this because dhall-nix doesn't build on aarch64-linux due to
  13. # GHC currently being unsupported on that arch; and Nixpkgs will
  14. # attempt to build any config that's needed on an aarch64-linux on
  15. # an aarch64-linux... unless we use this trick.
  16. #
  17. # This is effectively equivalent to Debian's "all"
  18. # pseudo-architecture.
  19.  
  20. nixpkgs = import pkgs.path { system = "x86_64-linux"; };
  21.  
  22. state =
  23. let
  24. drv = nixpkgs.stdenv.mkDerivation {
  25. name = "foo.nix";
  26. src = ./.;
  27.  
  28. buildCommand = ''
  29. dhall-to-nix <<< $src/foo.dhall > $out
  30. '';
  31.  
  32. buildInputs = [ nixpkgs.dhall-nix ];
  33. };
  34.  
  35. in
  36. import "${drv}";
  37. in
  38. state
Add Comment
Please, Sign In to add comment