To use QMK, I just clone my fork:
# Initialize repo
cd
git clone [email protected]:LilleAila/qmk_firmware
cd qmk_firmware
direnv allow
# git submodule init # below does this for you
qmk setup
# Set up remotes
git remote add upstream https://github.com/qmk/qmk_firmware.git
# Rebase from upstream
git fetch upstream
git checkout master
git merge upstream/master
git push origin master
# Compile keymap
qmk compile -kb beekeeb/piantor_pro -km default
# Alternatively, flash directly
qmk flash -kb beekeeb/piantor_pro -km default
Factorio is currently downloaded manually as an executable from factorio.com and run directly from an fhsenv. Now that I have “inline” secrets set up, maybe I can switch to downloading it from nixpkgs (this will also mean that i have to edit syncthing to reflect the new config directory path)
- Some screenshots of the configuration
- File structure
- Secrets: setting up the keys before building, and the syntax of secrets files (private repo, gpg key etc.)
Place them in the correct location using the path value, and set the owner as the correct user. https://discourse.nixos.org/t/gpg-ssh-key-pairs-management/28604/4
I am currently using sops-nix in combination with a private nix flake hosted on GitHub. This works, but I should maybe look into setting up GPG to encrypt some files using git-crypt, and also signing git commits. Also see this
The flake.nix
uses some nix expressions, which means that it can not be evaluated normally. To fix this, I used flakegen. This means that I have to edit flake.in.nix
instead of flake.nix
, and run nix run .#genflake flake.nix
(aliased to update-inputs
) after changing something. Omitting the flake.nix
argument will preview the file without writing it.
When initializing flakegen
, i did:
mv flake.nix flake.in.nix
cp flake.lock flake.lock.old
nix flake init -t github:jorsn/flakegen
nix run .#genflake flake.nix
rm flake.lock
mv flake.lock.old flake.lock
nix run .#genflake flake.nix
Docs: lenovo.com
- Enter BIOS settings: F2
- Boot menu: F12
nix repl
:l <nixpkgs>
:? # get help
:e lib.mkEnableOption # see source
:q # quit
A new project can be created using one of the available templates (completion with tab). Example with rust:
mkdir new-project
cd new-project
nix flake init --template templates#rust
cargo init .
git add -A && git commit -m "Initial commit"
nvim flake.nix # Add rust-analyzer and start coding
I have also created a few of my own templates, located at https://github.com/LilleAila/flake-templates
Generate a new key:
ssh-keygen -t ed25519 -C "[email protected] note"
SSH-ing into a server can often result in errors because kitty terminfo files are unavailable. To fix this, run kitten ssh
instead of ssh
.
This config needs SOPS
to work! If it is not configured properly, the user will not have a password!
# Generate age key:
nix shell nixpkgs#age -c age-keygen -o ~/.config/sops/age/keys.txt # Random
## From SSH key: (I used the SSH key from `m1pro14`)
nix run nixpkgs#ssh-to-age -- -private-key -i ~/.ssh/id_ed25519 > ~/.config/sops/age/keys.txt
# Get the public key:
nix shell nixpkgs#age -c age-keygen -y ~/.config/sops/age/keys.txt
The private key file should be at ~/.config/sops/age/keys.txt
.
Some programe may need a writable file for some reasom. This is probably one of the worst ways of doing it with a lot of downsides:
Changes to the file are ignored when rebuilding
home.file."test_hm.txt" = {
text = ''
abd
def
ghi
jkl
1234567890
'';
onChange = ''
rm -f $HOME/test.txt
cp $HOME/test_hm.txt $HOME/test.txt
chmod u+w $HOME/test.txt
'';
};
When edited, changes are reflected in the source flake.
home.activation.symlinkCustomFiles = lib.hm.dag.entryAfter ["writeBoundary"] ''
run rm -f $HOME/testFile.txt && ln -s $HOME/dotfiles/home/testFile.txt $HOME/testFile.txt
'';
(pls don’t actually use this)
- Enable virtualisation stuff in nixOS
- Use
lspci -nnk
to find ids of hardware to pass through - Make the virtual machine
- Configure the VM before installation (CPU to
host-passthrough
and useEFI
) - Follow the steps described in the looking glass install guide.
- First, install the host and other tools in windows with the default VM config
- Set video type to
none
and pass through the GPU, a mouse and a keyboard with “add hardware” - After booting the VM, plug in a second monitor to install the GPU drivers (it might be possible to do this before removing video drivers, so that an external monitor is not needed)
- Follow the remaining configuration steps from looking glass. Remember to keep spice enabled, but with video type as
none
! - Set up a virtual display so that it works without a monitor plugged in (also possible to do earlier)
- For me, windows only detected a single one of the 6 cpu cores passed through. The solution was to check “Manually set CPU topology”, with 1 socket, 6 cores and 2 threads
- The threads refer to threads per core, and according to
lscpu
my cpu has 2 threads per core.
- The threads refer to threads per core, and according to
- Use the ctt windows utility to install other stuff
- Open administrator command prompt
iwr -useb https://christitus.com/win | iex
- Do these things (TODO for next vm, virtio drive or passthrough external drive)
- Configure the VM before installation (CPU to
- https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF
- https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/
- https://alexbakker.me/post/nixos-pci-passthrough-qemu-vfio.html
- https://github.com/bryansteiner/gpu-passthrough-tutorial
- https://looking-glass.io/docs/B6/install/
- https://www.reddit.com/r/ChromeOSFlex/comments/ucno4b/qemukvm_virtmanager_windows_vm_very_slow/