Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix flake #97

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/target
**/*.rs.bk
Cargo.lock
/scratch
docs/book
.vscode/
.vscode/
/result
82 changes: 82 additions & 0 deletions flake.lock

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

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = "Steel";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # We want to use packages from the binary cache
flake-utils.url = "github:numtide/flake-utils";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
flake-utils,
gitignore,
}:
flake-utils.lib.eachDefaultSystem (system: let
inherit (gitignore.lib) gitignoreSource;
pkgs = nixpkgs.legacyPackages.${system};

manifest = pkgs.lib.importTOML ./Cargo.toml;
steel = with pkgs;
rustPlatform.buildRustPackage rec {
pname = manifest.package.name;
version = manifest.workspace.package.version;
src = gitignoreSource ./.;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = [openssl] ++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Security];
nativeBuildInputs = [
pkg-config
];
# Test failing
doCheck = false;
postInstall = ''
mkdir $out/lib
export STEEL_HOME="$out/lib"
pushd cogs
$out/bin/steel install.scm
popd
'';
};
in rec {
packages.steel = steel;
legacyPackages = packages;
defaultPackage = packages.steel;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [cargo];
};
});
}
Loading