Trying out NixOS on a Microsoft Surface Pro 9. Mostly keeping notes for myself and just to store the NixOS configuration for it.
Hostname for my system is papyrus, so that will pop up in random commands.
I moved notes and scripts from development into the linux-surface-dev repo to not clutter my nix files here.
To build the top level filesystem result, this also works from a non NixOS host;
nix build .#nixosConfigurations.papyrus.config.system.build.toplevel
From Brian McGee's post on how to setup a nix machine.
When large local builds have to happen, add -L for logging and set the amount of build cores;
NIX_BUILD_CORES=10 nix build .#nixosConfigurations.papyrus.config.system.build.toplevel -L
Then, we can copy closure that with (assuming ivor is in trusted-users):
nix copy --to "ssh://ivor@papyrus" ./result
nixos-rebuild switch --flake .#papyrus
nix fmt
List them with;
nix-env --list-generations --profile /nix/var/nix/profiles/system
Discard with;
nix-env --delete-generations --profile /nix/var/nix/profiles/system <number>
Discard all but most recent 5;
nix-env --delete-generations --profile /nix/var/nix/profiles/system +5
The flake.nix file has some custom settings for generating a recovery image that includes this repository in the /home/nixos/nixos-surface/ path.
The USB image can be built with:
nix build .#nixosConfigurations.recovery.config.system.build.isoImage --out-link recovery.priv.result -L
nix build .#nixosConfigurations.papyrus.pkgs.gnome-eog-plugins
See ./installation.md for details on the installation procedure.
Give gnome minimize and maximize buttons;
gsettings set org.gnome.desktop.wm.preferences button-layout "appmenu:minimize,maximize,close"
(Default is appmenu:close).
Ensure the file explorer always gives the location/path as a text box with a string instead of buttons;
gsettings set org.gnome.nautilus.preferences always-use-location-entry true
From here.
- This flake is always available in
/run/booted-system/flake/, flakecurrentis that. - The
current#pkgspoints tonixosConfigurations.papyrus.pkgs. - The
nixpkgs#flake points at the pinned upstream nixpkgs without overlays.
-
On screen keyboard
- Figure out how to make the gnome onscreen keyboard display normal
!@#$%^&*()_+symbols. Forked enhanced osk. - Make on screen keyboard not waste precious pixels. Filed cass00/enhanced-osk-gnome-ext#7
- Make the new on screen keyboard appear in lock screen. Magically solved itself with the reinstall...
- Give it an 'inhibit' option, where it doesn't automatically pops up when you click text, for when you have the typecover attached.
- Extension is again gone in gdm, fixed with the gnome dconf database now such that it's always good.
- Figure out how to make the gnome onscreen keyboard display normal
-
Pen
- This tool is probably helpful
- Check the false positive pen thumb-button clicks in gimp, these and issues may be applicable. Filed this.
- Pen contact detection is also glitchy.
- Ensure pen talks libwacom? libwacom-surface and libwacom, linux-surface wiki mentions this flake. Is this relevant? Not really, marking as done.
-
Power / Battery
- Suspended over night, drained 68% to 45%, did not wake from suspend in the morning, this type cover issue where it can't wake from suspend in some conditions seems applicable. Currently disabled the buttons, see also this issue and wiki entry. Likely caused by incorrect suspend from cover.
- Can we investigate trickle charging / not keeping battery at 100% for longevity? Battery charge IC likely is
BQ25713. See smart charging, ruled out byBatteryDm.cs, it explicitly throws when trying to ste it to true, likely really not possible. - Disabled
enable_psrfor now to mitigate screen flickering, could pursue it against latest kernel, intel seems to be doing work on it.
-
Thermal stuff
- Make fans turn on quicker, may just be a matter of installing thermald? Even on windows things get pretty hot, maybe that's normal? Research!
- Logging messages from windows, all the way from boot. irpmon wiki improvements
- Make fan rpm monitoring module: linux-surface/kernel#144
- Make platform profile switch the fan profile: linux-surface/kernel#145
- Have to make
thermalddo the thing instead, figure this out, contrib config to thermald contrib dir. Thermald is really hard to configure, are there alternatives? Can't find alternatives, current profile is clunky, but at least we don't to the overheat stage. Currently piggybacks off of wifi, should revisit once this is merged. Good enough for now, but should get more tuning before contrib upstream.
-
OS / System / Nix stuff
- Deploy some encryption, either LUKS & TPM or ecryptfs on the homedir. See also this, now using LUKS2, typecover works with appropriate kernel modules.
- Fix multiboot clock, done by setting the registry key found in the windows subdirectory.
- Create live cd with this readme and config, in case we need to recover.
- Sometimes we can't type at the full disk encryption page, if we use USB keyboard, only half of the kernel modules get loaded, platform profile for example is missing. Not seen since kernel update.
- Machine shut down if on LUKS password in initram fs for 'n' seconds. To avoid draining battery if accidentally powered on. Perhaps with something like this. Commit, we now start systemd in initrd stage, we have a one shot service that monitors for
initrd-root-device.targetcompleting, if that completes it exits, if it reaches a timer it shuts down the machine again.
-
Misc usability
- Eye of Gnome plugins for slideshowshuffle, commit.
- Changing wifi settings without password commit.
- Caja show location as textbox commit.
- Caja HEIC thumbnails? commit
- mpv volume persistance this; Cloned this repo into
~/.config/mpv/scripts/, followed byln -s persist-properties.lua main.lua. - Does 'declutter' exist to hide the cursor? This one, clone into
~/.local/share/gnome-shell/extensionswith namehide-cursor@elcste.com, be sure to check outv.1.3.0for gnome 45. - Hotspot / local wifi where devices can see each other (not like iOS hotspot) to transfer files.
- Added instructions for boot logging to the IRPMon wiki: MartinDrab/IRPMon#113
- Surface Fan module. linux-surface/kernel#144 upstream kernel v5 thread
- Platform profile, switch fan profile. linux-surface/kernel#145
- Surface Aggregator Module: IRPMon conversion script improvements. linux-surface/surface-aggregator-module#66
- Forked gnome OSK to https://github.com/iwanders/gnome-enhanced-osk-extension
- Contribute back enhanced OSK suggestions bar: cass00/enhanced-osk-gnome-ext#7
- Contribute mppv2+ / Slim Pen 2 fixes to iptsd: linux-surface/iptsd#156