commit c613bba4b867e34c0376f224ac590006c8465674 Author: uku Date: Fri Jul 26 12:28:30 2024 +0200 feat: inital commit 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..e964b35 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# rust +/target + +# nix +result +/.direnv diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3384c06 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "uklient" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d8d2649 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "uklient" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/derivation.nix b/derivation.nix new file mode 100644 index 0000000..bcf70df --- /dev/null +++ b/derivation.nix @@ -0,0 +1,27 @@ +{ + lib, + rustPlatform, + mold-wrapped, + self, +}: +rustPlatform.buildRustPackage { + pname = "uklient"; + version = self.shortRev or self.dirtyShortRev or "dirty"; + + src = self; + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = [mold-wrapped]; + + RUSTFLAGS = "-C link-arg=-fuse-ld=mold"; + + doCheck = false; + + meta = with lib; { + mainProgram = "uklient"; + description = "now better than ever before"; + homepage = "https://git.uku3lig.net/uku/uklient"; + license = licenses.mit; + platforms = platforms.unix; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2940b56 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1721743106, + "narHash": "sha256-adRZhFpBTnHiK3XIELA3IBaApz70HwCYfv7xNrHjebA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "dc14ed91132ee3a26255d01d8fd0c1f5bff27b2f", + "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..35b8835 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/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 = { + lib, + pkgs, + self', + ... + }: { + packages.default = pkgs.callPackage ./derivation.nix {inherit self;}; + + devShells.default = with pkgs; + mkShell { + packages = [clippy rustfmt rust-analyzer]; + inputsFrom = [self'.packages.default]; + RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; + }; + + formatter = pkgs.alejandra; + }; + }; +} 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!"); +}