Skip to content

camdenboren/nixos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

329 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❄️ NixOS + Darwin Config ❄️

built with garnix

Introduction

This is a config for multiple hosts of varying degrees of specificity, but main is an audio-oriented, modular NixOS configuration relying on Home-Manager and Flakes and includes examples of

  • Custom Modules
  • Custom Scripts
  • Derivations
  • Overlays
  • DevShells

You probably won't want to try installing any of these hosts directly due to UUID discrepancies in hardware-configuration.nix, so this repo primarily serves as a reference in creating your own config

Some direct utility may be found in leveraging the binary cache by adding Garnix to your nix-config

nix.settings.substituters = [ "https://cache.garnix.io" ];
nix.settings.trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];

Special thanks to vimjoyer, ryan4yin, and PowerUser64, as their content/configs were massively helpful for learning the basics of NixOS, flakes, home-manager, and linux audio

Sections

Overview

Structure

  • Firstly, pinning our system inputs, flake.nix is a parent

  • Beneath this, various hosts are defined with sys and usr (think configuration.nix and home-manager.nix)

  • sys and usr are further divided into modules within their corresponding directories

  • Modules used by more than one host are stored in common

    flake
    ├── common
    │   ├── sys
    │   └── usr
    └── hosts
            ├── mac
            │   ├── sys
            │   └── usr
            ├── macvm
            │   ├── sys
            │   └── usr
            ├── main
            │   ├── sys
            │   └── usr
            ├── mainvm
            │   ├── sys
            │   └── usr
            └── media
                ├── sys
                └── usr
    

    usr also includes subdirectories for dotfiles, custom derivations, development environments, scripts, and theming to enable convienent access

Systems

  • mac

    • Development and Productivity
    • 2023 Macbook Pro 14"
    • M2 Pro
    • 1tb storage
    • 16gb memory
  • main

    • Audio, Development and Productivity, Gaming
    • 2024 DIY build
    • Ryzen 7 9700x
    • NVIDIA RTX 4070S
    • 4tb NVME storage
    • 32gb memory
  • media

    • Media, Gaming
    • 2011 Dell Inspiron 660
    • Intel i7 2600k
    • AMD Radeon RX 570
    • 500gb SSD + 12tb HDD storage
    • 8gb memory

Installation

Setup

  1. Enable experimental features by adding this to /etc/nixos/configuration.nix

    # Enable flakes
    nix.settings.experimental-features = [
      "nix-command"
      "flakes"
    ];

    Then rebuild

    sudo nixos-rebuild switch
  2. Move /etc/nixos to ~/etc/nixos, symlink new location to old
    Enable non-sudo config edits

    {
    mkdir ~/etc
    sudo mv /etc/nixos ~/etc/
    sudo chown -R $(id -un):users ~/etc/nixos
    sudo ln -s ~/etc/nixos /etc/
    }
  3. Download repo to ~/etc/nixos

    {
    mv ~/etc/nixos ~/etc/nixos.backup
    cd ~/etc
    git clone https://github.com/camdenboren/nixos.git
    }
  4. Download Notes to ~/Documents/Repos/Notes
    Not needed on mac or vm's

    {
    cd ~/Documents
    git clone https://github.com/camdenboren/Notes.git
    }
  5. Update hardware UUID's in hardware-config. Use as needed
    UUID and sd* can be found in Gnome Disks

    sudo fdisk /dev/sdb
    sudo mkfs -t ext4 /dev/sdb
    sudo chown camdenboren:users ~/media -R

Rebuild

sudo nixos-rebuild boot --flake ~/etc/nixos#hostName

Freetube config won't be updated until it's been launched
So launch it, clean up config errors, restart

Post-Install

  • VSTs

    • Install windows vsts on main
      Needs ~/Music/music sourced from local server first

      installPlugins
  • macvm UTM setup

    • Initial

      • '+' sign -> virtualize -> linux
      • boot iso image (aarch64)
      • 4g mem
      • default cores
      • don't check opengl acc
      • 64g drive
      • name=NixOS
    • Network

      • Emulated VLAN
    • Before Starting

      chmod u+rw /Users/camdenboren/Library/Containers/com.utmapp.UTM/Data/Documents/NixOS.utm/Data/efi_vars.fd
    • After Install

      • Clear iso from vm page
    • Display

      • upscaling=Linear
      • start in fullscreen
      • use 1920x1200 resolution
      • virtio-gl-pci
  • mac display scaling

    • 32" LG -> 2288 x 1287
  • mac login items

    • Amethyst.app
    • AutoRaise.app
    • LinearMouse.app
    • MullvadVPN.app
    • Rectangle.app
  • mac privacy & security accessibility access

    • Amethyst.app
    • AutoRaise.app
    • BetterDisplay.app
    • LinearMouse.app
    • Rectangle.app

Useful Commands

Nix Management

More commands in ./common/usr/mod/pkgs/bin/coding/bash.nix

  • Rebuilds system based on flake in ~/etc/nixos

    sw
  • Uncomfy version

    sudo nixos-rebuild switch --flake ~/etc/nixos#hostName
  • Updates flake inputs

    update
  • Evaluates flake outputs

    check
  • Lists all current generations

    nix profile history
  • Removes old generations, derivations, etc.

    clean
  • Build a nixpkgs-style derivations
    cd into directory first

    bld
  • Try out a package w/o installing

    run packageName
  • Enter a shell with a package w/o installing

    shell packageName

Audio

  • Basic yabridge commands

    yabridgectl list
    yabridgectl status
    yabridgectl add "~/path/to/winvsts"
    yabridgectl rm "~/path/to/winvsts"
  • Installs windows vsts from ~/.nix-profile/lib/winvst3 via yabridge into ~/.vst3

    installPlugins
  • Installs added windows vsts, purges removed windows vsts

    refreshPlugins
  • Shows audio limits

    ulimit -a

Misc

  • Inspect Home Manager errors

    systemctl status home-manager-camdenboren.service
  • Verify directory integrity

    find . -type f -exec md5sum {} + | LC_ALL=C sort | md5sum >> md5sum.txt
  • Remove Rygel's ignored media files list (log out to take effect, also need: shell sqlite)

    echo "delete from ignorelist;" | sqlite3 ~/.cache/rygel/media-export.db
  • Mac update
    Zoom screen sharing permissions often break

    [!NOTE] homebrew.greedyCasks does not seem to be working, so explicitly passing --greedy is needed (for now)

    sw
    brew upgrade --greedy
    brew cleanup
  • Quickemu (no vpn for windows dl, scripts use opt --status-quo)

    {
    mkdir ~/vm
    cd ~/vm
    quickget windows 10
    quickget nixos 24.05 gnome
    }
  • Reset gsettings xkb (fixes esc <-> caps remap)

    {
    gsettings reset org.gnome.desktop.input-sources xkb-options
    gsettings reset org.gnome.desktop.input-sources sources
    }
  • Reset Git Keychain on macOS

    git credential-osxkeychain erase ⏎
    host=github.com ⏎
    protocol=https ⏎
    ⏎

Gaming

Global

  • Using Steam

  • Launch cmds

    'gamemoderun MANGOHUD=1 %command%'

Games

  • Assetto Corsa

    • GE-Proton8-32

    • Content Manager + CSP: https://github.com/sakaki91/Sakaki-AC-Linux-Guide/

    • Extra cmds (doesn't seem necessary anymore-here for reference)

      protontricks --no-background-wineserver 244210 dotnet48
    • Input settings for Xbox One Controller

      • Speed Sensitivity = 65%
      • Steering Speed = 20%
      • Gamma = 300%
      • Filter = 60%
      • Deadzone = 10%
  • Black Myth: Wukong

    • GE-Proton9-11
  • GTAV Enhanced

    • Proton Experimental
    • Extra notes
      • Also requires SteamDeck=1 launch cmd
      • config saved in hm, manage consistent 60fps
      • config path: ~/.steam/steam/steamapps/compatdata/3240220/pfx/drive_c/users/steamuser/Documents/Rockstar\ Games/GTAV\ Enhanced/settings.xml
  • MCC

    • Proton 8.0-5

ToDo

  • nh vimjoyer thing
  • use aliases instead of scripts for basic stuff
  • services.xserver.xkb.options
  • use firefox options for librewolf
  • integration tests
  • ollama service for macos
  • GTAV Refresh readme cmd
  • custom iso
  • network lf transfer
  • nixified homebrew
  • try vim ext for vsc (unplanned)
  • remap $ and 0 in nvim (unplanned)
  • add git plugin to nvim (unplanned)
  • ssh aliases or whatever
  • maybe pipes

License

GPLv3

About

❄️ NixOS + Darwin Config ❄️

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages