From a80525b06d200a4c5130e9da3370498c38248bf7 Mon Sep 17 00:00:00 2001 From: eiiko6 Date: Mon, 1 Dec 2025 20:35:44 +0100 Subject: [PATCH] added nix flake for build --- .gitignore | 1 + answers.json | 15 -------- flake.lock | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 57 +++++++++++++++++++++++++++++++ 4 files changed, 154 insertions(+), 15 deletions(-) delete mode 100644 answers.json create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index ea8c4bf..d787b70 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/result diff --git a/answers.json b/answers.json deleted file mode 100644 index 9956459..0000000 --- a/answers.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "timestamp": "2025-12-01T17:58:25.865893826Z", - "answers": { - "about_you": "", - "password": "!Y%5#yH^QcZmwHR", - "age": "", - "favorite_color": "", - "email": "foobar@mail.com", - "website": "", - "full_name": "", - "contact_number": "" - } - } -] \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4472b39 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1764517877, + "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1764557621, + "narHash": "sha256-kX5PoY8hQZ80+amMQgOO9t8Tc1JZ70gYRnzaVD4AA+o=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "93316876c2229460a5d6f5f052766cc4cef538ce", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "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 0000000..869c1cd --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "Form Generator - Generate a small form website to collect answers, from a TOML config file. "; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ rust-overlay.overlays.default ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + rust = pkgs.rust-bin.stable.latest.default; + openssl = pkgs.openssl; + in + { + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = "form-generator"; + version = "0.1.0"; + + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + + nativeBuildInputs = [ + rust + pkgs.pkg-config + ]; + + buildInputs = [ + openssl + ]; + + OPENSSL_LIB_DIR = "${openssl.out}/lib"; + OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; + PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig"; + }; + + devShells.default = pkgs.mkShell { + packages = [ + rust + pkgs.cargo + pkgs.rust-analyzer + pkgs.pkg-config + openssl + ]; + OPENSSL_DIR = openssl.dev; + PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig"; + }; + }); +} +