help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding PolicyKit actions


From: Robby Zambito
Subject: Adding PolicyKit actions
Date: Mon, 29 May 2023 16:27:11 -0400
User-agent: mu4e 1.10.2; emacs 28.2

Hello,

The root issue I am trying to solve right now is allowing USB
redirection to virtual machines. I've tracked down a promising solution
here: https://serverfault.com/a/1073230 which involves adding a new
PolicyKit action for low level USB access. Digging into the Guix source
I was able to find the definition of polkit-configuration (the manual
merely mentions that it exists; I may be able to help write more
documentation here if I figure this out :) ) and I'm hitting a wall
trying to figure out what I am doing wrong.

Here is the configuration I have added to my polkit-service in my system
configuration:

```
(service polkit-service-type
         (polkit-configuration
          (actions (list
                    (plain-file "org.spice-space.lowlevelusbaccess.policy"
                                     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE policyconfig PUBLIC
          \"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN\"
          
\"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd\";>
<policyconfig>

  <vendor>The Spice Project</vendor>
  <vendor_url>http://spice-space.org/</vendor_url>
  <icon_name>spice</icon_name>

  <action id=\"org.spice-space.lowlevelusbaccess\">
    <description>Low level USB device access</description>
    <message>Privileges are required for low level USB device access (for usb 
device pass through).</message>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

</policyconfig>")))))
```

Looking at the code it looks like `polkit-configuration` has an
`actions` field that should be a list of file-like objects, which I
think is what my code should be doing.

However, I get this error when I build my system:

```
Backtrace:
           5 (primitive-load "/gnu/store/avr2qvlgydsvny8dkjl5mvjc0b6?")
In guix/build/union.scm:
    192:6  4 (union-of-directories "/gnu/store/dikmqs3qk5x4v5lhz417?" ?)
In srfi/srfi-1.scm:
    634:9  3 (for-each #<procedure 7ffff77dc6a0 at guix/build/union?> ?)
In guix/build/union.scm:
   194:28  2 (_ "/gnu/store/hvq9rhwkslc9kqhyjaa6mzb61i069jyd-lowleve?")
    56:13  1 (files-in-directory "/gnu/store/hvq9rhwkslc9kqhyjaa6mzb?")
In unknown file:
           0 (opendir "/gnu/store/hvq9rhwkslc9kqhyjaa6mzb61i069jyd-l?")

ERROR: In procedure opendir:
In procedure opendir: Not a directory
```

Not very helpful to me :/

Any help would be appreciated!

Thanks,
Robby



reply via email to

[Prev in Thread] Current Thread [Next in Thread]