-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Applications
Complete guide to adding, removing, and managing applications in NullOS.
NullOS manages applications through two main systems:
- NixOS (System-level) - Applications available to all users
- Home Manager (User-level) - User-specific applications and configs
Key Difference:
- System packages = Installed globally, requires sudo to rebuild
- Home packages = User-specific, no sudo needed
File: modules/software/packages.nix
Rebuild: sudo nixos-rebuild switch --flake .#hostname
File: home/default.nix
Rebuild: home-manager switch --flake .
Search for packages on https://search.nixos.org/packages
Or use command line:
nix search nixpkgs htop
nix search nixpkgs firefoxOpen modules/software/packages.nix:
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# Existing packages...
vim
git
wget
# Add your new package here
htop
btop
neofetch
];
}sudo nixos-rebuild switch --flake .#yourhostnameenvironment.systemPackages = with pkgs; [
# Development
gcc
cmake
gnumake
python3
nodejs
rustup
# Databases
postgresql
redis
# Tools
docker-compose
kubectl
];Open home/default.nix:
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
# Existing packages...
firefox
discord
# Add your packages
spotify
obs-studio
gimp
vlc
];
}home-manager switch --flake .Or rebuild entire system (includes home-manager):
sudo nixos-rebuild switch --flake .#yourhostnamehome.packages = with pkgs; [
# Image Editing
gimp
inkscape
krita
# Video Editing
kdenlive
obs-studio
# Audio
audacity
lmms
# 3D
blender
];Edit modules/software/packages.nix and delete the line:
environment.systemPackages = with pkgs; [
vim
git
# htop # Removed
];Rebuild:
sudo nixos-rebuild switch --flake .#yourhostnameEdit home/default.nix and delete the line:
home.packages = with pkgs; [
firefox
# discord # Removed
];Rebuild:
home-manager switch --flake .Some applications have dedicated program modules with additional configuration.
Instead of just adding to packages, use program configuration:
# In home/default.nix or dedicated file
programs.firefox = {
enable = true;
profiles.default = {
settings = {
"browser.startup.homepage" = "https://nixos.org";
"privacy.trackingprotection.enabled" = true;
};
};
};
programs.git = {
enable = true;
userName = "Your Name";
userEmail = "you@example.com";
extraConfig = {
init.defaultBranch = "main";
};
};
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
jnoortheen.nix-ide
github.copilot
];
};Benefits:
- Declarative configuration
- Version control your settings
- Easy to replicate on new machines
Most packages from nixpkgs:
home.packages = with pkgs; [
firefox
vlc
htop
];Use stable channel for older, tested versions:
home.packages = [
pkgs.stable.firefox # From nixos-25.05
];NullOS already enables unfree packages. If you need to verify:
# In flake.nix (already configured)
config.allowUnfree = true;Examples of unfree packages:
vscodediscordspotifysteamnvidia-x11
# In flake.nix inputs
inputs.my-app.url = "github:username/my-app";
# In configuration module
environment.systemPackages = [
inputs.my-app.packages.${pkgs.system}.default
];home.packages = [
(pkgs.fetchFromGitHub {
owner = "username";
repo = "repo";
rev = "commit-hash";
sha256 = "sha256-hash";
})
];
### Build from Source
Create a custom derivation:
```nix
# packages/my-app.nix
{ pkgs }:
pkgs.stdenv.mkDerivation {
pname = "my-app";
version = "1.0.0";
src = pkgs.fetchurl {
url = "https://example.com/my-app.tar.gz";
sha256 = "...";
};
buildInputs = [ pkgs.gcc ];
installPhase = ''
mkdir -p $out/bin
cp my-app $out/bin/
'';
}Import and use:
home.packages = [
(pkgs.callPackage ./packages/my-app.nix {})
];For a curated list of recommended applications by category, please refer to:
- Home Applications - For user-level applications (browsers, media, dev tools)
- System Applications - For system-level tools (CLI utilities, monitoring, virtualization)
NullOS includes Flatpak support.
# Search
flatpak search spotify
# Install
flatpak install flathub com.spotify.Client
# Run
flatpak run com.spotify.ClientEdit modules/software/flatpak.nix:
services.flatpak.enable = true;
# Then manually install or use home-manager's nix-flatpakWith nix-flatpak (requires adding as input):
services.flatpak.packages = [
"com.spotify.Client"
"com.discordapp.Discord"
];home.packages = [ pkgs.appimage-run ];Run AppImages:
appimage-run MyApp.AppImagechmod +x MyApp.AppImage
./MyApp.AppImageUse specific nixpkgs commit:
# In flake inputs
inputs.nixpkgs-old.url = "github:nixos/nixpkgs/commit-hash";
# Use old version
home.packages = [
inputs.nixpkgs-old.legacyPackages.${pkgs.system}.oldpackage
];Create custom package versions:
# In flake.nix overlays
overlays = [
(final: prev: {
myapp = prev.myapp.overrideAttrs (old: {
version = "2.0.0";
src = prev.fetchurl {
url = "https://example.com/myapp-2.0.0.tar.gz";
sha256 = "...";
};
});
})
];For better organization, create separate files:
home/
├── firefox.nix
├── vscode.nix
├── discord.nix
└── default.nix
Example: home/firefox.nix
{ config, pkgs, ... }:
{
programs.firefox = {
enable = true;
profiles.default = {
bookmarks = [
{
name = "NixOS";
url = "https://nixos.org";
}
];
settings = {
"browser.startup.homepage" = "about:blank";
"privacy.trackingprotection.enabled" = true;
};
};
};
}Import in home/default.nix:
imports = [
./firefox.nix
./vscode.nix
];Applications are automatically available in Rofi after installation.
Applications with .desktop files appear automatically.
For apps without desktop entries:
# In home/default.nix
xdg.desktopEntries.myapp = {
name = "My Application";
genericName = "App";
exec = "myapp";
terminal = false;
categories = [ "Application" ];
};- Search with correct name:
nix search nixpkgs package-name-
Check spelling and availability
-
May be unfree - ensure
allowUnfree = true
- Check if installed:
which application-name- Run from terminal to see errors:
application-name- Check logs:
journalctl --user -eUse overlays to override conflicting versions:
nixpkgs.overlays = [
(final: prev: {
package = prev.package.override {
dependency = prev.dependency_v1;
};
})
];Some packages need additional dependencies:
environment.systemPackages = with pkgs; [
myapp
# Required dependencies
lib1
lib2
];- Organize by Category - Group related packages
- Comment Your Additions - Note why you installed something
- Use Program Modules - When available, for better config
- Separate User/System - System packages for all users, home for personal
- Test Before Committing - Build first, then commit to git
- Remove Unused - Keep your package list clean
For complex applications, create a module:
# modules/software/my-app.nix
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.myapp;
in
{
options.programs.myapp = {
enable = mkEnableOption "My Application";
package = mkOption {
type = types.package;
default = pkgs.myapp;
description = "Package to use";
};
settings = mkOption {
type = types.attrs;
default = {};
description = "Application settings";
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.etc."myapp/config.json".text =
builtins.toJSON cfg.settings;
};
}Import in modules/software/default.nix:
imports = [
./my-app.nix
];Use in configuration:
programs.myapp = {
enable = true;
settings = {
theme = "dark";
};
};# Update flake inputs
nix flake update
# Rebuild
sudo nixos-rebuild switch --flake .#hostnamenix flake lock --update-input nixpkgsnix flake metadata- Customization Guide - Customize application configs
- Home Manager - Deep dive into home-manager
- Package Management - Advanced package management
- Troubleshooting - Solve common issues