System config flake and webkitgtk

{ inputs.cdp8.url = "github:ovitus/CDP8.nix";
  inputs.musnix.url = "github:musnix/musnix";
  inputs.nixpkgs-0830e66.url = "github:NixOS/nixpkgs/0830e6694d94fb421e7ca8c575e7a62675de3ee5";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  inputs.tidalcycles.url = "github:mitchmindtree/tidalcycles.nix";
  inputs.u-he.url = "./u-he";
  inputs.implicitpipe.url = "./implicitpipe";
  nixConfig =
  { substituters = 
    [ https://cache.nixos.org 
      https://cuda-maintainers.cachix.org
    ];
    trusted-public-keys = 
    [ cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 
      cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
    ];
  };
  outputs = { cdp8, implicitpipe, musnix, nixpkgs-0830e66, nixpkgs, self, tidalcycles, u-he }: 
  { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem
    { system = "x86_64-linux";
      modules = 
      [ ( { config, lib, pkgs, ... }: 
          let
            GPipe = pkgs.fetchFromGitHub 
            { owner = "tobbebex";
              repo = "GPipe-Core";
              rev = "master";
              hash = "sha256-zk3patORx/vZbgnvDgsLnRnO07L8Ot2cMCCsGmnGzzg=";
            };
            GPipe-GLFW = pkgs.fetchFromGitHub
            { owner = "plredmond";
              repo = "GPipe-GLFW";
              rev = "master";
              hash = "sha256-7f7k7t9/UXuRwDRCnp4dcLU1DYzzydH9Hg1QZQmiu+o=";
            };
            HaskellImages = pkgs.fetchFromGitHub 
            { owner = "stla";
              repo = "HaskellImages";
              rev = "main";
              hash = "sha256-WrwK8BvbMgy+tYn3E+Rsl0WHeeoIO5yRYLDwf4aNUV0=";
            };
            continued-fractions = pkgs.fetchFromGitHub 
            { owner = "rockbmb";
              repo = "continued-fractions";
              rev = "master";
              hash = "sha256-3kfXcxMUgW1toxb53nWdRZCcLa6zMgAjIrGPUNn6Z2o=";
            };
            gamma = pkgs.fetchFromGitHub 
            { owner = "rockbmb";
              repo = "gamma2";
              rev = "master";
              hash = "sha256-J909zhrv8rUTEKcp3jV6B1AN63O14fQxjh6+aw1kTIY=";
            };
            hsluv-haskell = pkgs.fetchFromGitHub 
            { owner = "ovitus";
              repo = "hsluv-haskell";
              rev = "main";
              hash = "sha256-ai9mls28chX+m1pOoXdklTHYViYwMc0YhtT3/+i+seQ=";
            };
            scvim = pkgs.vimUtils.buildVimPlugin 
            { name = "scvim";
              src = pkgs.fetchFromGitHub 
              { owner = "supercollider";
                repo = "scvim";
                rev = "main";
                hash = "sha256-0c6dSFh1E+1QSvr4upYCrHttTv8iuV6s3PM/xt8rfXo=";
              };
            };
            superdirt = pkgs.fetchFromGitHub 
            { owner = "musikinformatik";
              repo = "superdirt";
              rev = "main";
              hash = "sha256-9qU9CHYAXbN1IE3xXDqGipuroifVaSVXj3c/cDfwM80=";
            };
            weierstrass-functions = pkgs.fetchFromGitHub 
            { owner = "stla";
              repo = "weierstrass-functions";
              rev = "main";
              hash = "sha256-jrpiDtyWf1OjEcXZX8dQISTK9PZV4aoKO4dKWrYbw7Q=";
            };
          in
          { imports = [ ./desktop-hardware-configuration.nix ];
            boot.loader.efi.canTouchEfiVariables = true;
            boot.loader.systemd-boot.enable = true;
            environment.etc = { "resolv.conf".text = "nameserver 8.8.8.8\nnameserver 1.1.1.1\n"; };
            environment.shellAliases =
            { bat = "cat /sys/class/power_supply/BAT0/capacity";
              couchpc = "xfreerdp -u awright -p '' -g 1920x1080 192.168.1.17";
              ffrec="ffmpeg -video_size 2558x1438 -framerate 60 -f x11grab -i :0.0+0,510 -f pulse -i default -f pulse -i alsa_output.pci-0000_05_04.0.analog-stereo.monitor -filter_complex '[1:a]pan=mono|c0=c0[mic]; [mic][2:a]amix=[a]' -map 0:v -map '[a]' $(date +%-d.%-m.%y).mp4 -map 2:a $(date +%-d.%-m.%y).wav";
              snip = "maim -s | xclip -selection clipboard -t image/png";
              vi = "vim";
            };
            environment.systemPackages = with pkgs;
            [ ( ( vim_configurable.override {  } ).customize
                { name = "vim";
                  vimrcConfig.packages.myplugins = with pkgs.vimPlugins;
                  { start = [ scvim
                              haskell-vim
                              vim-nix
                              vim-tidal
                            ];
                    opt = [];
                  };
                  vimrcConfig.customRC = ''
                    au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider
                    au Filetype supercollider packadd scvim
                    filetype plugin indent off
                    filetype plugin on
                    let g:haskell_indent_disable = 1
                    let g:scFlash = 1
                    let maplocalleader = ","
                    set background=dark
                    set backspace=indent,eol,start
                    set belloff=all
                    set expandtab
                    set noautoindent
                    set nocindent
                    set nosmartindent
                    set pastetoggle=<F12> 
                    syntax on
                  '';
                }
              )
              ( callPackage ./bitwig-studio5.nix { } )
              ( haskell.packages.ghc948.ghc.withPackages 
                ( p: with p;
                  [ ( pkgs.haskellPackages.callCabal2nix "GPipe" (GPipe + "/GPipe-Core") { } )
                    ( pkgs.haskellPackages.callCabal2nix "GPipe-GLFW" (GPipe-GLFW + "/GPipe-GLFW") { } )
                    ( pkgs.haskellPackages.callCabal2nix "HaskellImages" HaskellImages { } )
                    JuicyPixels
                    PenroseKiteDart
                    Rasterific
                    hip
                    implicit
                    lens
                    linear
                    mwc-random
                    os-string
                    weierstrass-functions
                    xmonad
                  ]
                )
              )
              ( puredata-with-plugins [ ( callPackage ./gem.nix { } ) ] )
              ( python3.withPackages 
                ( p: with p; 
                  [ ( callPackage ./bitsandbytes.nix { } )
                    ( callPackage ./color-matcher.nix { } ) # https://github.com/kijai/ComfyUI-KJNodes
                    ( callPackage ./insightface.nix { } ) # https://github.com/Gourieff/comfyui-reactor-node # https://github.com/ltdrdata/ComfyUI-Impact-Pack
                    ( callPackage ./python-midi.nix { } ) # https://github.com/TylerMclaughlin/midi_to_tidalcycles
                    ( callPackage ./segment-anything.nix { } )
                    ( callPackage ./spandrel.nix { } )
                    ( callPackage ./ultralytics.nix { } ) # https://github.com/Gourieff/comfyui-reactor-node
                    accelerate
                    deepdiff # https://github.com/crystian/ComfyUI-Crystools
                    diffusers
                    einops
                    gitpython
                    imageio # https://github.com/WASasquatch/was-node-suite-comfyui
                    imageio-ffmpeg
                    imagesize
                    kornia
                    lazy-loader # https://github.com/WASasquatch/was-node-suite-comfyui
                    numba # https://github.com/WASasquatch/was-node-suite-comfyui
                    opencv4
                    piexif # https://github.com/jakechai/ComfyUI-JakeUpgrade
                    pip # https://github.com/jakechai/ComfyUI-JakeUpgrade
                    py-cpuinfo # https://github.com/crystian/ComfyUI-Crystools
                    pynput
                    pynvml # https://github.com/crystian/ComfyUI-Crystools
                    requirements-parser # https://github.com/melMass/comfy_mtb
                    scikit-image # https://github.com/WASasquatch/was-node-suite-comfyui
                    sentencepiece
                    simpleeval # https://github.com/jakechai/ComfyUI-JakeUpgrade
                    tifffile # https://github.com/WASasquatch/was-node-suite-comfyui
                    timm # https://github.com/kijai/ComfyUI-Florence2
                    toml
                    torchaudio
                    torchsde
                    torchvision
                    transformers
                    voluptuous
                  ] 
                ) 
              )
              ( writeShellScriptBin "bitwig" ''steam-run bitwig-studio'' )
              ( writeShellScriptBin "pdg" ''pd -lib Gem'' )
              alsa-utils
            # audacity # webkitgtk takes forever to build
              blender
              cabal-install
              cabal2nix
              cachix
              cargo
              cdp8.defaultPackage.x86_64-linux
              chromium
              cifs-utils
              cmus
              cups
              dig
              dmenu-rs
              feh
              ffmpeg_7-full
              file
              firefox
              freerdp
              gimp
              git
              git-lfs
              gnuplot
              implicitpipe.defaultPackage.x86_64-linux
              jack-example-tools
              jmtpfs
              jq
              killall
              libjpeg
              lsof
              maim
              masterpdfeditor4
              mpv
              nix-prefetch-git
              nmap
              openvpn
              pamix
              pwgen
              qjackctl
              redshift
              ruby
              rustc
              scrot
              sonic-visualiser
              soulseekqt
              sox
              spotify
              supercollider-with-sc3-plugins
              teleport_13
              tidal
              tor-browser
              unzip
              virt-manager
              wget
              wireshark
              xclip
              xorg.xwininfo
              zip
              zoom-us
            ];
            hardware.alsa.enablePersistence = true;
            hardware.bluetooth.enable = true;
            hardware.bluetooth.powerOnBoot = true;
            hardware.nvidia.open = false;
            networking.firewall =
            { allowedTCPPorts = [ 8188 ];
              enable = true;
            };
            networking.hostName = "nixos";
            networking.networkmanager =
            { enable = true;
              plugins = lib.mkForce [];
            };
            nix.settings.experimental-features = [ "ca-derivations" "flakes" "nix-command" ];
            nix.settings.substituters = [ "https://cache.iog.io" ];
            nix.settings.trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
            nix.settings.trusted-users = [ "root" "wright" ];
            nixpkgs.config.allowBroken = true;
            nixpkgs.config.allowUnfree = true;
            nixpkgs.config.cudaSupport = true;
            nixpkgs.overlays = 
            [ tidalcycles.overlays.default
              ( self: super:
                { inherit 
                  ( import nixpkgs
                    { system = "x86_64-linux"; 
                    } 
                  ) cabal-install cachix;
                }
              )
              ( self: super:
                { inherit 
                  ( import nixpkgs-0830e66 
                    { system = "x86_64-linux"; 
                    } 
                  ) teleport_13;
                }
              )
              ( self: super:
                { haskellPackages = super.haskell.packages.ghc948.override
                  { overrides = hself: hsuper:
                    { GPipe = hself.callCabal2nix "GPipe" (GPipe + "/GPipe-Core") { };
                      continued-fractions = hself.callCabal2nix "continued-fractions" continued-fractions { };
                      gamma = hself.callCabal2nix "gamma" gamma { };
                      hsluv-haskell = hself.callCabal2nix "hsluv-haskell" hsluv-haskell { };
                    };  
                  };  
                }
              )
            ];
            programs.gnupg.agent =
            { enable = true;
              enableSSHSupport = true;
              pinentryPackage = pkgs.pinentry-tty;
            };
            programs.nano.enable = false;
            programs.steam.enable = true;
            programs.tmux =
            { enable = true;
              extraConfig = ''
                bind-key -Tcopy-mode-vi 'Enter' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
                bind-key -Tcopy-mode-vi 'Space' send -X begin-selection
                set -g default-terminal "screen-256color"
                set -g pane-active-border-style fg=red
                set -g status-bg cyan
                set -g status-keys vi 
                setw -g mode-keys vi
              '';
            };
            security.pam.loginLimits = 
            [ { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } 
              { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } 
            ];
            security.sudo.wheelNeedsPassword = false;
            services.dnscrypt-proxy2 =
            { enable = false;
              settings.require_dnssec = true;
              settings.server_names = [ "cloudflare" ];
            };
            services.pipewire =
            { alsa.enable = true;
              alsa.support32Bit = true;
              enable = true;
              jack.enable = true;
              pulse.enable = true;
            };
            security.rtkit.enable = true;
            services.openssh.enable = true;
            services.printing.enable = true;
            services.xserver.displayManager.sessionCommands = ''
              xrandr --output DP-0 --pos 0x510 --output DP-4 --rotate right --pos 2560x0
              feh --bg-center ${self}/frida_kahlo.webp
              redshift -O 4500
              ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 105 = backslash bar"
              ${pkgs.xorg.xrdb}/bin/xrdb -merge <<EOF
                *selectToClipboard: true
                Xcursor.size: 16
                xterm*Background: black
                xterm*Foreground: white
                xterm*faceName: DejaVu Sans Mono
                xterm*faceSize: 10
                xterm*renderFont: true
                xterm.termName: xterm-256color
              EOF
              ln -s ${superdirt}/superdirt_startup.scd ~/.config/SuperCollider/startup.scd
              [[ -d ~/.u-he ]] || cp -rs ${u-he.defaultPackage.x86_64-linux} ~/.u-he
              chmod -R +w ~/.u-he
              sudo modprobe snd_virmidi midi_devs=1
              echo 'export EDITOR=vi' > ~/.bashrc
              echo 'export PS1="\[\e[1m\e[36m\][\[\e[m\]\[\e[1;38;5;43m\]\u\[\e[m\]@\[\e[1;38;5;38m\]\h\[\e[m\]:\[\e[1;38;5;86m\]\w\[\e[m\]\[\e[1;36m\]]\[\e[m\]\\$ "' >> ~/.bashrc
              echo '[[ -f ~/.bashrc ]] && source ~/.bashrc' > ~/.bash_profile
              mkdir -p ~/.config/xmonad && echo "import XMonad; main = xmonad $ def { modMask = mod4Mask }" > ~/.config/xmonad/xmonad.hs
              mkdir -p ~/Bitwig\ Studio/Extensions && cp -n ${self}/DrivenByMoss/* ~/Bitwig\ Studio/Extensions
            '';
            services.xserver.enable = true;
            services.xserver.xkb.layout = "us";
            services.libinput.enable = true;
            services.xserver.videoDrivers = ["nvidia"];
            services.xserver.windowManager.xmonad.enable = true;
            system.stateVersion = "23.05";
            time.timeZone = "America/New_York";
            users.mutableUsers = false;
            users.users.wright =
            { extraGroups = [ "audio" "libvirtd" "networkmanager" "wheel" ];
              isNormalUser = true;
              password = "";
            };
            virtualisation.libvirtd.enable = true;
          }
        )
        musnix.nixosModules.musnix
        { musnix.enable = true;
          musnix.kernel.realtime = true;
        }
      ];
    };
  };
}

In response to this response from @TLATER

Please let me know what I’m doing wrong here so my system doesn’t need to compile webkitgtk itself and can pull it from the NixOS cache instead

It actually finished… I got Audacity installed! Before I was using nixos-unstable branch of nixpkgs, so maybe that had something to do with it.

I’d still like to know what else I can do to avoid compiling anything locally, and if anyone thinks I should change/optimize anything with this to make it better (I know it’s not the most eloquent flake, but it works), I’d appreciate it