···8899## New Services {#sec-release-22.05-new-services}
10101111+- [aesmd](https://github.com/intel/linux-sgx#install-the-intelr-sgx-psw), the Intel SGX Architectural Enclave Service Manager. Available as [services.aesmd](#opt-services.aesmd.enable).
1212+1113## Backward Incompatibilities {#sec-release-22.05-incompatibilities}
12141315- `pkgs.ghc` now refers to `pkgs.targetPackages.haskellPackages.ghc`.
+47
nixos/modules/hardware/cpu/intel-sgx.nix
···11+{ config, lib, ... }:
22+with lib;
33+let
44+ cfg = config.hardware.cpu.intel.sgx.provision;
55+ defaultGroup = "sgx_prv";
66+in
77+{
88+ options.hardware.cpu.intel.sgx.provision = {
99+ enable = mkEnableOption "access to the Intel SGX provisioning device";
1010+ user = mkOption {
1111+ description = "Owner to assign to the SGX provisioning device.";
1212+ type = types.str;
1313+ default = "root";
1414+ };
1515+ group = mkOption {
1616+ description = "Group to assign to the SGX provisioning device.";
1717+ type = types.str;
1818+ default = defaultGroup;
1919+ };
2020+ mode = mkOption {
2121+ description = "Mode to set for the SGX provisioning device.";
2222+ type = types.str;
2323+ default = "0660";
2424+ };
2525+ };
2626+2727+ config = mkIf cfg.enable {
2828+ assertions = [
2929+ {
3030+ assertion = hasAttr cfg.user config.users.users;
3131+ message = "Given user does not exist";
3232+ }
3333+ {
3434+ assertion = (cfg.group == defaultGroup) || (hasAttr cfg.group config.users.groups);
3535+ message = "Given group does not exist";
3636+ }
3737+ ];
3838+3939+ users.groups = optionalAttrs (cfg.group == defaultGroup) {
4040+ "${cfg.group}" = { };
4141+ };
4242+4343+ services.udev.extraRules = ''
4444+ SUBSYSTEM=="misc", KERNEL=="sgx_provision", OWNER="${cfg.user}", GROUP="${cfg.group}", MODE="${cfg.mode}"
4545+ '';
4646+ };
4747+}