From 1f25fa672feeb7e60ddcb1adbe8fc4dbd2e0b5ff Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Fri, 13 May 2022 21:28:55 -0400 Subject: [PATCH] Add nix flake --- flake.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..849def0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "ucg a configuration language compiler"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + naersk.url = "github:nix-community/naersk"; + flake-compat = { + url = github:edolstra/flake-compat; + flake = false; + }; + }; + + outputs = {self, nixpkgs, flake-utils, rust-overlay, naersk, flake-compat}: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ rust-overlay.overlay ]; + pkgs = import nixpkgs { inherit system overlays; }; + naersk-lib = naersk.lib."${system}"; + in + { + defaultPackage = with pkgs; + naersk-lib.buildPackage rec { + pname = "ucg"; + version = "0.7.2"; + src = ./.; + cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ]; + }; + }); +} \ No newline at end of file