From 3c9f432a7146115b2d0b6200c4c19101c29caaba Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Fri, 22 Dec 2017 20:17:00 +0300 Subject: treewide: modules -> profiles, separate dirs, list in README (#29) Enforce proper naming: all paths are lowercase and hyphen-separated, if there's a line of models (aspire, macbook-pro, thinkpad) it becomes a subdirectory. Documentation for profiles is moved to README files in respective directories. Add an Org mode table that lists all available profiles and their paths. Instead of fetching repo locally, use a Nix channel. Making hardware profiles read-only should improve quality and amount of participation long-term. --- microsoft/hyper-v-guest.md | 63 ------------------------------------- microsoft/hyper-v/README.md | 63 +++++++++++++++++++++++++++++++++++++ microsoft/surface-pro/3/README.wiki | 41 ++++++++++++++++++++++++ microsoft/surface-pro/3/default.nix | 8 +++++ microsoft/surface_pro_3.nix | 8 ----- microsoft/surface_pro_3.wiki | 41 ------------------------ 6 files changed, 112 insertions(+), 112 deletions(-) delete mode 100644 microsoft/hyper-v-guest.md create mode 100644 microsoft/hyper-v/README.md create mode 100644 microsoft/surface-pro/3/README.wiki create mode 100644 microsoft/surface-pro/3/default.nix delete mode 100644 microsoft/surface_pro_3.nix delete mode 100644 microsoft/surface_pro_3.wiki (limited to 'microsoft') diff --git a/microsoft/hyper-v-guest.md b/microsoft/hyper-v-guest.md deleted file mode 100644 index f396214..0000000 --- a/microsoft/hyper-v-guest.md +++ /dev/null @@ -1,63 +0,0 @@ -This is a setup for installing NixOS in Hyper-V as a guest. - -I don't have details handy anymore on the detailed steps I had to do on the Windows host -(there's no NixWindows yet, unfortunately...), so you'll have to try googling that yourself, e.g. something like -"linux on hyper-v" or "ubuntu on hyper-v". (You're welcome to send PRs with improvements of this guide.) -Below, I'm providing only the info with what to do on the NixOS side of things. - -## Installation ## - -I basically followed the [guide for NixOS on VirtualBox](https://nixos.org/wiki/Installing_NixOS_in_a_VirtualBox_guest). -However, some additional changes in `/etc/nixos/configuration.nix` were required to really make it work -(I don't include them as a .nix file, as they must be done **before `nixos-install`**, and I'm not sure how to proceed -with cloning the nixos-hardware repo at this stage): - - # REQUIRED - see: https://github.com/nixos/nixpkgs/issues/9899 - boot.initrd.kernelModules = ["hv_vmbus" "hv_storvsc"]; - - # RECOMMENDED - # - use 800x600 resolution for text console, to make it easy to fit on screen - boot.kernelParams = ["video=hyperv_fb:800x600"]; # https://askubuntu.com/a/399960 - # - avoid a problem with `nix-env -i` running out of memory - boot.kernel.sysctl."vm.overcommit_memory" = "1"; # https://github.com/NixOS/nix/issues/421 - - # UNKNOWN - not sure if below are needed; were suggested for VirtualBox and I used them - boot.loader.grub.device = "/dev/sda"; - boot.initrd.checkJournalingFS = false; - -## Shared folder ## - -To share a folder between Windows host and Linux/NixOS guest, the typical solution seems to be to make a folder "shared" -on Windows, then access it via Samba from NixOS. -On the Windows host, I had to make an additional virtual switch in Hyper-V Manager, with mode "internal". -Then in properties of the virtual network card on Windows host (attached to the virtual switch), I -changed the IP to a fixed 10.0.0.100 (mask 255.255.255.240). I also added a special purpose user on the host, with some -long randomly generated password, to act as Samba credentials for NixOS. -To test that it works, I used the following commands: - - $ nix-env -iA nixos.samba - $ smbclient -L //10.0.0.100 -U shares-guest%ReplaceWithSomeLongRandomlyGeneratedPassword - Domain=[DESKTOP-ABCD123] OS=[Windows 10 Pro 14393] Server=[Windows 10 Pro 6.3] - - Sharename Type Comment - --------- ---- ------- - ADMIN$ Disk Administracja zdalna - C$ Disk Domyślny udział - IPC$ IPC Zdalne wywołanie IPC - shared-space Disk - Connection to 10.0.0.100 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) - NetBIOS over TCP disabled -- no workgroup available - - $ nix-env -e samba - -Then I added the following lines in `/etc/nixos/configuration.nix`: - - # Client for shared folder on Windows Hyper-V host - # Based on: nixpkgs.git/nixos/tests/samba.nix - fileSystems."/vm-share" = { - fsType = "cifs"; - device = "//10.0.0.100/shared-space"; - options = [ "username=shares-guest" "password=ReplaceWithSomeLongRandomlyGeneratedPassword" ]; - }; - networking.interfaces.eth1.ip4 = [{address="10.0.0.101"; prefixLength=28;}]; - diff --git a/microsoft/hyper-v/README.md b/microsoft/hyper-v/README.md new file mode 100644 index 0000000..f396214 --- /dev/null +++ b/microsoft/hyper-v/README.md @@ -0,0 +1,63 @@ +This is a setup for installing NixOS in Hyper-V as a guest. + +I don't have details handy anymore on the detailed steps I had to do on the Windows host +(there's no NixWindows yet, unfortunately...), so you'll have to try googling that yourself, e.g. something like +"linux on hyper-v" or "ubuntu on hyper-v". (You're welcome to send PRs with improvements of this guide.) +Below, I'm providing only the info with what to do on the NixOS side of things. + +## Installation ## + +I basically followed the [guide for NixOS on VirtualBox](https://nixos.org/wiki/Installing_NixOS_in_a_VirtualBox_guest). +However, some additional changes in `/etc/nixos/configuration.nix` were required to really make it work +(I don't include them as a .nix file, as they must be done **before `nixos-install`**, and I'm not sure how to proceed +with cloning the nixos-hardware repo at this stage): + + # REQUIRED - see: https://github.com/nixos/nixpkgs/issues/9899 + boot.initrd.kernelModules = ["hv_vmbus" "hv_storvsc"]; + + # RECOMMENDED + # - use 800x600 resolution for text console, to make it easy to fit on screen + boot.kernelParams = ["video=hyperv_fb:800x600"]; # https://askubuntu.com/a/399960 + # - avoid a problem with `nix-env -i` running out of memory + boot.kernel.sysctl."vm.overcommit_memory" = "1"; # https://github.com/NixOS/nix/issues/421 + + # UNKNOWN - not sure if below are needed; were suggested for VirtualBox and I used them + boot.loader.grub.device = "/dev/sda"; + boot.initrd.checkJournalingFS = false; + +## Shared folder ## + +To share a folder between Windows host and Linux/NixOS guest, the typical solution seems to be to make a folder "shared" +on Windows, then access it via Samba from NixOS. +On the Windows host, I had to make an additional virtual switch in Hyper-V Manager, with mode "internal". +Then in properties of the virtual network card on Windows host (attached to the virtual switch), I +changed the IP to a fixed 10.0.0.100 (mask 255.255.255.240). I also added a special purpose user on the host, with some +long randomly generated password, to act as Samba credentials for NixOS. +To test that it works, I used the following commands: + + $ nix-env -iA nixos.samba + $ smbclient -L //10.0.0.100 -U shares-guest%ReplaceWithSomeLongRandomlyGeneratedPassword + Domain=[DESKTOP-ABCD123] OS=[Windows 10 Pro 14393] Server=[Windows 10 Pro 6.3] + + Sharename Type Comment + --------- ---- ------- + ADMIN$ Disk Administracja zdalna + C$ Disk Domyślny udział + IPC$ IPC Zdalne wywołanie IPC + shared-space Disk + Connection to 10.0.0.100 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) + NetBIOS over TCP disabled -- no workgroup available + + $ nix-env -e samba + +Then I added the following lines in `/etc/nixos/configuration.nix`: + + # Client for shared folder on Windows Hyper-V host + # Based on: nixpkgs.git/nixos/tests/samba.nix + fileSystems."/vm-share" = { + fsType = "cifs"; + device = "//10.0.0.100/shared-space"; + options = [ "username=shares-guest" "password=ReplaceWithSomeLongRandomlyGeneratedPassword" ]; + }; + networking.interfaces.eth1.ip4 = [{address="10.0.0.101"; prefixLength=28;}]; + diff --git a/microsoft/surface-pro/3/README.wiki b/microsoft/surface-pro/3/README.wiki new file mode 100644 index 0000000..9ffdc55 --- /dev/null +++ b/microsoft/surface-pro/3/README.wiki @@ -0,0 +1,41 @@ +Work in progress. This is the setup for a dual-boot windows/NixOS. + +== Installation == + +Current requirements: +* USB stick +* Latest unstable minimal installation iso, I used [[https://nixos.org/releases/nixos/unstable/nixos-15.05pre61665.4c01e6d/nixos-minimal-15.05pre61665.4c01e6d-x86_64-linux.iso the 15.06-pre one]] +* (maybe) USB keyboard and therefore a USB hub +* WiFi SSID and password + +In the current installation iso, the kernel doesn't support the MS Type cover yet, so you need a USB keyboard for the initial install. Also note that at one point the keyboard wasn't working, and I couldn't see it in lsusb output. After a cold boot it worked fine. + +=== Steps === + +Preparation: +* Copy the ISO to the USB stick as explained [[https://nixos.org/nixos/manual/sec-installation.html#sec-booting-from-usb in the manual]]. Note that if you just dd the image onto the USB stick, it will boot without changes +* With Windows Disk Management, shrink the windows disk so you have room for your installation. Use the free space to create a new partition without a filesystem or drive letter. +* Check out [[https://github.com/cransom/surface-pro-3-nixos this expression and set of patches]] and add it to support newer versions of the Type Cover as well as enable the touch screen. + +* Reboot the Surface and furiously tap Esc until you end up in the BIOS screen. There, turn off secure boot (don't delete the keys), and change the boot order to USB + SSD. Save. +* You should now be in the NixOS installer +* Attach the USB stick and keyboard if the Type Cover doesn't work. The NixOS manual is at alt+F8 + +Installation: +* Using gdisk, print your partition table to find the empty partition you created. Find the EFI partition number (1 for me) and your new partition number (5 for me). +* Create your filesystem of choice on the partition, I picked btrfs: `mkfs.btrfs -L root /dev/disk/by-id/xxx-5` (xxx is the samsung ssd). Mount it on /mnt. +** With btrfs it's wise to put the nix store in its own subvolume: `btrfs subvol create /mnt/nix; btrfs subvol create /mnt/nix/store` +* We'll be using Gummiboot, which needs to access the EFI partition. `mkdir /mnt/boot; mount /dev/disk/by-id/xxx-1` +* Initialize your hardware configuration: `nixos-generate-config --root /mnt` +* Create your wifi credentials: `wpa_passphrase SSID PASS > /etc/wpa_supplicant.conf; cp /etc/wpa_supplicant.conf /mnt/etc`. Check that ifconfig gets an ip address. +* Edit /mnt/etc/configuration.nix, making sure that you have at least: + networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + boot.kernelPackages = pkgs.linuxPackages_latest; + # be able to use the type cover in the initrd + boot.kernelModules = [ "hid-microsoft" ]; +* Install: `nixos-install` + +If this completes successfully, you should be able to reboot, remove the USB stick, and NixOS should come up. + +'''Note''': If using the hid-multitouch patch, you can boot windows as well as other profiles of NixOS without using a usb keyboard. diff --git a/microsoft/surface-pro/3/default.nix b/microsoft/surface-pro/3/default.nix new file mode 100644 index 0000000..48528f9 --- /dev/null +++ b/microsoft/surface-pro/3/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + # to use the type cover in the initrd + boot.kernelModules = [ "hid-microsoft" ]; + + networking.wireless.enable = true; +} diff --git a/microsoft/surface_pro_3.nix b/microsoft/surface_pro_3.nix deleted file mode 100644 index 48528f9..0000000 --- a/microsoft/surface_pro_3.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - # to use the type cover in the initrd - boot.kernelModules = [ "hid-microsoft" ]; - - networking.wireless.enable = true; -} diff --git a/microsoft/surface_pro_3.wiki b/microsoft/surface_pro_3.wiki deleted file mode 100644 index 9ffdc55..0000000 --- a/microsoft/surface_pro_3.wiki +++ /dev/null @@ -1,41 +0,0 @@ -Work in progress. This is the setup for a dual-boot windows/NixOS. - -== Installation == - -Current requirements: -* USB stick -* Latest unstable minimal installation iso, I used [[https://nixos.org/releases/nixos/unstable/nixos-15.05pre61665.4c01e6d/nixos-minimal-15.05pre61665.4c01e6d-x86_64-linux.iso the 15.06-pre one]] -* (maybe) USB keyboard and therefore a USB hub -* WiFi SSID and password - -In the current installation iso, the kernel doesn't support the MS Type cover yet, so you need a USB keyboard for the initial install. Also note that at one point the keyboard wasn't working, and I couldn't see it in lsusb output. After a cold boot it worked fine. - -=== Steps === - -Preparation: -* Copy the ISO to the USB stick as explained [[https://nixos.org/nixos/manual/sec-installation.html#sec-booting-from-usb in the manual]]. Note that if you just dd the image onto the USB stick, it will boot without changes -* With Windows Disk Management, shrink the windows disk so you have room for your installation. Use the free space to create a new partition without a filesystem or drive letter. -* Check out [[https://github.com/cransom/surface-pro-3-nixos this expression and set of patches]] and add it to support newer versions of the Type Cover as well as enable the touch screen. - -* Reboot the Surface and furiously tap Esc until you end up in the BIOS screen. There, turn off secure boot (don't delete the keys), and change the boot order to USB + SSD. Save. -* You should now be in the NixOS installer -* Attach the USB stick and keyboard if the Type Cover doesn't work. The NixOS manual is at alt+F8 - -Installation: -* Using gdisk, print your partition table to find the empty partition you created. Find the EFI partition number (1 for me) and your new partition number (5 for me). -* Create your filesystem of choice on the partition, I picked btrfs: `mkfs.btrfs -L root /dev/disk/by-id/xxx-5` (xxx is the samsung ssd). Mount it on /mnt. -** With btrfs it's wise to put the nix store in its own subvolume: `btrfs subvol create /mnt/nix; btrfs subvol create /mnt/nix/store` -* We'll be using Gummiboot, which needs to access the EFI partition. `mkdir /mnt/boot; mount /dev/disk/by-id/xxx-1` -* Initialize your hardware configuration: `nixos-generate-config --root /mnt` -* Create your wifi credentials: `wpa_passphrase SSID PASS > /etc/wpa_supplicant.conf; cp /etc/wpa_supplicant.conf /mnt/etc`. Check that ifconfig gets an ip address. -* Edit /mnt/etc/configuration.nix, making sure that you have at least: - networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - boot.kernelPackages = pkgs.linuxPackages_latest; - # be able to use the type cover in the initrd - boot.kernelModules = [ "hid-microsoft" ]; -* Install: `nixos-install` - -If this completes successfully, you should be able to reboot, remove the USB stick, and NixOS should come up. - -'''Note''': If using the hid-multitouch patch, you can boot windows as well as other profiles of NixOS without using a usb keyboard. -- cgit v1.2.3