Merge pull request #2 from ahoneybun/port-posts

Port posts
This commit is contained in:
Aaron Honeycutt 2024-11-23 09:29:23 -07:00 committed by GitHub
commit f27a7e6e35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 355 additions and 2 deletions

View file

@ -0,0 +1,76 @@
+++
title = "Automounting a drive in NixOS"
date = 2022-09-02
draft = false
[taxonomies]
categories = [ "nixos" ]
tags = [ "nixos", "nixos-22.05", "nixos-22.11", "tips-&-tricks" ]
+++
After you create the mount point then we'll add that drive to our `/etc/nixos/configuration.nix':
```
fileSystems."/mnt/ExtraDrive" =
{ device = "/dev/disk/by-uuid/72315f9e-ceda-4152-8e8d-09590affba28";
fsType = "ext4";
};
```
> *NOTE:* You can find the UUID by using the `blkid` command, you will need to use `sudo` or change to the root user.
```
sudo blkid
```
or
```
sudo -i
blkid
```
then rebuild NixOS:
```
sudo nixos-rebuild switch
```
You'll see the following if done correctly:
```
unpacking channels...
building Nix...
building the system configuration...
these 3 derivations will be built:
/nix/store/3ryw7m6gvim8zs593wkibcg143pix7zd-etc-fstab.drv
/nix/store/va8nfw2j4i5jviibqy5cggnmjsjmds2v-etc.drv
/nix/store/hpm2aykvls876qgjrkva2ys3xmn08sri-nixos-system-rpi4-22.11pre405560.2da64a81275.drv
building '/nix/store/3ryw7m6gvim8zs593wkibcg143pix7zd-etc-fstab.drv'...
building '/nix/store/va8nfw2j4i5jviibqy5cggnmjsjmds2v-etc.drv'...
building '/nix/store/hpm2aykvls876qgjrkva2ys3xmn08sri-nixos-system-rpi4-22.11pre405560.2da64a81275.drv'...
stopping the following units: mnt-ExtraDrive.mount
activating the configuration...
setting up /etc...
reloading user units for gdm...
reloading user units for aaronh...
setting up tmpfiles
starting the following units: mnt-ExtraDrive.mount
the following new units were started: systemd-fsck@dev-sda1.service
```
Now we'll see it when we reboot:
```
[aaronh@rpi4:~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 232.9G 0 disk
└─sda1 8:1 0 232.9G 0 part /mnt/ExtraDrive
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 30M 0 part
└─mmcblk0p2 179:2 0 29.7G 0 part /nix/store
/
[aaronh@rpi4:~]$ ls /mnt/ExtraDrive/
Backups lost+found test
```

View file

@ -0,0 +1,79 @@
+++
title = "Hosting on NixOS"
date = 2023-06-06
draft = false
[taxonomies]
categories = [ "nixos" ]
tags = [ "nixos", "nixos-22.11", "nixos-server" ]
+++
description: Running NixOS on Linode VPS for services like Jekyll, Mastodon and Nextcloud.
## Installing on Linode
I've been using Linode for a while and I used this [article](https://www.linode.com/docs/guides/install-nixos-on-linode/) to install NixOS on a Linode. Now I was using one large server (2GB plan) to host everything but I thought that splitting them up would be better so I just cloned my server onto another Linode using their great webUI!
## Two is better than one
Now that I have two servers I needed names for them, I've never been good with hostnames but I'm not using Mass Effect (Andromeda) characters for my systems. Mass Effect characters are for x86_64 systems and Andromeda characters for ARM64 devices. The two servers themselves are names after Reapers so sovereign and harbinger!
### Hydra
The hardest part of starting for me was understanding DNS and HTTPS setup, this included using Nginx to reverse proxy a locally running service like [Hydra](https://github.com/NixOS/hydra). I was able to get this working with this [configuration](https://gitlab.com/ahoneybun/nix-configs/-/blob/main/dev/hydra-ahoneybun-net.nix) this allows it to be viewed from https://hydra.ahoneybun.net (it is currently off as I was just testing).
When I first tried setting Hydra up I was using the default settings for using a Nginx reverse proxy but it was not loading CSS and JavaScript, after hours of going though GitHub and Reddit I found this option which was the key:
```nix
recommendedProxySettings = true;
```
Once that was added and I rebuilt `nixos-rebuild` everything worked as it should have!
### Jekyll
For a long time this site has been on GitHub pages but I wanted to change that (partly as I was having issues with how GitHub handles DNS) and this is the first blog post since that happened and now you're on a site hosted on NixOS! Getting Jekyll to build with my [site](https://github.com/ahoneybun/ahoneybun.net) took a while but these commands was able to build with my plugins:
```bash
cd ahoneybun.net
nix-shell -p jekyll rubyPackages.webrick rubyPackages.jekyll-feed rubyPackages.jekyll-redirect-from
jekyll build
```
I created a nix-shell file (in the repository) so that I can run these commands (from the root directory) to update the site once I make a change on GitHub:
```bash
git pull
nix-shell
jekyll build
```
### Mastodon
Setting up Mastodon on NixOS was just using this [wiki](https://nixos.wiki/wiki/Mastodon) page and then rebuild. One issue with my configuration is that I don't have SMTP working so confirmation emails are not sent out. To workaround this I can confirm the account using `tootctl` on the server itself like this:
```bash
# Switch to root
sudo su
# Switch to mastodon account
su - mastodon -s $(which bash)
## Approve accounts though tootctl
mastodon-env tootctl accounts approve PUT-YOUR-USERNAME-HERE
## Accept email address though tootctl
mastodon-env tootctl accounts modify PUT-YOUR-USERNAME-HERE --confirm
```
[Mastodon server](https://stoners.space/about)
[Source](https://page.romeov.me/posts/setting-up-mastodon-with-nixos/#adding-your-user)
### Nextcloud
I'm still working on getting this to not use SQLite which is the default and have better security plus other fixes but it is working [here](https://cloud.ahoneybun.net) and here is the [nix file](https://gitlab.com/ahoneybun/nix-configs/-/blob/main/web/cloud-ahoneybun-net.nix).
## Nix Files
You can find all of my nix files [here](https://gitlab.com/ahoneybun/nix-configs).

View file

@ -0,0 +1,58 @@
+++
title = "Flashing different OSes on your PinePhone"
date = 2022-01-11
draft = false
[taxonomies]
categories = [ "pinephone" ]
tags = [ "mobile-linux", "tips-&-tricks" ]
+++
> *NOTE:* This was done on a PinePhone 3GB model but the steps should apply to the 2G as well.
## Terms
- [JumpDrive](https://github.com/dreemurrs-embedded/Jumpdrive)
JumpDrive is software used to boot the PinePhone so that the onboard eMMC can be written to for replacing the currently installed OS.
- [eMMC](https://en.wikipedia.org/wiki/MultiMediaCard#eMMC)
This is the onboard storage used for most Smartphones and Tablets (like the PinePhone and the PineTab)
- [MMC (microSD/SD)](https://en.wikipedia.org/wiki/SD_card)
This is a storage device used to store data and in this case an OS.
> *NOTE:* eMMC storage will be noticeably faster when compared to a microSD card.
### Needed Items
- PinePhone
- 1x 4GB microSD card to be the JumpDrive
- 1x 32GB or larger microSD card for the OS
The 3rd item is useful for trying different OSes as you just need to write the OS, swap out the card then power on the PinePhone. If you want to try more then two OSes (the one on the microSD card and on the eMMC) at a time.
#### Creating the JumpDrive
1. Connect the microSD card to your system.
2. Download the latest release of JumpDrive for the PinePhone (it will be labeled pine64-pinephone.img.xz) from their [releases page](https://github.com/dreemurrs-embedded/Jumpdrive/releases).
3. Open the Disks application then left-click the microSD card from the left side list
4. Left-click on the three dot menu in the top right of the Disks application
5. Left-click the "Restore Disk Image..." option from that menu
6. Left-click the pine64-pinephone.img.xz image from your Downloads folder
7. Contine though the prompts and let the process complete
#### Booting from the JumpDrive
1. Plug the microSD card into the PinePhone's microSD card slot
2. Power on the PinePhone (connecting the power cable should do this as well if you don't want to put the device together)
#### Flashing the eMMC
1. Connect the PinePhone to your system
2. Once booted to the JumpDrive you should see the PinePhone's eMMC in the Disks application.
3. Follow the same steps from creating the JumpDrive but instead of selecting the microSD card left-click the eMMC and use the pinephone.img.xz file of the OS that you want to install.
This [page](https://wiki.pine64.org/wiki/PinePhone_Software_Releases) is a common place to find PinePhone OSes. For example if I wanted Arch with Phosh for the original PinePhone I would download the "archlinux-pinephone-phosh-20211212.img.xz" image from this [page](https://github.com/dreemurrs-embedded/Pine64-Arch/releases).

View file

@ -0,0 +1,61 @@
+++
title = "systemd-boot and efibootmgr"
date = 2022-04-15
draft = false
[taxonomies]
categories = [ "tutorials" ]
tags = [ "tips-&-tricks" ]
+++
## systemd-boot
Systemd-boot started with just support for UEFI which means the code base is much smaller when compared to GRUB which has a ton of code to work with different types of drives that have been released in the last decade. Pop!_OS has been using it since the 18.04 LTS release and I have been using it as my go to boot manager ever since.
## efibootmgr
This command allows us to edit the EFI variables though EFISTUB, the [Arch Wiki](https://wiki.archlinux.org/title/EFISTUB#Using_UEFI_directly) has a really good selection about using `efibootmgr`. Here is my output as an example since I will be using the output in the next section:
```
BootNext: 0001
BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,000A,0002,0006,0000
Boot0000* UiApp
Boot0001* Pop!_OS 22.04 LTS
Boot0002* WDC WDS120G2G0B-00EPW0
Boot0006* WDC WDS100T2B0C-00PXH0
Boot000A* Linux Boot Manager
```
Now you may not have the "BootNext:" option if you haven't used `efibootmgr` before.
## Desktop files
You can make your own desktop file and for system-wide you would put them in `/usr/share/applications/` but if you want them just for your user you can use `~/.local/share/applications/`. We can make .desktop files for these boot entries to set them as the next boot target but once you reboot again it reverts to using "BootOrder" order instead.
This is my file for booting Arch on the next reboot:
```
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=sh -c "pkexec efibootmgr -n 000A"
Name=Boot to Arch
Icon=/home/aaronh/Documents/archlinux-icon.svg
```
and this is my file for booting Pop!_OS on the next boot:
```
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=sh -c "pkexec efibootmgr -n 0001"
Name=Boot to Pop!_OS
Icon=/home/aaronh/Documents/pop_icon.svg
```

View file

@ -0,0 +1,39 @@
+++
title = "Unstable software in NixOS"
date = 2022-06-18
draft = false
[taxonomies]
categories = [ "nixos" ]
tags = [ "nixos", "nixos-22.05" ]
+++
## Installing newer software
Recently I ran into this [bug](https://github.com/NixOS/nixpkgs/issues/175512) with the stable (22.05 at this writing) of the ProtonVPN software in NixOS. A way to work around it was use the unstable version of the software which had the fix. I did a bit of Googling to find how to do that so I wanted to share what I found, this is the file that I use:
{ config, pkgs, ...}:
let
unstable = import
(builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/master)
# reuse the current configuration
{ config = config.nixpkgs.config; };
in
{
environment.systemPackages = with pkgs; [
unstable.protonvpn-cli
unstable.protonvpn-gui
];
}
Now I made this in a file like this `/etc/nixos/unstable-programs.nix` and then edit my `/etc/nixos/configuration.nix` file to import it like this:
[
./hardware-configuration.nix
./plasma.nix
./programs.nix
./unstable-programs.nix
];
That way I can comment it out once the fix is released or if I want to remove it for some reason. Once I made these edits to those two files I would rebuild and switch with this command `sudo nixos-rebuild switch` now if you want to test it just for the next reboot in case you are worried you can run this command instead `sudo nixos-rebuild test`. Now when you reboot it boots into that generation but if it doesn't work just reboot and you'll be in the previous generation without the change.

View file

@ -0,0 +1,40 @@
+++
title = "Welcome to NixOS"
date = 2022-05-22
draft = false
[taxonomies]
categories = [ "nixos" ]
tags = [ "nixos", "nixos-22.05" ]
+++
## Automate the OS
With NixOS you can setup your OS using the "configuration.nix" file which is in "/etc/nixos" and mine enables the following:
- Xorg
- OpenSSH
- PipeWire
- Bluetooth
- CUPS
- fwupd
- Flatpak
This installs my desktop, default applications and other tools that I need. I'm still working on it but this gets me up and running out of the box. You can see the full file [here](https://gitlab.com/ahoneybun/nyxi-installer/-/blob/main/config.nix).
## Rollback the OS
One of the cool features that I have loved the idea of before I found out about NixOS is rolling back an update. We have similar features in [Fedora Silverblue](https://docs.fedoraproject.org/en-US/fedora-silverblue/updates-upgrades-rollbacks/) and how NixOS does it is similar at least from the users POV, every time that you run `nixos-rebuild switch` you create a new generation though you would have to have changed your "configuration.nix" file before running the command. You can read more about Generations [here](https://nixos.wiki/wiki/NixOS#Generations).
## Spliting the user-wide and system-wide
Another cool feature is allowing the user and system to have different applications/versions, of the benefits of this is the following:
- The user can have Inkscape 1.1.2 (unstable) while the system would have version 1.1.1 (stable) (this is based on version 21.11)
- The system can have Python 3.9 while the user who needs a newer version can have Python 3.10
### The Nyxi Installer
I created this installer based on my Arch-itect installer which you can find [here](https://gitlab.com/ahoneybun/arch-itect) and expended based on a co-workers request of using an encrypted LVM which includes a BTRFS root fs and swap. This installer creates the swap partition based on the amount of RAM for hibernation and it is fairly safe since the swap is in an encrypted LVM.

View file

@ -4,8 +4,8 @@ date = 2021-08-29
draft = false
[taxonomies]
categories = ["welcome"]
tags = ["blog"]
categories = [ "welcome" ]
tags = [ "blog" ]
+++
## What will be here