mirror of
https://github.com/ahoneybun/ahoneybun.net.git
synced 2025-05-12 11:14:01 -06:00
add more nixos post
This commit is contained in:
parent
d86309928c
commit
8d2f6b9189
4 changed files with 157 additions and 2 deletions
76
content/posts/automount-nixos.md
Normal file
76
content/posts/automount-nixos.md
Normal 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
|
||||
```
|
39
content/posts/unstable-nixos.md
Normal file
39
content/posts/unstable-nixos.md
Normal 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.
|
40
content/posts/welcome-to-nixos.md
Normal file
40
content/posts/welcome-to-nixos.md
Normal 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.
|
||||
|
|
@ -4,8 +4,8 @@ date = 2021-08-29
|
|||
draft = false
|
||||
|
||||
[taxonomies]
|
||||
categories = ["welcome"]
|
||||
tags = ["blog"]
|
||||
categories = [ "welcome" ]
|
||||
tags = [ "blog" ]
|
||||
+++
|
||||
|
||||
## What will be here
|
Loading…
Add table
Add a link
Reference in a new issue