# Doas on Guix System

**URL:** https://forum.systemcrafters.net/t/doas-on-guix-system/2082
**Category:** General
**Created:** [July 15, 2026, 2:04am UTC](https://forum.systemcrafters.net/t/doas-on-guix-system/2082 "2026-07-15T02:04:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ced4rtree](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ced4rtree/32/821_2.png) [@ced4rtree](https://forum.systemcrafters.net/u/ced4rtree)
#### Post date: [July 15, 2026, 2:04am UTC](https://forum.systemcrafters.net/t/doas-on-guix-system/2082/1 "2026-07-15T02:04:17Z")

</div>

The `doas` program is packaged on guix, but is there a way to completely remove `sudo` in preference of `doas`? On nixos one can simply `programs.sudo.enable = false`, but it seems a bit more involved on guix.

The only place I’ve found so far through a cursory glance over the guix repository is that `sudo` is only installed by the `%base-packages/hurd` variable, so could I modify that list to achieve my goal, or are there other places in guix where `sudo` is expected?

---

<div class="post-metadata">

### Author: ![wxie](https://avatars.discourse-cdn.com/v4/letter/w/ee59a6/32.png) [@wxie](https://forum.systemcrafters.net/u/wxie)
#### Post date: [July 15, 2026, 2:28am UTC](https://forum.systemcrafters.net/t/doas-on-guix-system/2082/2 "2026-07-15T02:28:11Z")

</div>

You may need to do

```auto
sudo guix system reconfigure

```

---

<div class="post-metadata">

### Author: ![ced4rtree](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ced4rtree/32/821_2.png) [@ced4rtree](https://forum.systemcrafters.net/u/ced4rtree)
#### Post date: [July 15, 2026, 6:00am UTC](https://forum.systemcrafters.net/t/doas-on-guix-system/2082/3 "2026-07-15T06:00:22Z")

</div>

After a few hours of troubleshooting, I found the solution.

First, in order to get doas registered & configured properly, I had to create a custom service.

```lisp
(define (config->files config)
  `(("/etc/doas.conf" ,(plain-file
                        "doas.conf"
                        (string-append "permit setenv {PATH=/usr/local/bin"
                                       ":/usr/local/sbin:/usr/bin:/usr/sbin} :wheel\n")))))

(define doas-service-type
  (service-type
   (name 'doas)
   (extensions
    (list
     (service-extension privileged-program-service-type
                        (lambda _ (list (file-like->setuid-program (file-append opendoas "/bin/doas")))))
     (service-extension profile-service-type
                        (lambda _ (list opendoas)))
     (service-extension special-files-service-type
                        config->files)))
   (description "A portable fork of the OpenBSD doas command.")
   (default-value '())))

```

It’s pretty hacky right now, but I’m thinking about cleaning it up, adding some actual configuration, and submitting a PR to the guix repo to add this.

Secondly, in order to remove sudo, you have to delete the entry from your privileged programs list.

```lisp
(operating-system
  ;; some fields omitted
  (privileged-programs
   (delete (file-like->setuid-program (file-append sudo "/bin/sudo"))
           (delete (file-like->setuid-program (file-append sudo "/bin/sudoedit"))
                   %default-privileged-programs)))

```

This technically doesn’t remove sudo from your system profile, since there’s a line in the guix code adding it to `%base-packages`, but it does prevent sudo from actually working. If you want to go the extra mile you can remove sudo entirely by using the value returned by `(delq sudo %base-packages)` instead of just `%base-packages`
