diff --git a/README.md b/README.md index a563e8e..8d47155 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,56 @@ Personally, I found the output from `git log --graph` difficult to read, even wi ### Cargo ``` -$ cargo install --locked serie +cargo install --locked serie ``` ### Arch Linux ``` -$ pacman -S serie +pacman -S serie ``` ### Homebrew (macOS) ``` -$ brew install lusingander/tap/serie +brew install lusingander/tap/serie +``` + +### Nix + +#### Running with Nix + +```sh +$ nix run "github:lusingander/serie" --extra-experimental-features "nix-command +flakes" +``` + +#### Installation with Nix + +Add to flake inputs + +```nix +inputs.serie.url = "github:lusingander/serie"; +``` + +As a home-manager package, + +```nix +{ inputs, pkgs, ... }: + +{ + home.packages = [ inputs.serie.packages.${pkgs.system}.default ]; +} +``` + +As a nix package, + +```nix +{ inputs, pkgs, ... }: + +{ + home.packages = [ inputs.serie.packages.${pkgs.system}.default ]; +} ``` ### Downloading binary @@ -63,10 +100,10 @@ You can download pre-compiled binaries from [releases](https://github.com/lusing If you want to check the latest development version, build from source: ``` -$ git clone https://github.com/lusingander/serie.git -$ cd serie -$ cargo build --release -$ ./target/release/serie +git clone https://github.com/lusingander/serie.git +cd serie +cargo build --release +./target/release/serie ``` > [!NOTE] @@ -79,8 +116,8 @@ $ ./target/release/serie Run `serie` in the directory where your git repository exists. ``` -$ cd -$ serie +cd +serie ``` ### Options diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5e857ba --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..967d2b7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,53 @@ +{ + inputs.nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-unstable"; + }; + + outputs = inputs: + let + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; + in + { + packages = forAllSystems ( + system: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + { + serie = pkgs.rustPlatform.buildRustPackage { + pname = (pkgs.lib.importTOML (./Cargo.toml)).package.name; + version = (pkgs.lib.importTOML (./Cargo.toml)).package.version; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + meta.mainProgram = "serie"; + nativeBuildInputs = [ pkgs.git ]; + }; + default = inputs.self.packages.${system}.serie; + } + ); + devShells = forAllSystems ( + system: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.mkShell { + name = "devShell"; + packages = [ + inputs.self.packages.${system}.serie + pkgs.rustfmt + ]; + }; + } + ); + }; +}