Skip to main content

NixOS Installation

██████╗ ███████╗███████╗ █████╗ ██████╗  ██████╗██╗  ██╗
██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝██║  ██║
██║  ██║███████╗█████╗  ███████║██████╔╝██║     ███████║
██║  ██║╚════██║██╔══╝  ██╔══██║██╔══██╗██║     ██╔══██║
██████╔╝███████║███████╗██║  ██║██║  ██║╚██████╗██║  ██║
╚═════╝ ╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝
                                                      

DankSearch can be installed on NixOS using the NixOS module. This guide covers the native nixpkgs installation method.

NixOS Unstable Required

DankSearch is currently only available in the unstable branch of nixpkgs. If you're on NixOS stable, you'll need to use the Flake Installation method instead.

Installation

1. Enable NixOS Unstable

Ensure you're using NixOS unstable by setting your channel or flake input:

Using channels:

sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --update

Using flakes (in flake.nix):

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
}

2. Enable DankSearch

In your NixOS configuration, enable DankSearch:

programs.dsearch.enable = true;

That's it! Rebuild your system and DankSearch will be installed with sensible defaults.

Configuration Options

DankSearch provides configuration options to customize your installation:

Basic Configuration

programs.dsearch = {
enable = true;

# Use a custom package (optional)
package = pkgs.dsearch;

# Systemd service configuration
systemd = {
enable = true; # Enable systemd user service
target = "default.target"; # Start with user session
};
};

Systemd Service Options

The NixOS module configures a systemd user service. You can customize when it starts:

programs.dsearch = {
enable = true;

systemd = {
enable = true;
target = "graphical-session.target"; # Only start in graphical sessions
};
};

Using Flake Package with NixOS Module

You can use the package from the DankSearch flake while still using the native NixOS module. This allows you to get quicker updates while keeping the module configuration:

First, add the flake input to your flake.nix:

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

danksearch = {
url = "github:AvengeMedia/danksearch";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}

Then use the flake package with the native module:

programs.dsearch = {
enable = true;
package = inputs.danksearch.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
warning

When using the flake package with the native nixpkgs module, some dependencies may not be automatically enabled by default, and certain configurations might be missing. You may need to manually install optional dependencies or adjust feature toggles to match your needs.

tip

For per-user installation with more flexibility, consider using the home-manager flake installation method instead.

Rebuilding

After making configuration changes, rebuild your system:

sudo nixos-rebuild switch

Troubleshooting

Service doesn't start automatically

Make sure you have systemd.enable = true set:

programs.dsearch = {
enable = true;
systemd.enable = true;
};

Binary not found

Ensure DankSearch is properly installed:

programs.dsearch.enable = true;

Next Steps