Merge pull request #244 from aiken-lang/flake

Flakes
This commit is contained in:
Matthias Benkort 2023-02-07 13:16:30 +01:00 committed by GitHub
commit 7984f6908c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 261 additions and 2 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
Cargo.lock linguist-generated=true merge=binary linguist-vendored
Cargo.nix linguist-generated=true merge=binary linguist-vendored
flake.lock linguist-generated=true merge=binary linguist-vendored

38
.github/workflows/nix.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Nix
on:
push:
branches: [ "main" ]
jobs:
update-cargo-nix:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Setup Cachix
uses: cachix/cachix-action@v12
with:
name: aiken-lang
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Run cargo2nix
shell: bash
run: |
nix run github:cargo2nix/cargo2nix -- -s > Cargo.nix
- name: Create PR
uses: peter-evans/create-pull-request@v4
with:
branch: patch/cargo.nix
delete-branch: true
title: Update Cargo.nix
add-paths: Cargo.nix

View File

@ -22,9 +22,7 @@ For now you'll need rust installed, see [rustup](https://rustup.rs).
In case you have fresh installation of `rustup` you might need to do:
```console
rustup install stable
```
```console
@ -33,6 +31,8 @@ $ cargo install --git https://github.com/aiken-lang/aiken.git
$ aiken --help
```
Alternatively nix builds are available via [flakes](https://aiken-lang.org/getting-started#from-nix-flakes).
### How to use
For more information please see the [user manual](https://aiken-lang.org).

164
flake.lock generated vendored Normal file
View File

@ -0,0 +1,164 @@
{
"nodes": {
"cargo2nix": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1655189312,
"narHash": "sha256-gpJ57OgIebUpO+7F00VltxSEy6dz2x6HeJ5BcRM8rDA=",
"owner": "cargo2nix",
"repo": "cargo2nix",
"rev": "c149357cc3d17f2849c73eb7a09d07a307cdcfe8",
"type": "github"
},
"original": {
"owner": "cargo2nix",
"ref": "release-0.11.0",
"repo": "cargo2nix",
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1671489820,
"narHash": "sha256-qoei5HDJ8psd1YUPD7DhbHdhLIT9L2nadscp4Qk37uk=",
"owner": "numtide",
"repo": "devshell",
"rev": "5aa3a8039c68b4bf869327446590f4cdf90bb634",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1654275867,
"narHash": "sha256-pt14ZE4jVPGvfB2NynGsl34pgXfOqum5YJNpDK4+b9E=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7a20c208aacf4964c19186dcad51f89165dc7ed0",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1643381941,
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"cargo2nix": "cargo2nix",
"devshell": "devshell",
"flake-utils": [
"cargo2nix",
"flake-utils"
],
"nixpkgs": [
"cargo2nix",
"nixpkgs"
]
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"cargo2nix",
"flake-utils"
],
"nixpkgs": [
"cargo2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1653878966,
"narHash": "sha256-T51Gck/vrJZi1m+uTbhEFTRgZmE59sydVONadADv358=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "8526d618af012a923ca116be9603e818b502a8db",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

54
flake.nix Normal file
View File

@ -0,0 +1,54 @@
# This setup relies on 'Cargo.nix' to be up-to-date.
#
# It can be re-generated using:
#
# nix run github:cargo2nix/cargo2nix
#
{
inputs = {
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
flake-utils.follows = "cargo2nix/flake-utils";
nixpkgs.follows = "cargo2nix/nixpkgs";
devshell.url = "github:numtide/devshell";
};
outputs = { self, cargo2nix, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ cargo2nix.overlays.default devshell.overlay ];
};
rustPkgs = pkgs.rustBuilder.makePackageSet {
rustVersion = "1.61.0";
packageFun = import ./Cargo.nix;
};
commonCategory = y: builtins.map (x: x // { category = y; });
packages = {
aiken = (rustPkgs.workspace.aiken { }).bin;
default = packages.aiken;
};
aikenCmds = commonCategory "Aiken Development" [
{
name = "aiken";
help = "Aiken toolchain";
package = packages.aiken;
}
];
in rec {
inherit packages;
devShell = pkgs.devshell.mkShell {
name = "aiken";
motd = ''Aiken
$(type -p menu &>/dev/null && menu)'';
commands = aikenCmds;
};
devShells.aiken = devShell;
}
);
}