From 995cd7079b15399900863ff6689df9a87c7710bf Mon Sep 17 00:00:00 2001 From: uku Date: Thu, 8 May 2025 17:32:55 +0200 Subject: [PATCH] feat: initial commit --- .envrc | 1 + .gitignore | 3 +++ Cargo.lock | 7 +++++++ Cargo.toml | 6 ++++++ flake.lock | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 34 ++++++++++++++++++++++++++++++++++ package.nix | 32 ++++++++++++++++++++++++++++++++ src/main.rs | 3 +++ 8 files changed, 134 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix create mode 100644 src/main.rs diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f094de2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +.direnv/ +result* diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c04fec0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "tyrolienne" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..35804ef --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "tyrolienne" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5b09f7e --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746461020, + "narHash": "sha256-7+pG1I9jvxNlmln4YgnlW4o+w0TZX24k688mibiFDUE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3730d8a308f94996a9ba7c7138ede69c1b9ac4ae", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ad4def1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + }; + + outputs = + { self, flake-parts, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = + { self', pkgs, ... }: + { + packages = { + tyrolienne = pkgs.callPackage ./package.nix { inherit self; }; + default = self'.packages.tyrolienne; + }; + + devShells.default = pkgs.mkShell { + inputsFrom = [ self'.packages.default ]; + }; + }; + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..cc264ef --- /dev/null +++ b/package.nix @@ -0,0 +1,32 @@ +{ + lib, + rustPlatform, + mold-wrapped, + self, +}: +let + cargoToml = lib.importTOML ./Cargo.toml; + rev = self.shortRev or self.dirtyShortRev or "dirty"; +in +rustPlatform.buildRustPackage { + pname = cargoToml.package.name; + version = "${cargoToml.package.version}+git.${rev}"; + + src = self; + + nativeBuildInputs = [ mold-wrapped ]; + + cargoLock.lockFile = ./Cargo.lock; + + RUSTFLAGS = "-C link-arg=-fuse-ld=mold"; + + doCheck = false; + + meta = with lib; { + mainProgram = cargoToml.package.name; + description = "simple tool to convert, upload, and embed videos to zipline"; + homepage = "https://git.uku3lig.net/uku/tyrolienne"; + license = licenses.mpl20; + platforms = platforms.unix; + }; +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}