-
-
Save samueldr/f5ddf064917f2535bc3e9ffa66354c80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nix-build test.nix --arg config '{ my.option = "foobar!"; }' && cat result | |
{ pkgs ? import <nixpkgs> {} | |
, config ? {} | |
}: | |
let | |
inherit (pkgs) lib; | |
eval = config: lib.evalModules { | |
modules = [ | |
{ | |
options = with lib; { | |
my = { | |
option = mkOption { | |
type = types.str; | |
default = "hi"; | |
}; | |
}; | |
}; | |
} | |
config | |
]; | |
}; | |
in | |
pkgs.writeText "config.json" (builtins.toJSON (eval config).config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment