Skip to content

Commit

Permalink
nix flake + bumping dep versions
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Oct 14, 2024
1 parent 7d16857 commit e109653
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ cli = []
full = ["telegram", "string", "cli"]

[dependencies]
teloxide = { version = "0.12", optional = true }
teloxide = { version = "0.13", optional = true }
url = { version = "2.5.0", optional = true }
tokio = { version = "1.36.0", optional = true }
async-trait = { version = "0.1.77", optional = true }
tokio = { version = "1", optional = true }
async-trait = { version = "0.1", optional = true }
toml = { version = "0.8", optional = true }
thiserror = "1"

[dev-dependencies]
serde = "1.0.196"
serde_json = "1.0.113"
serde = "1"
serde_json = "1"

[package.metadata.docs.rs]
all-features = true
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "Library of Orzklv";

inputs = {
# Too old to work with most libraries
# nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";

# Perfect!
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";

# The flake-utils library
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{ nixpkgs
, flake-utils
, ...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
# Nix script formatter
formatter = pkgs.nixpkgs-fmt;

# Development environment
devShells.default = import ./shell.nix { inherit pkgs; };
});
}
3 changes: 3 additions & 0 deletions nohup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zed is already running
2024-10-14 20:14:27.398 zed[7057:28144525] +[IMKClient subclass]: chose IMKClient_Modern
2024-10-14 20:14:27.398 zed[7057:28144525] +[IMKInputSession subclass]: chose IMKInputSession_Modern
56 changes: 56 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ pkgs ? import <nixpkgs> {} }:
let
getLibFolder = pkg: "${pkg}/lib";
getFramwork = pkg: "${pkg}/Library/Frameworks";
darwinOptions = if pkgs.stdenv.isDarwin then ''
-F${(getFramwork pkgs.darwin.apple_sdk.frameworks.Security)}
-F${(getFramwork pkgs.darwin.apple_sdk.frameworks.CoreFoundation)}
-F${(getFramwork pkgs.darwin.apple_sdk.frameworks.CoreServices)}
-F${(getFramwork pkgs.darwin.apple_sdk.frameworks.SystemConfiguration)}
'' else "";
in
pkgs.stdenv.mkDerivation {
name = "orzklv";

nativeBuildInputs = with pkgs; [
# LLVM & GCC
gcc
cmake
gnumake
pkg-config
llvmPackages.llvm
llvmPackages.clang

# Hail the Nix
nixd
nixpkgs-fmt

# Launch scripts
just

# Rust
rustc
cargo
clippy
cargo-watch
rust-analyzer
];

buildInputs = with pkgs; [
openssl
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.SystemConfiguration
];

# Set Environment Variables
RUST_BACKTRACE = 1;
NIX_LDFLAGS = "-L${(getLibFolder pkgs.libiconv)} ${darwinOptions}";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
(getLibFolder pkgs.gcc)
(getLibFolder pkgs.libiconv)
(getLibFolder pkgs.llvmPackages.llvm)
];
}
2 changes: 1 addition & 1 deletion src/telegram/i18n/i18n.rs → src/telegram/i18n/inter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::language::Language;
use std::collections::HashMap;
use std::io::BufRead;
// use std::io::BufRead;
use crate::telegram::i18n::I18nError;

#[derive(Debug, Clone, Default)]
Expand Down
2 changes: 1 addition & 1 deletion src/telegram/i18n/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod i18n;
pub mod inter;
pub mod language;

use thiserror::Error;
Expand Down
3 changes: 2 additions & 1 deletion src/telegram/keyboard.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::fmt::Debug;
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup, WebAppInfo};
use teloxide::types::WebAppInfo;
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup};
use url::Url;

#[derive(Clone, Debug, PartialEq)]
Expand Down

0 comments on commit e109653

Please sign in to comment.