diff --git a/README.md b/README.md index de29d6c..6e3348b 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b660274 --- /dev/null +++ b/flake.lock @@ -0,0 +1,94 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1679624450, + "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..23a7591 --- /dev/null +++ b/flake.nix @@ -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 + ]; + }; + }); +}