Update from remote and fix conflicts
This commit is contained in:
commit
9713033df7
5 changed files with 44 additions and 75 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,6 +3,10 @@
|
|||
.direnv
|
||||
result
|
||||
db.sqlite
|
||||
<<<<<<< HEAD
|
||||
bridge.sqlite3
|
||||
bridge.sqlite3-shm
|
||||
bridge.sqlite3-wal
|
||||
=======
|
||||
bridge.sqlite3
|
||||
>>>>>>> refs/remotes/origin/main
|
||||
|
|
60
flake.lock
60
flake.lock
|
@ -2,18 +2,16 @@
|
|||
"nodes": {
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1665356181,
|
||||
"narHash": "sha256-ONEzlKL5LN4Y1TRfFY6C39G2Am1YFEjArwMYJONFhhs=",
|
||||
"lastModified": 1697677553,
|
||||
"narHash": "sha256-ozj7HFo/1iQdzZ2U6tHP4QBW59eUbDZ/5HI8lLe9wos=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "d78cb0453b9823d2102f7b22bb98686215462416",
|
||||
"rev": "bc5fa8cd53ef32b9b827f24b993c42a8c4dd913b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -30,11 +28,11 @@
|
|||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1665470981,
|
||||
"narHash": "sha256-ybKBuDqIq4ZDa1QQqkDVDYewUuxPGs3akEWuhEF2ltw=",
|
||||
"lastModified": 1697696548,
|
||||
"narHash": "sha256-653vv/6fwAaLnsm97S+BIAa7OsSlVv9FZIqTzlg4jXQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "0ba1e28f8810df02d9cd20e05b1957a782c7d9d1",
|
||||
"rev": "9d8534763043e7761b6872e6210d3a68ea2f296c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -43,22 +41,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
|
@ -74,33 +56,17 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"lastModified": 1697742333,
|
||||
"narHash": "sha256-USYUnNhWB4MdGQCcE/0lFnR51D2vFr6VqCX8xjTqjRQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"rev": "2e7758c1187c4afc7a90332ff6a396555c276f3b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -109,18 +75,18 @@
|
|||
"inputs": {
|
||||
"crane": "crane",
|
||||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1665438197,
|
||||
"narHash": "sha256-uVkoQqUHyeu1j3DucZDmp0w89WaY91eP/p2BmPFIPaY=",
|
||||
"lastModified": 1697631181,
|
||||
"narHash": "sha256-W1EWCDHVZTAv1Xp4xirCqaYlHZLIWShVVBk2YQIRcXE=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "5d4995191326a3710206d152a710470e196e4466",
|
||||
"rev": "4586a6b26cd5a975a1826c0cfd9004a9bce3d7fd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
48
flake.nix
48
flake.nix
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
|
||||
crane.url = "github:ipetkov/crane";
|
||||
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -15,39 +15,39 @@
|
|||
outputs = { self, nixpkgs, crane, fenix, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
craneLib = crane.lib.${system}.overrideToolchain
|
||||
fenix.packages.${system}.complete.toolchain;
|
||||
pkgs = import nixpkgs {
|
||||
craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.complete.toolchain;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
sqlx-db = pkgs.runCommand "sqlx-db-prepare" {
|
||||
nativeBuildInputs = with pkgs; [ sqlx-cli ];
|
||||
} ''
|
||||
mkdir $out
|
||||
export DATABASE_URL=sqlite:$out/bridge.sqlite3
|
||||
sqlx database create
|
||||
sqlx migrate --source ${./migrations} run
|
||||
'';
|
||||
in
|
||||
{
|
||||
sqlx-db = pkgs.runCommand "sqlx-db-prepare" {
|
||||
nativeBuildInputs = with pkgs; [ sqlx-cli ];
|
||||
} ''
|
||||
mkdir $out
|
||||
export DATABASE_URL=sqlite:$out/bridge.sqlite3
|
||||
sqlx database create
|
||||
sqlx migrate run --source ${./migrations}
|
||||
'';
|
||||
in {
|
||||
|
||||
packages.default = craneLib.buildPackage {
|
||||
src = craneLib.cleanCargoSource ./.;
|
||||
packages.default = craneLib.buildPackage {
|
||||
src = ./.;
|
||||
|
||||
|
||||
DATABASE_URL="sqlite://${sqlx-db}/bridge.sqlite3";
|
||||
BRIDGE_SQLITE_PATH="sqlite://${sqlx-db}/bridge.sqlite3";
|
||||
DATABASE_URL="sqlite://${sqlx-db}/bridge.sqlite3?immutable=true";
|
||||
BRIDGE_SQLITE_PATH="sqlite://${sqlx-db}/bridge.sqlite3?immutable=true";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rust-analyzer
|
||||
pkg-config
|
||||
openssl
|
||||
] ++ (if system == "aarch64-darwin" then [ libiconv darwin.apple_sdk.frameworks.Security ] else [ ]);
|
||||
};
|
||||
] ++ (if system == "aarch64-darwin" then [ libiconv darwin.apple_sdk.frameworks.Security ] else [ ]);
|
||||
};
|
||||
|
||||
nixosModules = {
|
||||
nixosModules = {
|
||||
default = import ./irc-bridge.nix self;
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ let cfg = config.casuallyblue.services.irc-bridge; in {
|
|||
serviceConfig = {
|
||||
User = "cbsite";
|
||||
Group = "users";
|
||||
Restart= "on-failure";
|
||||
Restart= "always";
|
||||
WorkingDirectory = "/var/lib/irc-bridge";
|
||||
RestartSec = "30s";
|
||||
Type = "simple";
|
||||
|
|
|
@ -70,8 +70,7 @@ impl EventHandler for Handler {
|
|||
let nick = command.data.options.first().unwrap().clone().value.unwrap();
|
||||
let nick = nick.as_str().unwrap();
|
||||
|
||||
let nick_c = nick.clone();
|
||||
if let Ok(_) = sqlx::query!("SELECT * FROM users WHERE ircnick=?1", nick_c)
|
||||
if let Ok(_) = sqlx::query!("SELECT * FROM users WHERE ircnick=?1", nick)
|
||||
.fetch_one(&self.database_pool)
|
||||
.await
|
||||
{
|
||||
|
@ -80,7 +79,7 @@ impl EventHandler for Handler {
|
|||
"UPDATE users SET discordid = ?1, discordnick = ?2 WHERE ircnick = ?3",
|
||||
user_id_str,
|
||||
command.user.name,
|
||||
nick_c
|
||||
nick
|
||||
)
|
||||
.execute(&self.database_pool)
|
||||
.await
|
||||
|
|
Loading…
Reference in a new issue