diff --git a/.gitignore b/.gitignore index 79a8fa409..e4ac3801b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /target **/*.rs.bk -Cargo.lock /scratch docs/book -.vscode/ \ No newline at end of file +.vscode/ +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..6280488f8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694102001, + "narHash": "sha256-vky6VPK1n1od6vXbqzOXnekrQpTL4hbPAwUhT5J9c9E=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "9e21c80adf67ebcb077d75bd5e7d724d21eeafd6", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1699099776, + "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..ee806e03c --- /dev/null +++ b/flake.nix @@ -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]; + }; + }); +}