Skip to content

Commit 3418b27

Browse files
committed
feat: Add nix installer (closes #2)
1 parent c3ff1fa commit 3418b27

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ yaci-cli.history
88
logs/
99

1010
.direnv
11+
12+
result

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,21 @@ Built for newcomers and coding agents alike.
1313
1414
## Quick start (pre-release)
1515

16-
Requires a recent Rust toolchain (2024 edition). From a clone:
16+
### Install with Nix (flake)
17+
18+
```bash
19+
# Install the CLI into your profile
20+
nix profile add github:input-output-hk/cardano-init
21+
22+
# Or run it without installing
23+
nix run github:input-output-hk/cardano-init -- --help
24+
```
25+
26+
Then invoke `cardano-init` directly (e.g. `cardano-init --name my-protocol --on-chain aiken`).
27+
28+
### From a clone
29+
30+
Requires a recent Rust toolchain (2024 edition).
1731

1832
```bash
1933
# Interactive guided setup
@@ -123,3 +137,5 @@ cargo test # run tests
123137
cargo fmt # format
124138
cargo clippy # lint
125139
```
140+
141+
A Nix flake is provided. Use `nix develop` for a dev shell with the Rust toolchain, or `nix build .#cardano-init` to build the package.

flake.nix

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
description = "cardano-init — development environment (Rust toolchain)";
2+
description = "cardano-init — scaffolds Cardano protocol projects";
33

44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
55

@@ -10,7 +10,29 @@
1010
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
1111
forAllSystems = f:
1212
nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
13+
14+
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
1315
in {
16+
packages = forAllSystems (pkgs: rec {
17+
cardano-init = pkgs.rustPlatform.buildRustPackage {
18+
pname = "cardano-init";
19+
inherit version;
20+
21+
src = pkgs.lib.cleanSource self;
22+
23+
cargoLock.lockFile = ./Cargo.lock;
24+
25+
meta = with pkgs.lib; {
26+
description = "Scaffolds Cardano protocol projects";
27+
homepage = "https://github.com/input-output-hk/cardano-init";
28+
license = licenses.asl20;
29+
mainProgram = "cardano-init";
30+
};
31+
};
32+
33+
default = cardano-init;
34+
});
35+
1436
devShells = forAllSystems (pkgs: {
1537
default = pkgs.mkShell {
1638
packages = with pkgs; [

0 commit comments

Comments
 (0)