<commit_before>{ config, options, lib, utils, pkgs, ... }:

with lib;
{
  imports = [ <home-manager/nixos> ];

  options.my = {
    username = mkOption {
      type = types.str;
      default = "hlissner";
    };

    home = mkOption {
      type = options.home-manager.users.type.functor.wrapped;
      default = {};
    };

    user = mkOption {
      type = types.submodule;
      default = {};
      description = "My users.users.NAME submodule";
    };

    env = mkOption {
      type = with types; attrsOf (either (either str path) (listOf (either str path)));
      default = {};
      description = "...";
      apply = mapAttrs
        (n: v: if isList v
               then concatMapStringsSep ":" (x: toString x) v
               else (toString v));
    };

    alias = mkOption {
      type = with types; nullOr (attrsOf (nullOr (either str path)));
      default = {};
      description = "...";
    };

    packages = mkOption {
      type = types.listOf types.package;
      default = [];
      description = "The set of packages to appear in the user environment.";
    };

    init = mkOption {
      type = types.lines;
      default = "";
      description = "...";
    };

    zsh = {
      rc = mkOption {
        type = types.lines;
        default = "";
        description = "...";
      };
      env = mkOption {
        type = types.lines;
        default = "";
        description = "...";
      };
    };
  };

  config = {
    users.users.${config.my.username} = mkAliasDefinitions options.my.user;
    home-manager.users.${config.my.username} = mkAliasDefinitions options.my.home;

    my.user.packages = config.my.packages;
    my.env.PATH = [ "$PATH" ];

    environment.shellAliases = config.my.alias;
    environment.extraInit =
      let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env;
      in ''
        ${concatStringsSep "\n" exportLines}
        ${config.my.init}
      '';

    my.home.xdg.configFile."zsh/extra.zshrc".text = config.my.zsh.rc;
    my.home.xdg.configFile."zsh/extra.zshenv".text = config.my.zsh.env;
  };
}<commit_msg>Add options.my.setup & append aliases to extra.zshrc<commit_after>{ config, options, lib, utils, pkgs, ... }:

with lib;
{
  imports = [ <home-manager/nixos> ];

  options.my = {
    username = mkOption {
      type = types.str;
      default = "hlissner";
    };

    home = mkOption {
      type = options.home-manager.users.type.functor.wrapped;
      default = {};
    };

    user = mkOption {
      type = types.submodule;
      default = {};
      description = "My users.users.NAME submodule";
    };

    env = mkOption {
      type = with types; attrsOf (either (either str path) (listOf (either str path)));
      default = {};
      description = "...";
      apply = mapAttrs
        (n: v: if isList v
               then concatMapStringsSep ":" (x: toString x) v
               else (toString v));
    };

    alias = mkOption {
      type = with types; nullOr (attrsOf (nullOr (either str path)));
      default = {};
      description = "...";
    };

    packages = mkOption {
      type = types.listOf types.package;
      default = [];
      description = "The set of packages to appear in the user environment.";
    };

    init = mkOption {
      type = types.lines;
      default = "";
      description = "...";
    };

    setup = mkOption {
      type = types.lines;
      default = "";
      description = "...";
    };

    zsh = {
      rc = mkOption {
        type = types.lines;
        default = "";
        description = "...";
      };
      env = mkOption {
        type = types.lines;
        default = "";
        description = "...";
      };
    };
  };

  config = {
    users.users.${config.my.username} = mkAliasDefinitions options.my.user;
    home-manager.users.${config.my.username} = mkAliasDefinitions options.my.home;

    my.user.packages = config.my.packages;
    my.env.PATH = [ "$PATH" ];

    environment.extraInit =
      let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env;
      in ''
        ${concatStringsSep "\n" exportLines}
        ${config.my.init}
      '';

    my.home.xdg.configFile."zsh/extra.zshrc".text =
      let aliasLines = mapAttrsToList (n: v: "alias ${n}=\"${v}\"") config.my.alias;
      in ''
         ${concatStringsSep "\n" aliasLines}
         ${config.my.zsh.rc}
      '';
    my.home.xdg.configFile."zsh/extra.zshenv".text = config.my.zsh.env;

    system.userActivationScripts.mySetup = config.my.setup;
  };
}
{'fraction_non_alphanumeric': 0.15712707182320443, 'fraction_numerical': 0.0, 'mean_word_length': 1.960104643557881, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6460396', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1429, 'n_words': 309}