Move from naersk to crane

This commit is contained in:
Natsu Kagami 2024-02-14 01:19:59 +01:00 committed by Natsu Kagami
parent 46684a2a9e
commit 10129af76a
4 changed files with 57 additions and 41 deletions

72
flake.lock generated
View file

@ -1,47 +1,50 @@
{
"nodes": {
"flake-utils": {
"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"
}
},
"naersk": {
"crane": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1662220400,
"narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=",
"owner": "nix-community",
"repo": "naersk",
"rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3",
"lastModified": 1707685877,
"narHash": "sha256-XoXRS+5whotelr1rHiZle5t5hDg9kpguS5yk8c8qzOc=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2c653e4478476a52c6aa3ac0495e4dea7449ea0e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1701263465,
"narHash": "sha256-lNXUIlkfyDyp9Ox21hr+wsEf/IBklLvb6bYcyeXbdRc=",
"lastModified": 1707650010,
"narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "50aa30a13c4ab5e7ba282da460a3e3d44e9d0eb3",
"rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6",
"type": "github"
},
"original": {
@ -53,10 +56,25 @@
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,8 +2,10 @@
description = "A discord bot for D Tuyn Tng Hp server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig = {
@ -14,11 +16,10 @@
(system:
let
pkgs = import nixpkgs { inherit system; };
naersk = pkgs.callPackage inputs.naersk { };
craneLib = inputs.crane.lib.${system};
in
rec {
packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; };
packages.youmubot = pkgs.callPackage ./package.nix { inherit craneLib; };
defaultPackage = packages.youmubot;
@ -45,7 +46,7 @@
}) // {
overlays.default = final: prev: {
youmubot = final.callPackage ./package.nix {
naersk = final.callPackage inputs.naersk { };
craneLib = inputs.crane.lib.${final.system};
};
};
# module

View file

@ -1,4 +1,4 @@
{ naersk
{ craneLib
, lib
, stdenv
, pkg-config
@ -16,12 +16,12 @@ let
++ lib.optional enableOsu "--features=osu"
);
in
naersk.buildPackage {
name = "youmubot";
craneLib.buildPackage {
pname = "youmubot";
version = "0.1.0";
root = ./.;
cargoBuildOptions = opts: opts ++ [ "--package youmubot" ] ++ featureFlags;
src = ./.;
cargoExtraArgs = builtins.concatStringsSep " " ([ "--locked" "--package youmubot" ] ++ featureFlags);
buildInputs = [
openssl

View file

@ -2,9 +2,6 @@ pub mod discord;
pub mod models;
pub mod request;
#[cfg(test)]
mod test;
use models::*;
use request::builders::*;
use request::*;