about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-03-26 16:45:57 +0000
committerGitHub <noreply@github.com>2020-03-26 16:45:57 +0000
commitedb7199b5c4f1db34a7253d4cabf6cf690521a92 (patch)
treef656d4024e48bf17f71376b71f28c8333e62891d
parentf4364f2457051b407899f7fc3bced4ac952644ff (diff)
parent12bb72aa6bac6634ca17c5664fda84e29995f763 (diff)
downloadnixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar.gz
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar.bz2
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar.lz
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar.xz
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.tar.zst
nixlib-edb7199b5c4f1db34a7253d4cabf6cf690521a92.zip
Merge pull request #152 from ngiger/librem15v3
Added Librem15v3
-rw-r--r--README.md2
-rw-r--r--purism/librem/13v3/README.md75
l---------purism/librem/15v31
3 files changed, 78 insertions, 0 deletions
diff --git a/README.md b/README.md
index 856702816079..8210ed10cabb 100644
--- a/README.md
+++ b/README.md
@@ -74,6 +74,7 @@ See code for all available configurations.
 | [Raspberry Pi 2][]                | `<nixos-hardware/raspberry-pi/2>`                  |
 | [Samsung Series 9 NP900X3C][]     | `<nixos-hardware/samsung/np900x3c>`                |
 | [Purism Librem 13v3][]            | `<nixos-hardware/purism/librem/13v3>`              |
+| [Purism Librem 15v3][]            | `<nixos-hardware/purism/librem/15v3>`              |
 | Supermicro A1SRi-2758F            | `<nixos-hardware/supermicro/a1sri-2758f>`          |
 | Supermicro X10SLL-F               | `<nixos-hardware/supermicro/x10sll-f>`             |
 | [Toshiba Chromebook 2 `swanky`][] | `<nixos-hardware/toshiba/swanky>`                  |
@@ -97,6 +98,7 @@ See code for all available configurations.
 [Raspberry Pi 2]: raspberry-pi/2
 [Samsung Series 9 NP900X3C]: samsung/np900x3c
 [Purism Librem 13v3]: purism/librem/13v3
+[Purism Librem 13v5]: purism/librem/13v5
 [Toshiba Chromebook 2 `swanky`]: toshiba/swanky
 
 ## How to contribute a new device profile
diff --git a/purism/librem/13v3/README.md b/purism/librem/13v3/README.md
index 8009eb3279c4..b4bae0b2f886 100644
--- a/purism/librem/13v3/README.md
+++ b/purism/librem/13v3/README.md
@@ -1,3 +1,6 @@
+This config is for [Librem 13v3](https://puri.sm/products/librem-13/) and [15v3](https://puri.sm/products/librem-15/) Laptops from Purism.
+
+
 Librem comes with Coreboot + SeaBIOS payload. That means EFI boot is not
 possible. Use `fdisk` to partition hard drive, and GRUB as a bootloader:
 
@@ -10,3 +13,75 @@ possible. Use `fdisk` to partition hard drive, and GRUB as a bootloader:
   };
 }
 ```
+
+## Adding a PureOS partition to the GRUB menu
+
+I first assume that `boot.loader.grub.useOSProber = true;` should be sufficient.
+However GRUB was not able to identify the disks correctly and it took me several
+reinstallation till setting `boot.loader.grub.fsIdentifier= "provided";` and using
+boot.loader.grub.extraEntries allowed me to dual boot NixOS and PureOS.
+
+Be aware that each time the PureOS updates the /boot/grub/grub.cfg you will be unable
+to boot into NixOS unless you patch grub.cfg manually again.
+
+Therefore: If you want to be able to boot into your old PureOS distribution
+add the following lines, assuming that you have a separate boot partition
+Adapt linux version and the UUID to your disk!!
+
+
+```nix
+{
+  boot.loader.grub.useOSProber = false;
+  boot.loader.grub.fsIdentifier= "provided";
+  boot.loader.grub.extraEntries = ''
+  menuentry "PureOS with linux 4.19.0-5-amd64 on /dev/sdb2 " {
+      insmod gzio
+      if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
+      insmod part_msdos
+      insmod ext2
+      set root='hd0,msdos1'
+      if [ x$feature_platform_search_hint = xy ]; then
+        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  ef7a4dcf-8cc4-4870-b860-3ed64906f9b9
+      else
+        search --no-floppy --fs-uuid --set=root ef7a4dcf-8cc4-4870-b860-3ed64906f9b9
+      fi
+      linux   /vmlinuz-4.19.0-5-amd64 root=UUID=43899f26-04f2-4ccb-b52a-c9441f1a1a6d ro  quiet splash resume=UUID=923317f8-d8bb-4e1f-bca3-f36a556de609 # $vt_handoff
+      initrd  /initrd.img-4.19.0-5-amd64
+  };
+}
+```
+
+## Automatically lock the desktop when removing the librem key
+
+The [instructions](https://docs.puri.sm/Librem_Key/Getting_Started/User_Manual.html#automatically-lock-the-desktop-when-removing-the-librem-key) to lock the screen after unplugging the [Librem Key](https://puri.sm/products/librem-key/#overview) don't work under NixOS.
+
+This snippet works on my Librem 15v3 laptop running KDE without wayland and is using the xlock from the package xlockmore.
+
+```nix
+{ pkgs, services , systemd, ... }:
+let
+  libremScreenSaver = pkgs.writeScriptBin "libremScreenSaver" ''
+  #!${pkgs.bash}/bin/bash
+  user=`ps aux | egrep "start_kdeinit|gdm-(wayland|x)-session"| head -n 1 | awk '{print $1}'`
+  if [ -n "$user" ]; then
+    sudo -u $user DISPLAY=:0 xlock 2>&1 | logger lockScreen for user $user
+  else
+    logger libremScreenSaver failed to find a user. Not running KDE?
+  fi
+  '';
+
+in {
+  services.udev.path = [ pkgs.procps pkgs.logger pkgs.gawk pkgs.xlockmore ];
+  services.udev.extraRules = ''
+    ACTION=="remove", ENV{PRODUCT}=="316d/4c4b/101" RUN+="${pkgs.systemd}/bin/systemctl --no-block start lockScreen@%k.service"
+  '';
+  systemd.services."lockScreen@" = {
+    bindsTo = [ "dev-%i.device"] ;
+    path = [ pkgs.procps pkgs.logger pkgs.sudo pkgs.xlockmore pkgs.gawk ] ;
+    serviceConfig = {
+        Type = "oneshot"; # was simple
+        ExecStart = "${libremScreenSaver}/bin/libremScreenSaver %I";
+    };
+  };
+}
+```
diff --git a/purism/librem/15v3 b/purism/librem/15v3
new file mode 120000
index 000000000000..feb0d06fafda
--- /dev/null
+++ b/purism/librem/15v3
@@ -0,0 +1 @@
+13v3/
\ No newline at end of file