-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2482 from bakaq/flake
Add flake.nix
- Loading branch information
Showing
4 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
src/static_atoms.rs | ||
target/ | ||
|
||
.direnv/ | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
description = "A modern Prolog implementation written mostly in Rust"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { nixpkgs, flake-utils, rust-overlay, ... }: | ||
let | ||
meta = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package; | ||
inherit (meta) name version; | ||
overlays = [ | ||
(import rust-overlay) | ||
(self: super: { | ||
rustToolchainDev = super.rust-bin.stable.latest.default.override { | ||
extensions = [ "rust-src" "rust-analyzer" ]; | ||
}; | ||
rustToolchainNightly = super.rust-bin.selectLatestNightlyWith (toolchain: | ||
toolchain.default.override { | ||
extensions = [ "rust-src" "rust-analyzer" "miri" ]; | ||
} | ||
); | ||
}) | ||
]; | ||
in flake-utils.lib.eachDefaultSystem(system: | ||
let | ||
pkgs = import nixpkgs { inherit system overlays; }; | ||
nativeBuildInputs = with pkgs; [ pkg-config ]; | ||
buildInputs = with pkgs; [ openssl ]; | ||
in | ||
{ | ||
devShells = { | ||
default = pkgs.mkShell { | ||
nativeBuildInputs = nativeBuildInputs; | ||
buildInputs = buildInputs ++ (with pkgs; [ | ||
rustToolchainDev | ||
]); | ||
}; | ||
# For use with Miri and stuff like it | ||
nightly = pkgs.mkShell { | ||
nativeBuildInputs = nativeBuildInputs; | ||
buildInputs = buildInputs ++ (with pkgs; [ | ||
rustToolchainNightly | ||
]); | ||
}; | ||
}; | ||
|
||
packages = rec { | ||
default = scryer-prolog; | ||
scryer-prolog = pkgs.rustPlatform.buildRustPackage { | ||
pname = name; | ||
inherit version; | ||
src = ./.; | ||
nativeBuildInputs = nativeBuildInputs; | ||
buildInputs = buildInputs; | ||
cargoLock = { | ||
lockFile = ./Cargo.lock; | ||
}; | ||
release = true; | ||
}; | ||
}; | ||
} | ||
); | ||
} |