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

add nix flake #30

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
55 changes: 46 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -79,8 +116,8 @@ $ ./target/release/serie
Run `serie` in the directory where your git repository exists.

```
$ cd <your git repository>
$ serie
cd <your git repository>
serie
```

### Options
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
];
};
}
);
};
}