Hi Rodion, and fellow Guixers!

Great initiative! And sorry for taking so long to respond.

Rodion Goritskov <[email protected]> writes:

> Hello, fellow Guixers!
>
> During the Guix Days, we had the opportunity to discover that many of us
> are running Guix on various types of hardware. So why not share some
> success (and failure) stories about using Guix as a distribution or
> package manager on different devices, such as aarch64 laptops and
> tablets, mobile phones, Steam Decks, and more?
>
> We can not only share stories but also code snippets, including OS or
> image specifications, to help others get started with Guix on their
> unique and (probably) weird devices.
>
> Happy hacking!
>
> ----
>
> I want to start with my own experience. I have a marvelous MNT Pocket
> Reform with RK3588 [1]. It comes with Debian Linux pre-installed, but
> my long-term dream was to run the Guix system on it. After one of the
> Debian updates broke the GDM and rendered the device unusable for me, I
> decided it was time to take action.
>
> I began by attempting to package the bootloader, only to discover that
> it requires a proprietary blob for the RAM module initialization. While
> this is unfortunate, as long as we don’t plan to overwrite the stock
> U-Boot on eMMC, we should be fine.
>
> I did spend some time building U-Boot, but that's outside the scope of
> this note. It was a huge relief when I came across Wilko Meyer’s post on
> the matter [2].
>
> In this post, Wilko outlines all the necessary steps to run the Guix
> distribution on the MNT Pocket Reform. From here, in example, I
> found out that upstream Guix already has the kernel variant for MNT
> Reform line of products (with all the necessary patches applied) [3].
>
> Here is Wilko's follow-up post with the current state of RK3588 MNT
> Reform support (I just discovered it while writing this email) [4].
>
> However, be aware of some issues:
> - 3D acceleration is non-functional on the libre kernel (non-free
> firmware is required).
> - The stock WiFi (or WiFi + Bluetooth, if you have the Intel AX210) also
> requires non-free firmware, so it is not functional. The latest RCORE
> carrier board for the MNT Pocket Reform has an M.2 E-Key slot, meaning
> the Intel AX210 could potentially be replaced with something more
> freedom-friendly.
> - Framebuffer currently rotated 90 degrees, as kernel option necessary
> to fix this is not enabled.
> - Because of previous issue, I recommend you using greetd with sway,
> they are automatically rotated right (:
>
> Here is my greetd configuration to run sway (also got it from Wilko):
>
>> (service greetd-service-type
>>   (greetd-configuration
>>     (greeter-supplementary-groups (list "video" "input" "seat"))
>>     (terminals
>>       (list 
>>         (greetd-terminal-configuration
>>           (extra-shepherd-requirement '(seatd))
>>           (terminal-vt "1")
>>           (terminal-switch #t)
>>           (default-session-command
>>             (greetd-gtkgreet-sway-session
>>               (command
>>                 (greetd-user-session
>>                   (command (file-append dbus "/bin/dbus-run-session"))
>>                   (command-args (list (file-append sway "/bin/sway")))
>>                   (xdg-session-type "wayland"))))))
>>         (greetd-terminal-configuration (terminal-vt "2"))
>>         (greetd-terminal-configuration (terminal-vt "3"))
>>         (greetd-terminal-configuration (terminal-vt "4"))
>>         (greetd-terminal-configuration (terminal-vt "5"))
>>         (greetd-terminal-configuration (terminal-vt "6"))
>>         (greetd-terminal-configuration (terminal-vt "7"))))))
> This configuration also requires adding dbus to system packages list.
>
> All in all, I am pretty happy with this setup and now working on packing
> FEX emulator [5] for the Guix to be able to run x86_64 binaries.
>
>
> 1 - https://shop.mntre.com/products/mnt-pocket-reform
> 2 - 
> https://me.literatelisp.eu/installing-and-running-guix-system-on-rk3588-mnt-pocket-reform.html
> 3 - 
> https://codeberg.org/guix/guix/src/commit/1d3d7912d5ee8198e4c7dba2d643aca67d34c854/gnu/packages/linux.scm#L1590
> 4 - 
> https://me.literatelisp.eu/guix-on-mnt-pocket-reform-whats-still-missing.html
> 5 - https://github.com/FEX-Emu/FEX
>

** Background

I'm the one that brought the Steam Deck to the Guix Days.  Compared to
the MNT Pocket Reform computers that runs an ARM chip, the Steam Deck is
surprisingly similar to just a normal x86-64 laptop.  But before I dive
into the details on setting it up, first a bit of a background story to
why I ended up using it.  I used a Lenovo x220 laptop since it came out
back in 2012, it has served me well throughout the years, only in recent
years have it shown its aged.  So I started looking around for a
replacement.

I discovered the MNT Reform laptop [0], a bit pricy and not that much
performance.  But almost fully open source both hardware and software
lured me in.  I bought one and I was quite hyped when I got it, sadly it
turned out it needed binary blobs to run plus it's underpowered SoC made
it not a great candidate to run Guix — I'm still hoping it might be in
the future.

Another aspect of my computer journey is that I started using split
staggered keyboards — and switched to Colemak DH during the pandemic —
which means normal keyboards are not that comfortable or enticing for me
to use.  With the MNT Reform, you can design you own and plop that in
[1].  Which was another reason why I decided to take the plunge.  But
the low performance and the complexity with dealing with ARM put it out
of being a x220 replacement.

I bought the Steam Deck 2023, mostly because of it being nice to be able
to game while traveling.  Living on the West Coast of Canada and having
most of my family in Europe makes for some long trips.  It being open to
install other things did sound promising.

Winter 2024 I was still rocking my x220 as my travel laptop.  A year
before, the original battery gave up and I bought a new clone battery.
It worked well in the beginning, the quality however wasn't the same.
Around November the battery dramatically got worse and then it couldn't
hold a charge.  With FOSDEM and Guix Days approaching and my trusty x220
out of commission, I figured I might try to use my Steam Deck.  I had
tested to run Guix on it earlier that year but didn't work super well,
for example no sound support.

This time it went much better, sound support had landed and everything
pretty much worked out of the box.  It does however require the linux
kernel and a bunch of binary blobs.  A big step back compared to my
x220.  I did bring it to the Guix Days 2025, pared with a Ferris Sweep
keyboard [2].  It worked better than I had expected, so I brought it
with me to this years Guix Days.  This time pared with a slightly modded
Kyria rev 2 [3] — the outer columns broken off and one less key on the
lowest row.

** Setup

I went with a dual boot solution with Guix and SteamOS.  I'm treating
SteamOS as I did Windows way back in the days when I dual booted Windows
and other linux distributions, and that is keep them separate.  SteamOS
will nuke anything outside of the home directory and it will overwrite
the UEFI boot meny every time it updates.  There might be a way to tell
it to keep Guix around in the UEFI boot meny.  I decided to avoid that
headache as I discovered that you can just as easy in the UEFI boot from
an EFI file.  So to boot Guix I navigate to its EFI partition and pick
the =guix.efi= file and boot.  Similar with SteamOS.  But I'm getting a
bit ahead of myself.

To install guix on the Steam Deck I first shrunk the home partition
using the KDE partition manager from SteamOS recovery disk [4].  I first
tested to use cfdisk from a guix live image, but I ended up with a
bootloop.  Which is what the SteamOS recovery disk came into play.  The
Steam Deck has a total of 8 partition [5].  The first is the EFI boot
partition.  Then it has 3 partition each for A and B image.  The eight
partition is the /home partition.  So I just shrunk the /home partition
with the KDE partition manager to make room for a ninth partition that I
can use for Guix.

For the EFI boot partition, I put that on a SD card that I plugged into
the Steam Deck.  My thinking was that if I pull that out there are no
real trace that I got a dual boot setup.  However, not entirely true in
practice as the UEFI can still contain guix entries, depending on which
system you updated last.

My layout ended up looking like this:

/dev/mmcblk0p1 <- EFI on the SD card
/dev/nvme0n1p9 <- Encrypted partition for Guix

For creating the partitions I followed mostly the Guix manual on Disk
Partitioning [6].

For those that are interested, here are the commands I used:
#+begin_src sh
  mkfs.fat -F32 /dev/mmcblk0p1 -n GUIX-ESP
  cryptsetup luksFormat --type luks2 --pbkdf pbkdf2 /dev/nvme0n1p9
  cryptsetup open /dev/nvme0n1p9 partition
  mkfs.btrfs -L guix-root /dev/mapper/partition
  mount LABEL=guix-root /mnt/
  cd /mnt && \
    btrfs subvolume create @ && \
    btrfs subvolume create @home && \
    btrfs subvolume create @swap && \
    btrfs subvolume create @snapshots && \
  cd -
  umount /mnt
  mount -o compress=zstd,subvol=@ LABEL=guix-root /mnt
  mkdir -p /mnt/{home,.snapshots,swap,boot}
  mount LABEL=guix-root -o compress=zstd,subvol=@home /mnt/home && \
    mount LABEL=guix-root -o compress=zstd,subvol=@snapshots /mnt/.snapshots && 
\
    mount LABEL=guix-root -o subvol=@swap /mnt/swap && \
    mount LABEL=GUIX-ESP /mnt/boot
  btrfs filesystem mkswapfile --size 4g --uuid clear /mnt/swap/swapfile
  swapon /mnt/swap/swapfile
#+end_src

The ~operating-system~ configuration looks quite normal.  Only special
things I needed was to configure it to use the linux kernel along with
binary blobs for firmware.  And add ~fbcon=rotate:1~ to rotate the
screen to be the right orientation during boot.

I also added the service:

#+begin_src guile
(elogind-service-type
        config => (elogind-configuration
                   (handle-power-key 'suspend)))
#+end_src

To be able to hit the power button to suspend the machine — same as you
do in SteamOS.  The ~bootloader~ is the same I use for all my machines,
i.e.

#+begin_src guile
(operating-system
   …
   (bootloader
    (bootloader-configuration
     (bootloader grub-efi-bootloader)
     (targets (list "/boot"))))
   …)
#+end_src

For my sway configuration I have:

#+begin_src guile
(home-sway-service-type
        config => (sway-configuration
                   (inherit config)
                   (variables `((main . "'Valve Corporation ANX7530 U 
0x00000001'")
                                (touch . "10248:4117:FTS3528:00_2808:1015")
                                 …))
                   …
                   (inputs
                    (list (sway-input
                           (identifier '$touch)
                           (extra-content '("map_to_output $main")))
                          …))))
#+end_src

To map the touchscreen correctly to the built-in monitor.  And that's it.

** Conclusion

It does lack a physical keyboard, so you need to add an external
keyboard to get a full "laptop" experience, although having it in you
lap is not that great.  It does have built-in trackpads and touch
screen.  By default the right touchpad works as the mouse, the left as a
scroll.  Then the trigger buttons at the back as the mouse buttons.  The
right trigger is left click and the left trigger button is the right
click.

One big downside is that it only has one built-in usb port.  So if you
need to charge and type at the same time you need to get creative.  The
solutions I have come up with are either plug in a hub — I'm currently
using a Hagibis TC100 [7] when traveling and that works well.  Or use a
bluetooth adapter for your keyboard — I'm using a BT-600 [8] — while you
have your charger plugged in.

I did try with the Linux-libre kernel.  You can boot with it.  However
you wont have any wifi, which is not a surprise — the wifi chip is sadly
soldered to the motherboard — and you cannot run anything that requires
the GPU.  Starting Sway just ended up with a black screen.  I'm
suspecting the GPU need some binary blobs to initialize, it is a
relative modern AMD chip after all.  I haven't investigate further than
that.  So I don't know if the controller, touchscreen or touchpads works
or not with the Linux-libre kernel.  With the Linux kernel everything
works.

Overall I'm quite happy with the setup.  It's not as convenient as a
regular laptop, it takes a bit more time to setup and tear down and the
7" screen can get a bit crowded for web browsing.  The battery life and
suspend are great.  Combining those two I had no problem making a full
day on Guix Days without needing to charge.  And it makes for a great
travel companion as I can game on it while on an airplane, train or
other transportation.  Then boot to Guix when I want to do some hacking.
So no extra laptop is required, which cuts down on travel gear.

- [0]: https://shop.mntre.com/products/mnt-reform
- [1]: https://kbd.news/Custom-Reform-keyboard-1375.html
- [2]: https://github.com/davidphilipbarr/Sweep
- [3]: https://splitkb.com/collections/keyboard-kits/products/kyria-rev2-pcb-kit
- [4]: https://help.steampowered.com/en/faqs/view/65B4-2AA3-5F37-4227
- [5]: 
https://github.com/randombk/steamos-teardown/blob/master/docs/partitions.md
- [6]: 
https://guix.gnu.org/manual/devel/en/html_node/Keyboard-Layout-and-Networking-and-Partitioning.html#Disk-Partitioning
- [7]: 
https://hagibis.com/products/type-c%E7%A3%81%E5%90%B8%E6%89%A9%E5%B1%95%E5%9D%9E-322
- [8]: http://handheldsci.com/kb/

-- 
s/Fred[re]+i[ck]+/Fredrik/g

Reply via email to