diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..104072b --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1724479785, + "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724811750, + "narHash": "sha256-PvhVgQ1rm3gfhK7ts4emprhh/KMkFwXogmgsQ3srR7g=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "6a1c4915dca7149e7258d8c7f3ac634d8c65f6c6", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b5a7705 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, rust-overlay, ... }: + let + # System types to support. + supportedSystems = [ + "x86_64-linux" + ]; + + forAllSystems = function: nixpkgs.lib.genAttrs supportedSystems + (system: function (import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + })); + in + { + devShells = forAllSystems + (pkgs: { + default = import ./shell.nix { + inherit pkgs; + additionalBuildInputs = [ + (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)) + ]; + }; + }); + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c3bb1f7 --- /dev/null +++ b/shell.nix @@ -0,0 +1,12 @@ +{ pkgs ? import { }, additionalBuildInputs ? [ ] }: + +with pkgs; + +mkShell rec { + nativeBuildInputs = [ + pkg-config + openssl + ]; + buildInputs = additionalBuildInputs; + LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; +}