I’m experimenting with a literate config where I define home-manager modules in Org-Mode, create a derivation to tangle the Org to Nix, and then import-from-derivation to compose the resulting Nix into my home-manager config. Even before introducing Org, I’m hitting problems. I expect this to create a home-manager config with the hello
package, but it’s failing with infinite recursion:
{ config, pkgs, ... }:
let
# In the real world, this is an org tangle.
hello = pkgs.writeText "hello" ''
{ pkgs, ... }: {
home.packages = [ pkgs.hello ];
}
'';
# This is the import-from-derivation
helloModule = (import hello);
in {
# $ home-manager -I home-manager=https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz build -f default.nix && ./result/home-path/bin/hello
# error: infinite recursion encountered
# at /nix/store/hh88z3yigsill682cw1ifv2qhyr9jxz7-nixpkgs-22.05pre373991.b283b64580d/nixpkgs/lib/modules.nix:496:28:
# 495| builtins.addErrorContext (context name)
# 496| (args.${name} or config._module.args.${name})
# | ^
# 497| ) (lib.functionArgs f);
# (use '--show-trace' to show detailed location information)
imports = [ helloModule ];
}
My end vision is a flake with some Org, whose outputs include a package for my website (exported from the Org) and my system config (tangled and imported from the Org). Even just the above would be nice progress.
Nix is 2.8.0, OS is MacOS 12.3.1. Thanks for any insight!