Skip to content

bycEEE/crib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bycEEE Nix Home

NixOS logo NixOS logo

Status

Currently learning Nix, NixOS, Home Manager, Flakes, etc. This repo is intended for personal use only since I have no clue what I'm doing. Currently based on kclejeune/system and pieces slammed together from inspirations.

Features

Main

  • Manage my main user across WSL and MacOS.
  • Uses 1Password SSH Agent.
  • Personal and work profiles.
  • Use DevBox for individual projects.

Windows

  • Utilises WSL to manage Windows 11 machine host.
  • Manage host applications via bash scripts for winget and scoop (WIP).
  • Configure host applications (WIP).
  • Manage WSL GUI applications and have them show in host Start menu.

MacOS

  • Configure basic MacOS default preferences (WIP).
  • homebrew package management without NixOS.
  • Bootleggedly manages application configuration for non nixpkgs applications such as iTerm2 and Karabiner.

Installation

Prerequisites

WSL Setup

  • Install and set up Ubuntu:

    wsl --install
    wsl -d Ubuntu # Start up Ubuntu
    wsl -s Ubuntu # Make default distribution
  • Configure %USERPROFILE%\.wslconfig to take advantage of mirrored mode monitoring:

    [wsl2]
    memory=24GB
    networkingMode=mirrored
    
    [experimental]
    sparseVhd=true
  • Verify WSL networking mode:

    ❯ wslinfo --networking-mode
    mirrored
  • Install Nix and Home Manager:

    # Determinate Systems Nix Installer
    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --extra-conf "trusted-users = root $USER"
    
    # Create directory
    mkdir -p ~/crib
    cd ~/crib
    
    # Build and activate
    nix build "github:bycEEE/crib#homeConfigurations.$USER@$(hostname -s).activationPackage" && ./result/activate
    
    # Clone the actual repo
    git clone git@github.com:bycEEE/crib.git .
    
    # Add nix installed shells to system (may have to edit files manually)
    # sudo echo "$HOME/.nix-profile/bin/bash" >> /etc/shells
    sudo echo "$HOME/.nix-profile/bin/zsh" >> /etc/shells
    
    # Change shell
    chsh -s $HOME/.nix-profile/bin/zsh
  • To enable GUI apps in Windows Start Menu:

    sudo ln -s $HOME/.nix-profile/share/applications /usr/local/share/applications
    sudo ln -s $HOME/.nix-profile/share/icons /usr/local/share/icons
  • Subsequent runs:

    just apply

MacOS Setup

  • If coming from brew:

    # Backup brew packages
    brew list -1 > .brew.backup
    brew bundle dump
    
    # Uninstall all packages
    brew uninstall --force $(brew list)
    
    # Fix broken links and clean up
    brew doctor
    brew cleanup
    brew cleanup -s
  • Install brew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew analytics off
  • Install Nix and Home Manager:

    Note: Haven't tried testing on a fresh system.

    Download just binary.

    # Determinate Systems Nix Installer
    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --extra-conf "trusted-users = root bchoy brian.choy icey"
    
    git clone git@github.com:bycEEE/crib.git ~/crib
    just build
    
    # Add nix installed shells to system (may have to edit files manually)
    # sudo echo "$HOME/.nix-profile/bin/bash" >> /etc/shells
    sudo echo "$HOME/.nix-profile/bin/zsh" >> /etc/shells
    
    # Change shell
    chsh -s "$HOME/.nix-profile/bin/zsh"

Install krew plugins

Not sure how to install via Nix so maintaining a manual list here:

  • rakkess: Review Access - kubectl plugin to show an access matrix for server resources kubectl krew install access-matrix.
  • neat: Remove clutter from Kubernetes manifests to make them more readable. kubectl krew install neat
  • ksniff: A kubectl plugin that utilize tcpdump and Wireshark to start a remote capture on any pod in your Kubernetes cluster. kubectl krew install sniff
  • outdated: kubectl outdated is a kubectl plugin that displays all out-of-date images running in a Kubernetes cluster. kubectl krew install outdated

  • kubectl-kubesec: This is a kubectl plugin for scanning Kubernetes pods, deployments, daemonsets and statefulsets with kubesec.io. kubectl krew install kubesec-scan

  • kubectl-node-shell: Start a root shell in the node's host OS running. Uses an alpine pod with nsenter for Linux nodes and a HostProcess pod with PowerShell for Windows nodes.

    kubectl krew index add kvaps https://github.com/kvaps/krew-index
    kubectl krew install kvaps/node-shell

Resources

Learning Nix

Useful Links

Inspirations

TODO

  • Move 1password logic outside of zsh and ssh files, eg. kclejeune/system 1password.
  • Move WSL logic outside of individual files.
  • Fix Windows GitHub download script.
  • Add atuin and croc relay.
  • Maybe use sops instead of agenix.
  • Maybe use 1password to generate credentials such as on awscli2.
  • Add bandwhich tool for windows.
  • Add pentesting tools that exist in default.nix in pentesting.nix as well.
  • Separate out tools into separate folders and consolidate reundant home/default.nix.
  • Fix broken agenix secrets.
  • Copy iTerm2 and other MacOS configs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published