Slow Building Pipewire

I’m trying to switch to pipewire, but the build process is taking too long (already nearing 4 hours). Is there a way I can force nixos to download the built version?

I’m coming from Arch btw, and I’m very used to the AUR having prebuilt things, is there such a thing on Nixos? I’ve been on nixos for about 6 months.

Any tips & learning material would be helpful! Thanks!

Pipewire is prebuilt, unless you have some override or overlay that prevents using the prebuilt version. Please share your config.

Sorry, its a bit messy:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

let
  unstableTarball =
    fetchTarball
      https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
in
{
  imports =
    [ # Include the results of the hardware scan.
      /etc/nixos/hardware-configuration.nix
    ];
  

  # Allow unstable for specific things
  nixpkgs.config = {
    packageOverrides = pkgs: {
      unstable = import unstableTarball {
        config = config.nixpkgs.config;
      };
    };
  };
  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  # Mount drive
  fileSystems."/HDD" = {
   device = "/dev/disk/by-uuid/6c1929fd-8e2d-4997-b34c-9e1c9cdf6d72";
   fsType = "ext4";
   options = [ # If you don't have this options attribute, it'll default to "defaults" 
     # boot options for fstab. Search up fstab mount options you can use
     "nofail" # Prevent system from failing if this drive doesn't mount
   ];
 };
  # audio stuff for later
  # https://nixos.wiki/wiki/JACK
  # https://nixos.wiki/wiki/PipeWire
  services.gvfs.enable = true;
  services.udisks2.enable = true;

  networking.hostName = "yuki"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # environment vars
  nixpkgs.config.qt5 = {
    enable = true;
    platformTheme = "qt5ct"; 
      style = {
        package = pkgs.utterly-nord-plasma;
        name = "Utterly Nord Plasma";
      };
  };
  # Set your time zone.
  time.timeZone = "America/Chicago";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";
  i18n.supportedLocales = [
      "en_US.UTF-8/UTF-8"
      "ja_JP.UTF-8/UTF-8"
    ];
  #i18n.inputMethod.enabled = "fcitx5";
  #i18n.inputMethod.fcitx5.addons = [
  #  pkgs.fcitx5-mozc
  #  pkgs.fcitx5-gtk
  #  pkgs.fcitx5-configtool
  #];
  # environment.variables.GLFW_IM_MODULE = "ibus";
  i18n.inputMethod.enabled = "ibus";
  i18n.inputMethod.ibus.engines = with pkgs.ibus-engines; [mozc];
  environment.variables = {
    IBUS_ENABLE_SYNC_MODE = "1";
    QT_QPA_PLATFORMTHEME = "qt5ct";
  };
  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
   };
  
  services.xserver = {
    enable = true;
    displayManager.gdm.enable = true;
    windowManager.i3.enable = true;
    desktopManager.runXdgAutostartIfNone = true;
    xkb.layout = "us";
    #xkb.variant = "dvorak";
    #xkb.options = "grp:win_space_toggle";
    videoDrivers = [ "amdgpu" ];
    #libinput.enable = true;
    #libinput.touchpad.naturalScrolling = true;
  };
  systemd.timers."backup" = {
    wantedBy = [ "timers.target" ];
        timerConfig = {
        OnCalendar = "*-*-* 02:00:00";  # Runs every day at 2 AM
        Persistent = true;
        Unit = "backup.service";
        };
    };

    systemd.services."backup" = {
    script = ''
        set -eu
        /home/caret/Scripts/backupnas.sh
    '';
    serviceConfig = {
        Type = "oneshot";
        User = "caret";
    };
  };

  services.xserver.deviceSection = ''Option "TearFree" "true"'';
  services.picom = {
     enable = false;
     vSync = true;
  };

  # Enable CUPS to print documents.
  services.printing.enable = false;
  hardware.pulseaudio.enable = false;
  hardware.opengl.enable = true;
  nixpkgs.config.pulseaudio = false;
  #hardware.bluetooth.enable = true;
  #hardware.bluetooth.powerOnBoot = true;
  #services.blueman.enable = true;
  hardware.pulseaudio.extraConfig = "load-module module-combine-sink";
  security.rtkit.enable = true;
  
  # Pipewire
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    jack.enable = true;
  
    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };
  services.jack = {
    jackd.enable = false;
    # support ALSA only programs via ALSA JACK PCM plugin
    alsa.enable = false;
    # support ALSA only programs via loopback device (supports programs like Steam)
    loopback = {
      enable = true;
      # buffering parameters for dmix device to work with ALSA only semi-professional sound programs
      #dmixConfig = ''
      #  period_size 2048
      #'';
    };
  };
  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

   # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.caret = {
    isNormalUser = true;
    description = "caret";
    extraGroups = [ "networkmanager" "wheel" "docker" "dialout" "tty" "adbusers" "kvm" "libvirtd" "input" "jackaudio" "audio"];
    packages = with pkgs; [
      thunderbird
      firefox
      kitty
      i3
      zsh
      discord
      betterdiscordctl
      element-desktop
      signal-desktop
      telegram-desktop
      anki-bin
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  # ADB
  programs.adb.enable = true;
  # For dynamic binaries
  programs.nix-ld.enable = true;
  services.envfs.enable = true;


  # List packages installed in system profile. To search, run:
  environment.systemPackages = with pkgs; 
  let
      polybar = pkgs.polybar.override {
        i3Support = true;
      };
    in
  [
    unstable.zed-editor
    just
    openssl
    pkg-config
    libiconv
    rust-analyzer
    patchelf
    libgcc
    carla
    pavucontrol 
    libjack2 
    jack2 
    qjackctl 
    jack2Full 
    jack_capture
    nix-index
    alsaLib
    freetype
    glib
    stdenv.cc.cc
    polybar
    polybar-pulseaudio-control
    vscode
    tor-browser
    tor
    dos2unix
    rpi-imager
    gnome.gnome-keyring
    gcr
    calibre
    snmpcheck
    icu
    ghidra
    bcompare
    binwalk
    arp-scan
    obs-studio
    subtitlecomposer
    kdenlive
    glaxnimate
    mediamtx
    hplip
    vlc
    xwinwrap
    wireshark
    jadx
    apktool
    bytecode-viewer
    openjdk
    dex2jar
    cool-retro-term
    ntfs3g
    ffmpeg-full
    frei0r
    frida-tools
    nodejs
    unixtools.xxd
    keepassxc
    libsForQt5.kleopatra
    pinentry
    pinentry-curses
    gnupg
    net-snmp
    frp
    qemu-utils
    virt-manager
    cdrkit
    brasero
    osu-lazer-bin
    blender
    dragonfly-reverb
    spice-gtk
    nmap
    mitmproxy
    openssl
    pkg-config
    musescore
    radamsa
    tmux
    avahi
    filezilla
    mitmproxy
    python311Packages.mitmproxy-rs
    godot_4
    android-tools
    waypipe
    scrcpy
    gdb
    ranger
    lf
    wget
    neovim
    gcc
    clang
    gnumake
    desktop-file-utils
    ripgrep
    lazygit
    bottom
    polkit
    polkit-kde-agent
    libsForQt5.kde-cli-tools
    gsimplecal
    x11vnc
    tigervnc
    alacritty
    krita
    darktable
    opentabletdriver
    wacomtablet
    figlet
    kitty
    kitty-themes
    kitty-img
    zsh
    gnome.gdm
    gnome.gnome-tweaks
    dunst
    libnotify
    bind
    p7zip
    ark
    mpvScripts.mpris
    mpv
    ani-cli
    libcaca
    mpd
    mpd-mpris
    mpd-discord-rpc
    playerctl
    alsa-utils
    pamixer
    xbindkeys
    xorg.xev
    xorg.xbacklight
    sxiv
    feh
    typora
    xclip
    flameshot
    nvtopPackages.amd
    python312Packages.meshtastic
    python312Packages.mitmproxy
    python312Packages.pytap2
    python312Packages.packaging
    python312Packages.bootstrap.packaging
    scrot
    maim
    yt-dlp
    imagemagick
    zathura
    cron
    obsidian
    #pureref
    neofetch
    redshift
    curl
    wget
    libreoffice-still
    arandr
    xorg.xrandr
    conda
    git
    git-lfs
    sshfs
    openssh
    inetutils
    rsync
    rclone
    dolphin
    resvg
    libsForQt5.ffmpegthumbs
    libsForQt5.kio-extras
    libsForQt5.kdegraphics-thumbnailers
    ffmpeg
    nufraw-thumbnailer
    taglib
    qt5ct
    python3
    python311Packages.pip
    networkmanagerapplet
    wireguard-tools
    openconnect_openssl
    polkit_gnome
    i3
    picom
    rofi
    rofi-emoji
    rofi-calc
    usbutils
    minicom
    putty
    screen
    autorandr
    killall
    lxappearance
    capitaine-cursors
    libsForQt5.qt5ct
    libsForQt5.breeze-icons
    libsForQt5.ark
    libsForQt5.qtstyleplugin-kvantum
    libsForQt5.qt5ct
    ungoogled-chromium
    lm_sensors
    i3lock-fancy-rapid
    pavucontrol
    cifs-utils
    xlsfonts
    materia-theme
    pciutils
    xorg.xf86videoamdgpu
    vaapiVdpau
    vdpauinfo
    libvdpau-va-gl
    libva-utils
    btop
    htop
    cmatrix
    asciiquarium-transparent
    file
    appimage-run
    polkit
    unetbootin
    gparted
    ntfs3g
    exfat
    udisks
    uuu
    pv
    cdrtools
    cdrkit
    exfatprogs
    ntfs3g
    gnome.nautilus
    rdesktop
    moonlight-qt
    sunshine
    bc
    busybox
    iperf3
    freerdp
    libsForQt5.qt5ct
    unzip
    bambu-studio
    openscad
    ];

  fonts.packages = with pkgs; [
    siji
    nerdfonts
    font-awesome
    noto-fonts
    noto-fonts-cjk-sans
    noto-fonts-cjk-serif
    noto-fonts-cjk
    noto-fonts-color-emoji
    liberation_ttf
    fira-code
    fira-code-symbols
    mplus-outline-fonts.githubRelease
    dina-font
    proggyfonts
    fira-mono
    fira-code
    carlito
    dejavu_fonts
    ipafont
    kochi-substitute
    source-code-pro
    ttf_bitstream_vera
    xorg.xbacklight
  ];
  
  # Set default fonts
  fonts.fontconfig.defaultFonts = {
    monospace = [
      "Fira Mono"
      "Noto Sans Mono CJK JP"
    ];

    sansSerif = [
      "Fira Mono"
      "Noto Sans CJK JP"
    ];

    serif = [
      "Fira Mono"
      "Noto Serif CJK JP"
    ];
  };

  nixpkgs.config.permittedInsecurePackages = [
    "electron-25.9.0"
    "python3.11-django-3.1.14"
  ];

  programs.zsh.enable = true;
  services.openssh.enable = true;
  virtualisation.libvirtd.enable = true;
  programs.virt-manager.enable = true;
  
  users.defaultUserShell = pkgs.zsh;
  
  systemd = {
    user.services.polkit-gnome-authentication-agent-1 = {
      description = "polkit-gnome-authentication-agent-1";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
        Type = "simple";
        ExecStart =
          "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
        Restart = "on-failure";
        RestartSec = 1;
        TimeoutStopSec = 10;
      };
    };
  };
  
  services.xserver.windowManager.i3.extraSessionCommands = ''
    eval $(gnome-keyring-daemon --daemonize)
    export SSH_AUTH_SOCK
  '';

  # networking.firewall.enable = false;
  networking.firewall = {
    enable = false;
    allowedTCPPorts = [ 22 47984 47989 47990 48010 ];
    allowedUDPPorts = [ 51820 ];
    allowedUDPPortRanges = [
      { from = 47998; to = 48000; }
      { from = 8000; to = 8010; }
    ];
  };
  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "24.05"; # Did you read the comment?

  services.libinput.touchpad.naturalScrolling = true;
  programs.light.enable = true;
  services.actkbd = {
    enable = true;
    bindings = [
      { keys = [ 225 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -A 10"; }
      { keys = [ 224 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -U 10"; }
    ];
  };
  # For kleopatra
  services.pcscd.enable = true;
  programs.gnupg.agent = {
     enable = true;
     enableSSHSupport = true;
  };
  
  nix.extraOptions = ''experimental-features = nix-command flakes'';

  # Sunshine
  services.sunshine = {
    enable = true;
    autoStart = true;
    #capSysAdmin = true;
    openFirewall = true;
  };
  
  # firefox save dialog
  environment.sessionVariables = {
    MOZ_USE_XINPUT2 = "1";
  };

  xdg.mime.defaultApplications = {
    "text/html" = "firefox.desktop";
    "x-scheme-handler/http" = "firefox.desktop";
    "x-scheme-handler/https" = "firefox.desktop";
    "x-scheme-handler/about" = "firefox.desktop";
    "x-scheme-handler/unknown" = "firefox.desktop";
    "application/pdf" = "org.pwmt.zathura-pdf-mupdf.desktop";

  };
  
  # Steam
  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
    dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
    localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
  };
  
}