Skip to content

Commit

Permalink
Add nix flake (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlip authored Nov 11, 2023
1 parent 90784c0 commit 9a7b26e
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 2 deletions.
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];
};
});
}

0 comments on commit 9a7b26e

Please sign in to comment.