Skip to content

Commit

Permalink
Add Nix flake (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjajaja authored and ulyssa committed Mar 31, 2023
1 parent 274234c commit 463d46b
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ On Arch Linux a package is available in the Arch User Repositories (AUR). To ins
paru iamb-git
```

### Nix / NixOS (flake)

```
nix profile install "github:ulyssa/iamb"
```

## Configuration

You can create a basic configuration in `$CONFIG_DIR/iamb/config.json` that looks like:
Expand Down
94 changes: 94 additions & 0 deletions flake.lock

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

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "iamb";
nixConfig.bash-prompt = "\[nix-develop\]$ ";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
# We only need the nightly overlay in the devShell because .rs files are formatted with nightly.
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustNightly = pkgs.rust-bin.nightly."2023-03-17".default;
in
with pkgs;
{
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "iamb";
version = "0.0.7";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.openssl pkgs.pkgconfig ];
buildInputs = [ pkgs.openssl ];
};
devShell = mkShell {
buildInputs = [
(rustNightly.override { extensions = [ "rust-src" ]; })
pkg-config
cargo-tarpaulin
rust-analyzer
rustfmt
];
};
});
}

0 comments on commit 463d46b

Please sign in to comment.