# vim:syntax=apparmor
# nvidia access requirements

  abi <abi/4.0>,

  # configuration queries
  capability ipc_lock,

  /etc/nvidia/nvidia-application-profiles* r,
  /usr/share/nvidia/nvidia-application-profiles* r,

  # libvdpau config file for nvidia workarounds
  /etc/vdpau_wrapper.cfg r,

  # device files
  /dev/nvidiactl rw,
  /dev/nvidia-modeset rw,
  /dev/nvidia[0-9]* rw,

  @{PROC}/interrupts r,
  @{PROC}/sys/vm/max_map_count r,
  @{PROC}/driver/nvidia/params r,
  @{PROC}/modules r,

  @{sys}/devices/system/memory/block_size_bytes r,

  owner @{HOME}/.cache/nvidia/ w,
  owner @{HOME}/.cache/nvidia/GLCache/ rw,
  owner @{HOME}/.cache/nvidia/GLCache/** rwk,
  owner @{HOME}/.nv/ w,
  owner @{HOME}/.nv/GLCache/ rw,
  owner @{HOME}/.nv/GLCache/** rwk,
  owner @{HOME}/.nv/nvidia-application-profiles* r,
  owner @{PROC}/@{pid}/comm r, # somehwere in libnvidia-glcore.so

  unix (send, receive) type=dgram peer=(addr="@nvidia[0-9a-f]*"),
  unix (send, receive) type=dgram peer=(addr="@var/run/nvidia-xdriver-*"),

  # Include additions to the abstraction
  include if exists <abstractions/nvidia.d>
