diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..43cecf13 --- /dev/null +++ b/flake.lock @@ -0,0 +1,112 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "owner": "nmattia", + "repo": "naersk", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", + "type": "github" + }, + "original": { + "owner": "nmattia", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1702206697, + "narHash": "sha256-vE9oEx3Y8TO5MnWwFlmopjHd1JoEBno+EhsfUCq5iR8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "29d6c96900b9b576c2fb89491452f283aa979819", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1702151865, + "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-compat": "flake-compat", + "naersk": "naersk", + "nixpkgs": "nixpkgs_2", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..bab66fcb --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Development environment"; + + inputs = { + naersk = { url = "github:nmattia/naersk/master"; }; + nixpkgs = { url = "github:NixOS/nixpkgs/nixos-unstable"; }; + utils = { url = "github:numtide/flake-utils"; }; + flake-compat = { + url = github:edolstra/flake-compat; + flake = false; + }; + }; + + outputs = { self, nixpkgs, utils, naersk, ... }: + utils.lib.eachDefaultSystem (system: + let + inherit (nixpkgs.lib) optional; + naersk-lib = pkgs.callPackage naersk { }; + pkgs = import nixpkgs { inherit system; }; + libPath = with pkgs; lib.makeLibraryPath [ + openssl + ]; + in + { + defaultPackage = naersk-lib.buildPackage { + src = ./.; + doCheck = false; + pname = "uvm"; + nativeBuildInputs = [ pkgs.makeWrapper pkgs.pkg-config ]; + buildInputs = with pkgs; [ + p7zip + glibc + openssl + ]; + postInstall = '' + wrapProgram "$out/bin/uvm" --prefix LD_LIBRARY_PATH : "${libPath}" + ''; + }; + + defaultApp = utils.lib.mkApp { + drv = self.defaultPackage."${system}"; + }; + + devShell = with pkgs; mkShell { + + buildInputs = [ + cargo + cargo-insta + pre-commit + rust-analyzer + rustPackages.clippy + rustc + rustfmt + openssl + pkg-config + ]; + + RUST_SRC_PATH = rustPlatform.rustLibSrc; + LD_LIBRARY_PATH = libPath; + }; + + }); +} + diff --git a/shell_.nix b/shell_.nix new file mode 100644 index 00000000..64d5b582 --- /dev/null +++ b/shell_.nix @@ -0,0 +1,19 @@ +{ nixpkgs ? import { }}: + +let + rust_overlay = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"); + pkgs = import { overlays = [ rust_overlay ]; }; +in +with pkgs; +mkShell { + buildInputs = [ + rust-bin.stable.latest.default + rust-analyzer + openssl + pkg-config + p7zip + + ]; + + RUST_BACKTRACE = 1; + } \ No newline at end of file