Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide install script for Linux and Mac #9

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ concurrency:
cancel-in-progress: true

jobs:
check:
name: check
check-linux-macos:
name: "check linux and macos"
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -61,9 +61,25 @@ jobs:
command: run
args: --release --features user-doc -- user-doc ./docs

check-installer:
name: "check installer"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run installer
run: ./install.sh -v

- name: Run binary
run: rnk --version

ci:
runs-on: ubuntu-latest
needs: [check, check-win]
needs: [check-linux-macos, check-win, check-installer]
steps:
- name: Aggregate of lint, and all tests
run: echo "ci passed"
14 changes: 14 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(
import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{src = ./.;}
)
.defaultNix
67 changes: 2 additions & 65 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,9 @@ This is the documentation for the command line interface to the Renku
platform.


## Installation
## Contents

The binary name for the renku-cli is `rnk`.

### Manual Download

You can download the binary for your platform from the [release
page](https://github.com/SwissDataScienceCenter/renku-cli/releases/latest).

If you run on MacOS, download the `*-darwin` binary. If you run some
form of linux, try `*-amd64` or `*-aarch64`. Last for Windows use the
`*-windows` binary.

Once downloaded, you can simply execute it without any further
installation step.

#### shell completion

For convenience, the cli tool can generate completion commands for
several shells. You can use it for inclusion in your `.bashrc` or
similar setups.

For example:

``` bash rnk:silent
rnk shell-completion --shell bash
```

will generate the completions for bash. These have to be "sourced"
into into your current shell:

``` bash
eval "$(rnk shell-completion --shell bash)"
```

Add this line to your `.bashrc` to have these completions available
when you enter bash.

With this enabled, when you type `rnk <tab>` you will be presented
with possible options, that are narrowed down the more letters you
type.

### Nix User

If you are a nix user and have flakes enabled, you can install rnk
from this repository:

```
nix profile install github:SwissDatascienceCenter/renku-cli
```

If you want to try it out without installing:
```
nix run github:SwissDatascienceCenter/renku-cli
```

When installing the package via `install` or including it into your
NixOS configuration, the shell completions are already installed.

### Debian/Ubuntu User

TODO

### Mac Homebrew

TODO
- [Installation](./install.md)

## Getting started

Expand Down
144 changes: 144 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Install

The binary name for the renku-cli is `rnk`.

## Manual

You can download the binary for your platform from the [release
page](https://github.com/SwissDataScienceCenter/renku-cli/releases/latest).

If you run on MacOS, download the `*-darwin` binary. If you run some
form of linux, try `*-amd64` or `*-aarch64`. Last for Windows use the
`*-windows` binary.

Once downloaded, you can simply execute it without any further
installation step.

## Nix and NixOS

### Nix

If you are a [nix](https://nixos.org/nix) user and have flakes
enabled, you can install rnk from this repository:

```
nix profile install github:SwissDatascienceCenter/renku-cli/<version>
```

If `/<version>` is omitted, it will install the current development
version right off the `main` branch.

If you want to try it out without installing:
```
nix run github:SwissDatascienceCenter/renku-cli
```

When installing the package via `install` or including it into your
NixOS configuration, the shell completions are already installed.

### NixOS

When you are a NixOS user, you can include the flake and select the
provided package in your `configuration.nix`. Here is an example:

``` nix
{
description = "Example rnk for NixOS";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
rnk.url = "github:SwissDataScienceCenter/renku-cli/<version>";
};

outputs = inputs @ {
self,
nixpkgs,
rnk,
...
}: let
system = "x86_64-linux";

overlays = [
# ... more of your overlays
rnk.overlays.default
];

pkgsBySystem = system:
import nixpkgs {
inherit system;
inherit overlays;
};

modules = [
{
# build as a container to remove the need for specific
# filesystems
boot.isContainer = true;
system.stateVersion = "24.05";
# set pkgs to be the one with overlays applied
nixpkgs.pkgs = pkgsBySystem system;
}

# select rnk as a package in your modules
({pkgs, ...}: {environment.systemPackages = [pkgs.rnk];})
];
in {
nixosConfigurations.mymachine = nixpkgs.lib.nixosSystem {
inherit system modules;
specialArgs = inputs;
};
};
}
```

The above configuration can be build into a NixOS system:
``` bash
nix build .#nixosConfigurations.mymachine.config.system.build.toplevel
```

If you are not using flakes, you can import the derivation from
`default.nix`.

You can omit `/<version>` in the input url, if you want to install
latest development version, otherwise replace `<version>` with an
existing tag.

## Linux and Mac User

The convenient way is to use the `installer.sh` script that is
provided from this repository. It will download the correct binary
from the release page and put it in `/usr/local/bin` on your system.
It requires `curl` and `sudo` to copy the binary to `/usr/local/bin`.

```
curl -sfSL https://raw.githubusercontent.com/SwissDataScienceCenter/renku-cli/main/install.sh | bash
```

If you want to uninstall, simply remove the `/usr/local/bin/rnk` file.


## Shell Completion

For convenience, the cli tool can generate completion commands for
several shells. You can use it for inclusion in your `.bashrc` or
similar setups.

For example:

``` bash rnk:silent
rnk shell-completion --shell bash
```

will generate the completions for bash. These have to be "sourced"
into into your current shell:

``` bash
eval "$(rnk shell-completion --shell bash)"
```

Add this line to your `.bashrc` to have these completions available
when you enter bash.

With this enabled, when you type `rnk <tab>` you will be presented
with possible options, that are narrowed down the more letters you
type.
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,10 @@
fenixToolChain.rustfmt
];
};
});
})
// {
overlays.default = final: prev: {
rnk = self.packages.${prev.system}.default;
};
};
}
Loading
Loading