Skip to content

kahnwong/nix

Repository files navigation

nix

Flake migration based on https://github.com/sebastiant/dotfiles.

Testing packages

nix-env -iA nixpkgs.ffsend

# uninstall
nix-env --uninstall ffsend

Pre-requisites

Edit ./scripts/apply.sh and set appropriate build command. See flake.nix for available options.

Examples:

# macbook
nix build '.#homeManagerConfigurations.macbookMain.system'

# linux
nix build '.#homeManagerConfigurations.nuc.activationPackage'

File content should look like this:

#!/bin/bash

export NIXPKGS_ALLOW_UNFREE=1
nix build '.#homeManagerConfigurations.macbookMain.system' --experimental-features 'nix-command flakes'  --impure

if [[ $(uname -s) == 'Darwin' ]]; then
    sudo ./result/activate

    elif [[ $(uname -s) == 'Linux' ]]; then
    ./result/activate
fi

Usage

make common

# optional
make common-dev

Mac OS Extras

  1. Login to App Store
  2. make mac

Linux Extras

  • If you need tailscale, caddy, fail2ban, or docker on your server, install it via your system's package manager, since nix requires you set up systemd services explicitly.

  • For nerd fonts, download fonts from here, put them in ~/.local/share/fonts (or ~/.fonts) then run fc-cache -fv.

  • To setup custom mouse buttons: https://github.com/pwr-Solaar/Solaar.

  • If you install linux on mac devices, install gnome-tweaks (sudo apt install gnome-tweaks) to remap super and alt button.

  • Add m4a support to RhythmBox: sudo apt install gstreamer1.0-fdkaac -y

  • Set Flameshot shortcut: https://flameshot.org/docs/guide/key-bindings/#on-ubuntu-and-other-gnome-based-distros. Flatpak path: /var/lib/flatpak/exports/bin/org.flameshot.Flameshot.

  • Set Kitty app launcher: https://sw.kovidgoyal.net/kitty/binary/#desktop-integration-on-linux.

  • Launch CopyQ on startup: /var/lib/flatpak/exports/bin/com.github.hluk.copyq --start-server toggle. On Wayland, add prefix env QT_QPA_PLATFORM=xcb.

    • Set shortcut to alt + shift + v for show the tray menu
  • Start synthingy on startup: flatpak run --command=SyncThingy com.github.zocker_160.SyncThingy.

  • Start dropbox on startup: /var/lib/flatpak/exports/bin/com.dropbox.Client

  • Install mullvad.

  • Fix discord not loading: rm -rf ~/.var/app/com.discordapp.Discord

  • To add Chrome extension desktop shortcut:

    # ~/.local/share/applications/line.desktop
    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=LINE
    GenericName=LINE Chat
    Exec=/var/lib/flatpak/exports/bin/com.google.Chrome --app="chrome-extension://ophjlpahpchlmihnnnihgmmeilfjmjjc/index.html"
    StartupNotify=true
    Categories=Social;
    

Post-installation instructions

Linux: Set default shell

`chsh` and type `$HOME/.nix-profile/bin/fish`

# or this one
`vi /etc/passwd` and specify shell for your user

MacOS: Misc config

  • set tap to single click
  • set three-finger drag

Upgrading

Nix

make update

Brew

brew upgrade

Useful commands

# backup vscode extensions list
code --list-extensions | xargs -L 1 echo code --install-extension > ext_install.sh

# backup vscode config
cp "/users/$USER/Library/Application Support/Code/User/keybindings.json" .
cp "/users/$USER/Library/Application Support/Code/User/settings.json" .