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

View file

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

View file

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

View file

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