syd (named after Syd Barrett) is a lightweight command-line tool written in Python for managing your NixOS packages declaratively. It lets you install, remove, list, and search for packages by directly editing your Nix configuration files, so you don’t have to open them manually every time you make a change.
syd install <pkg>— add one or more packages to your saved Nix configsyd remove <pkg>— remove one or more packages from your configsyd comment <pkg>— comment one or more packages from your configsyd search <pkg>— search for a package in nixpkgssyd has <pkg>— check if package is listed or notsyd list— print and count the number of installed packagessyd --reset— reset your stored config path and rebuild commandsyd --help— show usage info
The config is stored in ~/.config/syd/config, which remembers:
- your Nix packages file path (e.g.
/etc/nixos/packages.nix) - your rebuild command (e.g.
sudo nixos-rebuild switch)
You can install syd directly from its flake or use a development shell if you’re contributing or testing it.
In your flake.nix:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
syd.url = "github:sidharthify/syd";
};
outputs = { self, nixpkgs, syd, ... }: {
nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
({ pkgs, ... }: {
environment.systemPackages = with pkgs; [
syd.packages.x86_64-linux.default
];
})
];
};
};
}Then rebuild your system:
sudo nixos-rebuild switch --flake .#your-hostnameNow you can use syd globally:
syd install firefox
syd remove vim
syd search discordIf you want to test your changes on syd or just run it directly, use the flake’s devShell:
nix develop github:sidharthify/sydThis drops you into a shell with all Python dependencies ready. Then you can run:
python syd.py --helpor make it executable and run it directly:
chmod +x syd.py
./syd.py install htopIf you’re using Home Manager, add syd as a package input:
home.packages = [
inputs.syd.packages.x86_64-linux.default
];Then rebuild your home configuration:
home-manager switch --flake ~/.config/nixpkgsYou can confirm syd is installed with:
syd --helpIf you haven’t modularized your Nix config yet, create a separate file to handle packages — for example packages.nix.
Update your configuration.nix like this:
environment.systemPackages = import ./packages/packages.nix pkgs;and structure your new file like:
{ pkgs }: with pkgs; [
vim
wget
git
# more packages...
]Now syd can manage this file automatically.
-
syd was originally written in bash but is now entirely in Python 3, making it a lot faster.
-
It expects a single
packages.nixfile by default, but you can adapt it for your own layout. For reference, see my NixOS setup to understand how I structure my configs. (not the best, I'm aware) -
An overview of syd's code can be found on this blog.