Using Nix with Fedora's Immutable Distros
Updated: April 12, 2025 · 4 min
Disclaimer: This is my personal setup. It works well for me, but you might want to just use NixOS.
Installing Nix and Home Manager
I’ve come up with a script for installing Nix using the Determinate Installer. I love using this because It Just WorksTM for Linux and MacOS.
1#!/bin/sh
2echo "Installing Nix..."
3curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
4. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
5
6echo "Updating Nix Channels..."
7nix-channel --add https://nixos.org/channels/nixpkgs-unstable
8nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
9nix-channel --update
10
11echo "Installing Home Manager..."
12nix-shell '<home-manager>' -A install
13home-manager switch
This script:
- Installs nix
- Adds the unstable channel
- Adds the Home Manager channel
- Updates all our channels
- Installs home-manager
- Activates home-manager
If you’re not familiar with Home Manager, you’ll want to follow the official guide.
Multiple Machines
I use my nix config on my personal desktop, personal laptop, and my work laptop, but each one requires a slightly different config. To get around this, I have a single common.nix
file then an individual nix file for each machine.
1❯ ll .config/home-manager/
2total 24K
3-rw-r--r--. 1 godmaire godmaire 133 Apr 4 15:20 artemis.nix
4-rw-r--r--. 1 godmaire godmaire 1.1K Apr 6 08:42 charles.nix
5-rw-r--r--. 1 godmaire godmaire 2.6K Jun 15 10:37 common.nix
6-rw-r--r--. 1 godmaire godmaire 5.0K May 14 18:04 diana.nix
If we take a peek inside artemix.nix
, we can see how it imports common.nix
and which settings it needs.
1{ config, lib, pkgs, ... }:
2
3{
4 imports = [ ./common.nix ];
5
6 home.username = "godmaire";
7 home.homeDirectory = "/var/home/godmaire";
8}
To actually use this config on Artemis, we can symlink it to home.nix
.
1❯ ll .config/home-manager/home.nix
2lrwxrwxrwx. 1 godmaire godmaire 9 Apr 4 15:19 .config/home-manager/home.nix -> artemis.nix
The only things we need to set in artemis.nix
or any other machine specific file are the home.username
and home.homeDirectory
. Everything else is in common.nix
. For my work machine, which runs MacOS, I have a few other customizations.
1{ config, lib, pkgs, ... }:
2
3{
4 imports = [ ./common.nix ];
5
6 home.username = "rgodmaire";
7 home.homeDirectory = "/Users/rgodmaire";
8
9 # Overrides
10 programs.emacs.package = lib.mkForce pkgs.emacs-macport;
11
12 home.packages = with pkgs; [
13 go
14 gopls
15 delve
16 gotests
17 gotools
18
19 python3
20 pyright
21 ruff
22
23 shellcheck
24 ];
25
26 programs.alacritty = {
27 enable = true;
28 settings = {
29 font = {
30 normal.family = "Hack Nerd Font Mono";
31 size = 12.0;
32 };
33
34 colors = {
35 primary = {
36 background = "#282828";
37 foreground = "#ebdbb2";
38 };
39
40 normal = {
41 black = "#282828";
42 red = "#cc241d";
43 green = "#98971a";
44 yellow = "#d79921";
45 blue = "#458588";
46 magenta = "#b16286";
47 cyan = "#689d6a";
48 white = "#ebdbb2";
49 };
50 };
51 };
52 };
53
54}
The interesting things here are the additional packages, alacritty, and the different package for emacs. We use lib.mkForce
to overwrite the existing setting in common.nix
. Everything else, such as home.packages
merges with common.nix
.
Why Not Use NixOS?
I started using Feodra Silverblue before I started using Nix. By the time I started entertaining the idea of using NixOS, I already had this setup. Either way, I’d need to have most of this in place due to me being forced to use a Macbook for work (Linux was banned 😢).
I now use NixOS full time. Drink the koolaid.