Git Product home page Git Product logo

tsirysndr / crosup Goto Github PK

View Code? Open in Web Editor NEW
46.0 2.0 3.0 1.05 MB

Quickly setup your development environment on your Chromebook/ChromeOS , MacOS or any Linux distribution ๐Ÿง โ„๏ธ ๐Ÿ’ป ๐Ÿš€ โœจ

License: MIT License

Rust 85.98% Shell 1.20% Nix 5.37% TypeScript 7.45%
chromebook chromeos chromeos-flex command-line-tool docker homebrew devbox flox nix debian containers vm environment-manager package-manager

crosup's Introduction

Crosup ๐Ÿง ๐Ÿ’ป ๐Ÿš€ โœจ

release License: MIT

Crosup is a CLI tool to help you quickly setup your development environment on a new Chromebook (ChromeOS) or any Linux distribution. It is designed to be simple and easy to use.

โœจ Features

  • Compatible with ChromeOS, Debian-based Linux, OpenSUSE, Fedora, RedHat, CentOS, Alpine and more!
  • Detects your OS and installs the appropriate tools
  • HCL/TOML configuration file
  • Installs developer tools like docker, nix, devbox, homebrew, flox, fish, vscode, ble.sh, atuin, tig, fzf, httpie, kubectl, minikube, tilt, zellij, ripgrep, fd, exa, bat, glow, devenv and more!

๐Ÿšš Installation

bash <(curl -sSL https://raw.githubusercontent.com/tsirysndr/crosup/master/install.sh)

Compiling from source:

git clone https://github.com/tsirysndr/crosup.git
cd crosup
nix develop --experimental-features "nix-command flakes"
cargo install --path crates/cli

๐Ÿ“ฆ Supported OS

  • ChromeOS (Debian Container)
  • Debian-based Linux
  • OpenSUSE
  • Fedora
  • RedHat
  • CentOS
  • Alpine
  • Arch
  • Gentoo
  • Slackware

๐Ÿš€ Usage

             ______                __  __
            / ____/________  _____/ / / /___
           / /   / ___/ __ \/ ___/ / / / __ \
          / /___/ /  / /_/ (__  ) /_/ / /_/ /
          \____/_/   \____/____/\____/ .___/
                                    /_/

Quickly install your development tools on your new Chromebook or any Linux distribution

USAGE:
    crosup [SUBCOMMAND]

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    add        Add a new tool to the configuration file
    diff       Show the difference between the current configuration and the previous one
    help       Print this message or the help of the given subcommand(s)
    history    Show the change history of the configuration file
    init       Generate a default configuration file
    install    Install developer tools, e.g. docker, nix, devbox, homebrew, fish, vscode, ble.sh
                   ...
    search     Search for a package in the nixpkgs repository

๐Ÿ› ๏ธ Minimal Configuration

This is a minimal configuration file to install vim and git:

# Crosfile.toml
packages = [
  "vim",
  "git"
]

When you run crosup install, it will detect your OS and install the appropriate tools using nix home-manager on your system.

๐Ÿ“ Advanced Configuration

Crosup uses a configuration file to determine which tools to install. The default configuration is embedded in the binary, but you can generate a default configuration file (Crosfile.hcl) using the crosup init subcommand, you can specify the default format using the --toml flag.

Example of a Crosfile.toml (crosup init --toml) for a Debian-based system:

# Crosfile.toml
[brew.install.pkg.minikube]
preinstall = "sudo apt-get install -y qemu-system libvirt-clients libvirt-daemon-system"
postinstall = """
sudo sed -i 's/#user = \"root\"/user = \"root\"/g' /etc/libvirt/qemu.conf
            sudo sed -i 's/#group = \"root\"/group = \"root\"/g' /etc/libvirt/qemu.conf
            sudo sed -i 's/#dynamic_ownership = 1/dynamic_ownership = 0/g' /etc/libvirt/qemu.conf
            sudo sed -i 's/#remember_owner = 1/remember_owner = 0/g' /etc/libvirt/qemu.conf"""

[brew.install.pkg.tilt]

[brew.install.pkg.kubernetes-cli]
version_check = "kubectl"

[brew.install.pkg.bat]

[brew.install.pkg.direnv]

[brew.install.pkg.exa]

[brew.install.pkg.fd]

[brew.install.pkg.fzf]

[brew.install.pkg.fish]

[brew.install.pkg.glow]

[brew.install.pkg.httpie]
version_check = "http"

[brew.install.pkg.tig]

[brew.install.pkg.zellij]

[brew.install.pkg.zoxide]

[brew.install.pkg.ripgrep]
version_check = "rg"

[brew.install.pkg.neovim]
version_check = "nvim"

[git.install.repo.blesh]
url = "https://github.com/akinomyoga/ble.sh.git"
install = "make -C ble.sh install PREFIX=~/.local"
preinstall = "sudo apt-get install -y gawk build-essential"
postinstall = "echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc"
install_check = "~/.local/share/blesh/ble.sh"
recursive = true
depth = 1
shallow_submodules = true

[nix.install.pkg.flox]
impure = true
experimental_features = "nix-command flakes"
accept_flake_config = true
preinstall = "echo 'extra-trusted-substituters = https://cache.floxdev.com' | sudo tee -a /etc/nix/nix.conf && echo 'extra-trusted-public-keys = flox-store-public-0:8c/B+kjIaQ+BloCmNkRUKwaVPFWkriSAd0JJvuDu4F0=' | sudo tee -a /etc/nix/nix.conf"
flake = "github:flox/floxpkgs#flox.fromCatalog"

[nix.install.pkg.cachix]
flake = "github:cachix/cachix"

[nix.install.pkg.devenv]
accept_flake_config = true
preinstall = """
echo \"trusted-users = root $USER\" | sudo tee -a /etc/nix/nix.conf
sudo pkill nix-daemon
cachix use devenv"""
flake = "github:cachix/devenv/latest"
depends_on = ["cachix"]

[curl.install.script.devbox]
url = "https://get.jetpack.io/devbox"
shell = "bash"
depends_on = ["nix"]

[curl.install.script.devbox.env]
FORCE = "1"

[curl.install.script.atuin]
url = "https://raw.githubusercontent.com/ellie/atuin/main/install.sh"
shell = "bash"

[curl.install.script.nix]
url = "https://install.determinate.systems/nix"
enable_sudo = true
args = "install --no-confirm"

[curl.install.script.homebrew]
url = "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
postinstall = "echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.bashrc"
version_check = "brew"
shell = "bash"

[curl.install.script.homebrew.env]
NONINTERACTIVE = "true"

[apt.install.pkg.docker]
gpg_key = "https://download.docker.com/linux/debian/gpg"
gpg_path = "/etc/apt/keyrings/docker.gpg"
setup_repository = "echo \"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \"$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null"
apt_update = true
packages = [
    "docker-ce",
    "docker-ce-cli",
    "containerd.io",
    "docker-buildx-plugin",
    "docker-compose-plugin",
]
depends_on = [
    "ca-certificates",
    "curl",
    "gnupg",
]
postinstall = "sudo usermod -aG docker $USER && newgrp docker"

[apt.install.pkg.vscode]
url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"
version_check = "code"

๐Ÿš€ As a GitHub Action

You can use crosup as a GitHub Action to install developer tools on your CI/CD pipeline.

name: Setup Crosup
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  workflow_dispatch:

jobs:
  setup-crosup:
    runs-on: ubuntu-latest
    continue-on-error: true
    steps:
      - name: Install Nix
        uses: DeterminateSystems/nix-installer-action@v4
      - name: Setup Crosup
        uses: tsirysndr/setup-crosup@v1
        with:
          version: 'v0.5.0'
          # Add packages to install here
          packages: |
            deno
            zig
      - name: Verify Crosup
        run: crosup --version
      - name: Verify Deno
        run: deno --version
      - name: Verify Zig
        run: zig version

See action.yml for the full documentation for this action's inputs and outputs.

๐Ÿค Contributing

Contributions, issues and feature requests are welcome! See CONTRIBUTING for more information.

๐Ÿ“ License

MIT

crosup's People

Contributors

tsirysndr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

crosup's Issues

Install.sh failure on linux, extracted to different folder

chmod: cannot access '/tmp/crosup': No such file or directory
mv: cannot stat '/tmp/crosup': No such file or directory
root@ip-10-0-101-145:/tmp# tar -vxzf crosup_v0.5.1_x86_64-unknown-linux-gnu.tar.gz 
target/x86_64-unknown-linux-gnu/release/crosup
root@ip-10-0-101-145:/tmp# tar -vxzf crosup_v0.5.1_aarch64-unknown-linux-gnu.tar.gz 
target/aarch64-unknown-linux-gnu/release/crosup
root@ip-10-0-101-145:/tmp# tar -vxzf crosup_v0.5.1_x86_64-apple-darwin.tar.gz 
crosup
root@ip-10-0-101-145:/tmp# tar -vxzf crosup_v0.5.1_aarch64-apple-darwin.tar.gz 
crosup
root@ip-10-0-101-145:/tmp# tree target/
target/
โ”œโ”€โ”€ aarch64-unknown-linux-gnu
โ”‚   โ””โ”€โ”€ release
โ”‚       โ””โ”€โ”€ crosup
โ””โ”€โ”€ x86_64-unknown-linux-gnu
    โ””โ”€โ”€ release
        โ””โ”€โ”€ crosup

5 directories, 2 files

support for container and non-systemd

Hi, I'm new to Nix, and I find the determinate Nix installer somewhat awkward to deal with within a container. I always use the following to install for a single user, but I'm unsure if it's the best solution:

# Setup Nix
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
curl -L https://nixos.org/nix/install | sh

When crosup installing Flox, it causes an issue because it depends on the daemon. Is it due to [nix.install.pkg] being incompatible with the method above?

crosup install devenv
-> Checking if Nix is already installed
   Nix is /home/snoremote/.nix-profile/bin/nix
-> Nix is already installed, skipping
-> Checking if Cachix is already installed
bash: line 1: type: cachix: not found
-> Failed to check Cachix version
-> ๐Ÿšš Installing Cachix
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
-> Checking if Devenv is already installed
bash: line 1: type: devenv: not found
-> Failed to check Devenv version
-> ๐Ÿšš Installing Devenv
-> Running preinstall command:
echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
sudo pkill nix-daemon
cachix use devenv
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory

It's the same with Flox, but it works with the official command line for a personal profile:

crosup install flox
-> Checking if Nix is already installed
   Nix is /home/snoremote/.nix-profile/bin/nix
-> Nix is already installed, skipping
-> Checking if Flox is already installed
bash: line 1: type: flox: not found
-> Failed to check Flox version
-> ๐Ÿšš Installing Flox
-> Running preinstall command:
echo 'extra-trusted-substituters = https://cache.floxdev.com' | sudo tee -a /etc/nix/nix.conf && echo 'extra-trusted-public-keys = flox-store-public-0:8c/B+kjIaQ+BloCmNkRUKwaVPFWkriSAd0JJvuDu4F0=' | sudo tee -a /etc/nix/nix.conf
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory

I apologize if it's a bit incomprehensible. My question is: Is the above method a viable option for a container?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.