{
  inputs,
  self,
  lib,
  ...
}: {
  flake = {
    homeManagerModules.user-willem = {
      imports = [
        self.homeManagerModules.default
        inputs.nix-index-database.hmModules.nix-index
      ];

      home.username = "willem";
    };

    homeManagerModules.user-willem-darwin = {
      imports = [
        self.homeManagerModules.darwin
        self.homeManagerModules.user-willem
        self.homeManagerModules.nixpkgs-config
        self.homeManagerModules.nixpkgs-useFlakeNixpkgs
      ];

      programs.emacs.enableOrgTex = true;

      home.homeDirectory = "/Users/willem";
    };

    homeManagerModules.user-willem-linux = {
      imports = [
        self.homeManagerModules.user-willem
        self.homeManagerModules.linux
      ];

      programs.emacs.enableOrgTex = false;

      home.homeDirectory = "/home/willem";
    };
  };

  perSystem = {
    pkgs,
    self',
    system,
    ...
  }: rec {
    homeConfigurations.willem = let
      systemType =
        if pkgs.stdenv.isDarwin
        then "darwin"
        else "linux";
    in
      inputs.home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [self.homeManagerModules."user-willem-${systemType}" {nix.package = pkgs.nix;}];
      };

    packages = let
      activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
    in
      lib.pipe activationPackages [
        (lib.filterAttrs (_: drv: pkgs.system == drv.system))
        (lib.mapAttrs' (username: lib.nameValuePair "home-${username}"))
      ];
  };
}
