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

with lib;

let
  environment = concatStringsSep " "
    [ "NIX_REMOTE=daemon"
      "NIX_SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
    ];
in

{
  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages =
    [ pkgs.nix-repl
    ];

  # Create /etc/bashrc that loads the nix-darwin environment.
  programs.bash.enable = true;
  programs.bash.enableCompletion = false;

  # Recreate /run/current-system symlink after boot.
  services.activate-system.enable = true;

  services.nix-daemon.enable = true;

  nix.binaryCaches = [ http://cache1 ];
  nix.binaryCachePublicKeys = [ "cache.daiderd.com-1:<KEY> ];

  nix.trustedUsers = [ "@admin" "@hydra" ];

  nix.extraOptions = ''
    pre-build-hook =
  '';

  nix.gc.automatic = true;
  nix.gc.options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";

  environment.etc."per-user/hydra/ssh/authorized_keys".text = concatStringsSep "\n"
    [ "command=\"${environment} ${config.nix.package}/bin/nix-store --serve --write\" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCVsc0pHGsskoayziMhA2e59bHPWe0bbKgusmqhuJFBGQ1BAk9UmPzKCWE3nCiV6CLD1+SygVkBjb06DY<KEY>qZtL0G4+2vhp6x8OvXh8xlf/eWw3k5MWlvu+kjJFpbW8wHWTiUqzH+uEeHklAosT0lFNjiIYd/Vs3JAezhUR62a6c7ZjWOd5F7ALGEKzOiwC4i37kSgGsIWNCbe0Ku7gyr718zhMGeyxax6saHhnkSpIB+7d6oHhKeiJSFMWctNmz1/qxXUPbxNaJvqgdKlVHhN+B7x/TIbkVr5pTC59Okx9LTcpflFIv79VT+Gf1K7VypZpSvJjG0xFRt8iDs1+ssWFBfvpo94vUbZ+ZwMDcBGR5iJeO41Gj5fYn5aaDl32RXfJ9Fkwael1L6pcXtkIc66jk+KQQpgoeNj8Y3Emntpqva/2AM41wDDvr5tKp5KhEKFLM95CoiWq+g88pZLcpqLK7wooDVqNkVUEbMaj9lBN0AzU9mcsIRGvTa6CmWAdBvwqS2fRZD97Oarqct9AWgb0X6mOUq9BJNi4i4xvjgnVkylLwtLUnibR/PeXMtkb9bv6BEZXNf5ACqxSjKXJyaIHI65I5TILCr5eEgaujgvmkREn6U3T1NZAUIeVe9aVYLqehYh79OHUBzggoHqidRrXBB/6zdg9UgQ=="
      "command=\"${environment} ${config.nix.package}/bin/nix-store --serve --write\" ssh-rsa <KEY>
    ];

  users.knownGroups = [ "hydra" ];
  users.knownUsers = [ "hydra" ];
  users.groups.hydra = { gid = 530; description = "Hydra builder group"; };
  users.users.hydra = { uid = 530; gid = 530; description = "Hydra"; home = "/Users/hydra"; isHidden = true; };

  system.activationScripts.postActivation.text = ''
    printf "configuring ssh keys for hydra... "<commit_msg>hydra: fix user creation<commit_after>{ config, lib, pkgs, ... }:

with lib;

let
  environment = concatStringsSep " "
    [ "NIX_REMOTE=daemon"
      "NIX_SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
    ];
in

{
  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages =
    [ pkgs.nix-repl
    ];

  # Create /etc/bashrc that loads the nix-darwin environment.
  programs.bash.enable = true;
  programs.bash.enableCompletion = false;

  # Recreate /run/current-system symlink after boot.
  services.activate-system.enable = true;

  services.nix-daemon.enable = true;

  nix.binaryCaches = [ http://cache1 ];
  nix.binaryCachePublicKeys = [ "cache.daiderd.com-1:<KEY> ];

  nix.trustedUsers = [ "@admin" "@hydra" ];

  nix.extraOptions = ''
    pre-build-hook =
  '';

  nix.gc.automatic = true;
  nix.gc.options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";

  environment.etc."per-user/hydra/ssh/authorized_keys".text = concatStringsSep "\n"
    [ "command=\"${environment} ${config.nix.package}/bin/nix-store --serve --write\" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCVsc0pHGsskoayziMhA2e59bHPWe0bbKgusmqhuJFBGQ1BAk9UmPzKCWE3nCiV6CLD1+SygVkBjb06DY<KEY>qZtL0G4+2vhp6x8OvXh8xlf/eWw3k5MWlvu+kjJFpbW8wHWTiUqzH+uEeHklAosT0lFNjiIYd/Vs3JAezhUR62a6c7ZjWOd5F7ALGEKzOiwC4i37kSgGsIWNCbe0Ku7gyr718zhMGeyxax6saHhnkSpIB+7d6oHhKeiJSFMWctNmz1/qxXUPbxNaJvqgdKlVHhN+B7x/TIbkVr5pTC59Okx9LTcpflFIv79VT+Gf1K7VypZpSvJjG0xFRt8iDs1+ssWFBfvpo94vUbZ+ZwMDcBGR5iJeO41Gj5fYn5aaDl32RXfJ9Fkwael1L6pcXtkIc66jk+KQQpgoeNj8Y3Emntpqva/2AM41wDDvr5tKp5KhEKFLM95CoiWq+g88pZLcpqLK7wooDVqNkVUEbMaj9lBN0AzU9mcsIRGvTa6CmWAdBvwqS2fRZD97Oarqct9AWgb0X6mOUq9BJNi4i4xvjgnVkylLwtLUnibR/PeXMtkb9bv6BEZXNf5ACqxSjKXJyaIHI65I5TILCr5eEgaujgvmkREn6U3T1NZAUIeVe9aVYLqehYh79OHUBzggoHqidRrXBB/6zdg9UgQ=="
      "command=\"${environment} ${config.nix.package}/bin/nix-store --serve --write\" ssh-rsa <KEY>
    ];

  users.knownGroups = [ "hydra" ];
  users.knownUsers = [ "hydra" ];
  users.groups.hydra = { gid = 530; description = "Hydra builder group"; };
  users.users.hydra = { uid = 530; gid = 530; description = "Hydra"; home = "/Users/hydra"; shell = "/bin/bash"; isHidden = true; };

  system.activationScripts.postActivation.text = ''
    echo "configuring hydra group"
    dscl . -create /Groups/hydra GroupMembership hydra

    printf "configuring ssh keys for hydra... "
{'fraction_non_alphanumeric': 0.1286100145439435, 'fraction_numerical': 0.055682526490754204, 'mean_word_length': 4.7860576923076925, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7289540', 'n_tokens_mistral': 2461, 'n_tokens_neox': 2228, 'n_words': 252}