nix build: Simplify build functions a bit