From 0ccf4cb60360433b8f23a0b183fc73994d972e5d Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Wed, 12 Feb 2025 07:07:14 +0100 Subject: [PATCH] Project init --- .gitignore | 4 ++ flake.lock | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c2e6cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# nix build artifact +result +# Vim swap files +*.swp diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ba7279e --- /dev/null +++ b/flake.lock @@ -0,0 +1,113 @@ +{ + "nodes": { + "handlebars-rust-src": { + "flake": false, + "locked": { + "lastModified": 1739333321, + "narHash": "sha256-McP84Thhkp+MkMYYDSi21Kl+oTuQbl0WVNOp6/xZZmI=", + "owner": "pbrinkmeier-almato", + "repo": "handlebars-rust", + "rev": "689af230cfae35ed38d1b2506125a680ffa7ca38", + "type": "github" + }, + "original": { + "owner": "pbrinkmeier-almato", + "ref": "cargo-lock", + "repo": "handlebars-rust", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1736429655, + "narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=", + "owner": "nix-community", + "repo": "naersk", + "rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739138025, + "narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b2243f41e860ac85c0b446eadc6930359b294e79", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1739138025, + "narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b2243f41e860ac85c0b446eadc6930359b294e79", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "handlebars-rust-src": "handlebars-rust-src", + "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": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "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 0000000..9da35f4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + inputs = { + handlebars-rust-src = { + # TODO: Instead of a fork this could be integrated into this repo as a rather simple patch, reducing external depedencies. + url = "github:pbrinkmeier-almato/handlebars-rust/cargo-lock"; + flake = false; + }; + naersk.url = "github:nix-community/naersk/master"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils, naersk, handlebars-rust-src }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + naersk-lib = pkgs.callPackage naersk { }; + in + rec { + packages.handlebars-rust = naersk-lib.buildPackage handlebars-rust-src; + devShell = pkgs.mkShell { + nativeBuildInputs = [ + packages.handlebars-rust + pkgs.imagemagick + pkgs.gnumake + ]; + }; + } + ); +}