Skip to content

nwdepatie/nixos-surface

 
 

Repository files navigation

NixOS Surface

Forked to tinker with my own Surface

Trying out NixOS on a Microsoft Surface Pro 6. 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.

Useful links;

Useful Commands;

Build top level:

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

Actually switch to the new config

nixos-rebuild switch --flake .#papyrus

Format this repo

nix fmt

Discard old NixOS generations

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

Connecting via SSH

Boot from minimal nixos image from usb, then run the 'start wifi' from the motd, then use:

$ wpa_cli
> add_network
0
> set_network 0 ssid "myhomenetwork"
OK
> set_network 0 psk "mypassword"
OK
> set_network 0 key_mgmt WPA-PSK
OK
> enable_network 0
OK

To connect to wifi, followed by giving root a password with passwd, then ssh in from another machine by ssh root@nixos.

Misc config

Give gnome minimize and maximize buttons;

gsettings set org.gnome.desktop.wm.preferences button-layout "appmenu:minimize,maximize,close"

(Default is appmenu:close).

Flake reminders

  • This flake is always available in /run/booted-system/flake/, flake current is that.
  • The current#pkgs points to nixosConfigurations.papyrus.pkgs.
  • The nixpkgs# flake points at the pinned upstream nixpkgs without overlays.

Todo

  • 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.
  • Pen

  • 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 by BatteryDm.cs, it explicitly throws when trying to ste it to true, likely really not possible.
    • Disabled enable_psr for 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 thermald do 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.

About

NixOS on Microsoft Surface Pro Pro 6

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 100.0%