Skip to content

FAQ

General Tips and Best Practices

1. Always Test in a VM First

Before applying changes to your production system, test in a safe environment:

1
2
3
4
5
# Build the configuration first to check for errors
nix build .#systemConfigs.default

# For actual VM testing, use a tool like NixOS's VM builder
# or test in a container/virtualized environment

2. Use Flake Inputs Follows

This ensures consistent nixpkgs versions:

1
2
3
4
5
6
7
inputs = {
  nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  system-manager = {
    url = "github:numtide/system-manager";
    inputs.nixpkgs.follows = "nixpkgs";  # Use the same nixpkgs
  };
};

By default, each flake input pins its own version of its dependencies, which means you could end up with multiple versions of nixpkgs. The follows directive tells Nix to use your nixpkgs instead of the one bundled with System Manager, ensuring consistent package versions across your entire configuration while reducing disk usage and evaluation time.

3. Modular Configuration

Split your configuration into multiple files:

1
2
3
4
5
6
7
.
├── flake.nix
└── modules
    ├── default.nix
    ├── services.nix
    ├── packages.nix
    └── users.nix

4. Check Logs

Always check systemd logs after activation:

sudo journalctl -u system-manager.target
sudo journalctl -xe

5. Garbage Collection

Regularly clean up old generations:

1
2
3
4
5
# Remove old system-manager profiles
sudo nix-env --profile /nix/var/nix/profiles/system-manager-profiles --delete-generations old

# Run garbage collection
sudo nix-collect-garbage -d

6. Rollback

If something goes wrong, you can rollback:

1
2
3
4
5
6
7
8
# List generations
sudo nix-env --profile /nix/var/nix/profiles/system-manager-profiles --list-generations

# Rollback to previous generation
sudo nix-env --profile /nix/var/nix/profiles/system-manager-profiles --rollback

# Activate the previous generation
nix run 'github:numtide/system-manager' -- activate --sudo

Troubleshooting

Service Won't Start

1
2
3
4
5
6
7
8
# Check service status
sudo systemctl status <service-name>

# View detailed logs
sudo journalctl -u <service-name> -n 50

# Check if service file exists
ls -la /etc/systemd/system/<service-name>.service

Package Not Found in PATH

If you just installed System Manager, and installed a package through it, try logging out and logging back in to pick up the PATH.

1
2
3
4
5
6
7
8
# Check if package is in the profile
ls -la /nix/var/nix/profiles/system-manager-profiles/*/bin/

# Verify the package is in your config
cat /etc/installed-packages.txt

# Check $PATH
echo $PATH

Permission Denied

Ensure you're running System Manager with sudo:

nix run 'github:numtide/system-manager' -- switch --flake . --sudo

Configuration Won't Build

1
2
3
4
5
6
7
8
# Check for syntax errors
nix flake check

# Build without activation
nix build .#systemConfigs.default

# View build logs
nix log /nix/store/<hash>

Additional Resources