Cannot run `dag.entryAfter` to run script

Hi!

I want to install something from github as part of my system managed home-manager configuration.

Unfortunately, It seems that i can’t get dag.entryAfter working.

/etc/nixos/home-manager.nix

{ config, lib, pkgs, jsonConfig, ... }:
let
	home-manager-src = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${jsonConfig.system.version}.tar.gz";
	home-manager = import home-manager-src { inherit pkgs; };

	exampleConfig = import ./example.nix { inherit config lib pkgs jsonConfig home-manager; };
in
{
	imports = [
		(import "${home-manager-src}/nixos")
	];

	# Enable the home-manager command globally
	home-manager.useGlobalPkgs = true;
	home-manager.useUserPackages = true;
	home-manager.backupFileExtension = "backup";

	# Configure home manager for the user
	home-manager.users.${jsonConfig.user.username} = {
		home.username = jsonConfig.user.username;
		home.homeDirectory = "/home/${jsonConfig.user.username}";
		home.stateVersion = jsonConfig.system.version;

		home.sessionVariables = {
			...
		};

		imports = [
			exampleConfig
		];

	};
}

/etc/nixos/example.nix

{ config, lib, pkgs, jsonConfig, home-manager, ... }:

let
  example-src = pkgs.fetchFromGitHub {
    owner = "...";
    repo = "...";
    rev = "master";
    sha256 = "...";
  };
in
{
  home.activation.installExample = lib.hm.dag.entryAfter ["writeBoundary"] ''
    ${pkgs.bash}/bin/bash ${example-src}/install.sh
  '';
}

I’ve got the idea about this way of running scripts from Appendix A. Home Manager Configuration Options

When running the nixos-rebuild switch, I get error: attribute 'hm' missing

Add the nixos module somewhere in your config: Home Manager Manual

You want to include ./example.nix in your configuration’s imports, do not call import on it.

Well as stated there, I do have

home-manager-src = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${jsonConfig.system.version}.tar.gz";
	home-manager = import home-manager-src { inherit pkgs; };

at the very top, in general the home-manager works for me (system based)

by doing so, how can i pass down jsonConfig?

I need this (json file) to supply some basic information about users, …

Perhaps you can make use of home-manager’s extraSpecialArgs so that jsonConfig is available to all your modules? Alternatively you could use the module system and create an option then set your json config and reference that later.