Skip to content

Instantly share code, notes, and snippets.

@rossabaker
Last active May 2, 2022 18:17
Show Gist options
  • Save rossabaker/ee12a3b9ffe2464a1c3555f24130e3ee to your computer and use it in GitHub Desktop.
Save rossabaker/ee12a3b9ffe2464a1c3555f24130e3ee to your computer and use it in GitHub Desktop.
Input From Derivation hijinks
{ 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/rhbx7pmfz3c5ha887rjl4rzcwhhxp747-nixpkgs-22.05pre339569.7dcb25726b3/nixpkgs/lib/modules.nix:385:28:
# 384| builtins.addErrorContext (context name)
# 385| (args.${name} or config._module.args.${name})
# | ^
# 386| ) (lib.functionArgs f);
imports = [ helloModule ];
}
@rossabaker
Copy link
Author

Mastodon thread, in case anyone else wants to chime in.

@rossabaker
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment