
NixOS on the Desktop
NixOS on the server is a thing of beauty (check out my last blog post about Hosting Websites on NixOS), but after my Arch installation crapped out, I decided to take it further and also use it on my laptop as a daily driver.
Even though I was aware of the vast number of packages in the Nix repositories, I was still pleasantly surprised to find that almost all of my daily tools were available directly in the stable repository. Even Steam is just one line of configuration away!
However, a crucial work tool of mine, DDEV, was missing from the repositories. DDEV is a tool designed for launching local web development environments for PHP, Node.js and Python projects.
DDEV in the Nix User Repository
With a bit of help from a savvy individual named kraftnix in the Jupiter Broadcasting Nix Nerds matrix group, I was able to create a buildable package of ddev on Nix.
The NUR (Nix User Repository) is a neat community and GitHub driven project, evidently inspired by the AUR (Arch user repository). While the NUR is smaller by several orders of magnitude, it can now be used to get ddev working on Nix / NixOS.
Below are the steps required to run DDEV on Nix / NixOS:
/etc/nixos/configuration.nix
{ config, pkgs, ... }: { # ... # Install & enable docker. virtualisation.docker.enable = true; # Add your user to the 'docker' group. Change 'MYUSER' to your Linux username. users.users.MYUSER.extraGroups = [ "docker" ]; # Enable the NUR. nixpkgs.config.packageOverrides = pkgs: { nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { inherit pkgs; }; }; # Install dddev from the NUR. environment.systemPackages = with pkgs; [ nur.repos.gbytedev.ddev ]; # Allow Xdebug to use port 9003. networking.firewall.allowedTCPPorts = [ 9003 ]; # Make it possible for ddev to modify the /etc/hosts file. # Otherwise you'll have to manually change the # hosts configuration after creating a new ddev project. environment.etc.hosts.mode = "0644"; }
Please test and let me know if anything is broken / missing, as I intend to create a merge request on Nixpkgs to ensure this becomes a properly maintained package.
Links:
Add new comment