Ajour des drafts

This commit is contained in:
Quentin 2021-10-28 13:55:50 +02:00
parent 1f0e302cb5
commit ffd1358f1f
2 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,22 @@
Marque de la laque: 3DLAC.
```gcode
G21 ;metric values
M82 ;set extruder to absolute mode
M107 ;start with the fan off
M280 P0 S160; BL-Touch Alarm realease
G4 P100; Delay for BL-Touch
G28; home
M280 P0 S160 ; BLTouch alarm release
G4 P100 ; delay for BLTouch
G29; Auto leveling
M420 Z5 ; LEVELING_FADE_HEIGHT Real activation and set parameters (if not set here, Z-Compensation failed)
M500; Write data carto G29
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F4200
M117 Printing...
```

151
_drafts/nix.md Normal file
View file

@ -0,0 +1,151 @@
## Boot a VM
Check launch.sh
## Create basic partitioning
```bash
sudo parted /dev/sda -- mklabel gpt
# uefi part
sudo parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
sudo parted /dev/sda -- set 1 esp on
sudo mkfs.fat -F 32 -n boot /dev/sda1
# encrypted part
sudo parted /dev/sda -- mkpart cryptroot 512MiB 100%
```
Setup the crypted boot:
```bash
sudo cryptsetup luksFormat /dev/sda2 # need to set the password
sudo cryptsetup open /dev/sda2 cryptlvm
sudo pvcreate /dev/mapper/cryptlvm
sudo vgcreate EncryptedOS /dev/mapper/cryptlvm
sudo lvcreate -L 8G EncryptedOS -n swap
sudo lvcreate -l 100%FREE EncryptedOS -n root
mkfs.ext4 -L nixos /dev/MyVolGroup/root
mkswap -L cryptswap /dev/MyVolGroup/swap
```
## Mount our stuff!
```
sudo swapon -L cryptswap
sudo mount /dev/disk/by-label/nixos /mnt
sudo mkdir /mnt/boot
sudo mount /dev/disk/by-label/boot /mnt/boot
```
## Generate the configuration
```bash
nixos-generate-config --root /mnt
```
And then we need to update `/mnt/etc/nix/configuration.nix` to add luks to the initrd:
```
{
# snip...
boot.initrd.luks.devices."cryptlvm".device = "/dev/disk/by-partlabel/cryptroot";
# snip...
}
```
*Another tutorial updates the hardware-configuration.nix but it seems to be a bad practise as the file may be overwritten in the future by some Nix tools*
*Do not forget to put "s" at the end when required, do not forget the semi colon at the end of the expression*.
When ready, run:
```bash
sudo nixos-install
```
The tool assumes that you mounted your future system on `/mnt`.
Type the password you want for your root user, wait that the program returns and poweroff:
```bash
sudo poweroff
```
## Booting on a fresh NixOS
*Show how we changed the command line*
Start your VM, first type your cryptsetup password.
Then login with the root account (you just created the password with `nixos-install`).
If you made a change to your configuration.nix, you can apply it with:
```
nixos-rebuild switch
```
You can update your system by running:
```bash
nix-channel --update nixos
nixos-rebuild switch
```
## Setting up my users
I chose to go for the declarative way.
I first set:
```
users.mutableUsers = false;
```
Then I create my user:
```
users.users.quentin = {
isNormalUser = true;
home = "/home/quentin";
description = "Quentin Dufour";
extraGroups = [ "wheel" "networkmanager" ];
hashedPassword = ""; # compute with mkpasswd -m sha-512
}
```
## Setting up my DE
I chose Sway which is an i3 clone for Wayland.
```
programs.sway.enable = true;
```
It is covered here: https://nixos.org/manual/nixos/stable/index.html#sec-wayland
I also added some programs:
```
wget
vim
nyxt
alacritty
```
## Sources
Comment configurer une machine UEFI :
- https://papy-tux.legtux.org/doc1310/index.html
Comment installer simplement :
- https://nixos.org/manual/nixos/stable/#sec-installation
Comment chiffrer :
- https://ramblings.henryjenkins.name/posts/going-from-zero-to-nixos/