Skip to content

Adding Applications

NullString1 edited this page Jan 13, 2026 · 2 revisions

Adding Applications

Complete guide to adding, removing, and managing applications in NullOS.

Overview

NullOS manages applications through two main systems:

  1. NixOS (System-level) - Applications available to all users
  2. 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

Quick Reference

System Applications

File: modules/software/packages.nix
Rebuild: sudo nixos-rebuild switch --flake .#hostname

Home Manager Applications

File: home/default.nix
Rebuild: home-manager switch --flake .


Adding System Applications

Step 1: Find the Package

Search for packages on https://search.nixos.org/packages

Or use command line:

nix search nixpkgs htop
nix search nixpkgs firefox

Step 2: Edit packages.nix

Open modules/software/packages.nix:

{ config, pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    # Existing packages...
    vim
    git
    wget
    
    # Add your new package here
    htop
    btop
    neofetch
  ];
}

Step 3: Rebuild

sudo nixos-rebuild switch --flake .#yourhostname

Example: Adding Development Tools

environment.systemPackages = with pkgs; [
  # Development
  gcc
  cmake
  gnumake
  python3
  nodejs
  rustup
  
  # Databases
  postgresql
  redis
  
  # Tools
  docker-compose
  kubectl
];

Adding Home Manager Applications

Step 1: Edit home/default.nix

Open home/default.nix:

{ config, pkgs, ... }:

{
  home.packages = with pkgs; [
    # Existing packages...
    firefox
    discord
    
    # Add your packages
    spotify
    obs-studio
    gimp
    vlc
  ];
}

Step 2: Rebuild Home Manager

home-manager switch --flake .

Or rebuild entire system (includes home-manager):

sudo nixos-rebuild switch --flake .#yourhostname

Example: Adding Creative Software

home.packages = with pkgs; [
  # Image Editing
  gimp
  inkscape
  krita
  
  # Video Editing
  kdenlive
  obs-studio
  
  # Audio
  audacity
  lmms
  
  # 3D
  blender
];

Removing Applications

Remove System Package

Edit modules/software/packages.nix and delete the line:

environment.systemPackages = with pkgs; [
  vim
  git
  # htop  # Removed
];

Rebuild:

sudo nixos-rebuild switch --flake .#yourhostname

Remove Home Manager Package

Edit home/default.nix and delete the line:

home.packages = with pkgs; [
  firefox
  # discord  # Removed
];

Rebuild:

home-manager switch --flake .

Program Modules vs Packages

Some applications have dedicated program modules with additional configuration.

Using Program Modules

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

Package Sources

Regular Packages

Most packages from nixpkgs:

home.packages = with pkgs; [
  firefox
  vlc
  htop
];

Stable Packages

Use stable channel for older, tested versions:

home.packages = [
  pkgs.stable.firefox  # From nixos-25.05
];

Unfree Packages

NullOS already enables unfree packages. If you need to verify:

# In flake.nix (already configured)
config.allowUnfree = true;

Examples of unfree packages:

  • vscode
  • discord
  • spotify
  • steam
  • nvidia-x11

Installing from Different Sources

From Flake Input

# In flake.nix inputs
inputs.my-app.url = "github:username/my-app";

# In configuration module
environment.systemPackages = [
  inputs.my-app.packages.${pkgs.system}.default
];

From GitHub (Fetch)

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 {})
];

Application Recommendations

For a curated list of recommended applications by category, please refer to:


Flatpak Applications

NullOS includes Flatpak support.

Installing Flatpak Apps

# Search
flatpak search spotify

# Install
flatpak install flathub com.spotify.Client

# Run
flatpak run com.spotify.Client

Adding Flatpak Declaratively

Edit modules/software/flatpak.nix:

services.flatpak.enable = true;

# Then manually install or use home-manager's nix-flatpak

With nix-flatpak (requires adding as input):

services.flatpak.packages = [
  "com.spotify.Client"
  "com.discordapp.Discord"
];

AppImages

Running AppImages

home.packages = [ pkgs.appimage-run ];

Run AppImages:

appimage-run MyApp.AppImage

Making AppImages Executable

chmod +x MyApp.AppImage
./MyApp.AppImage

Managing Application Versions

Pinning Package Versions

Use 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
];

Using Overlays

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 = "...";
      };
    });
  })
];

Application Configuration

Creating Dedicated Config Files

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
];

Application Launchers

Applications are automatically available in Rofi after installation.

Desktop Entries

Applications with .desktop files appear automatically.

Manual Desktop Entry

For apps without desktop entries:

# In home/default.nix
xdg.desktopEntries.myapp = {
  name = "My Application";
  genericName = "App";
  exec = "myapp";
  terminal = false;
  categories = [ "Application" ];
};

Troubleshooting

Package Not Found

  1. Search with correct name:
nix search nixpkgs package-name
  1. Check spelling and availability

  2. May be unfree - ensure allowUnfree = true

Application Won't Start

  1. Check if installed:
which application-name
  1. Run from terminal to see errors:
application-name
  1. Check logs:
journalctl --user -e

Version Conflicts

Use overlays to override conflicting versions:

nixpkgs.overlays = [
  (final: prev: {
    package = prev.package.override {
      dependency = prev.dependency_v1;
    };
  })
];

Missing Dependencies

Some packages need additional dependencies:

environment.systemPackages = with pkgs; [
  myapp
  
  # Required dependencies
  lib1
  lib2
];

Best Practices

  1. Organize by Category - Group related packages
  2. Comment Your Additions - Note why you installed something
  3. Use Program Modules - When available, for better config
  4. Separate User/System - System packages for all users, home for personal
  5. Test Before Committing - Build first, then commit to git
  6. Remove Unused - Keep your package list clean

Advanced: Creating Custom Modules

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";
  };
};

Updating Applications

Update All Packages

# Update flake inputs
nix flake update

# Rebuild
sudo nixos-rebuild switch --flake .#hostname

Update Specific Input

nix flake lock --update-input nixpkgs

Check for Updates

nix flake metadata

Next Steps

Clone this wiki locally