mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-10 04:30:29 +00:00
Use a common Rust version for overlay and package
This commit is contained in:
parent
51fa34a7bf
commit
7d65a9de6a
1 changed files with 42 additions and 38 deletions
80
flake.nix
80
flake.nix
|
@ -13,49 +13,53 @@
|
|||
extra-substituters = [ "https://natsukagami.cachix.org" ];
|
||||
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ];
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs
|
||||
{
|
||||
inherit system; overlays = [ (import inputs.rust-overlay) ];
|
||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||||
let
|
||||
rustVersion = "1.83.0";
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs
|
||||
{
|
||||
inherit system; overlays = [ (import inputs.rust-overlay) ];
|
||||
};
|
||||
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable.${rustVersion}.default);
|
||||
# craneLib = inputs.crane.mkLib pkgs;
|
||||
in
|
||||
rec {
|
||||
packages.youmubot = pkgs.callPackage ./package.nix { inherit craneLib; };
|
||||
|
||||
defaultPackage = packages.youmubot;
|
||||
|
||||
# `nix run`
|
||||
apps.youmubot = flake-utils.lib.mkApp {
|
||||
drv = packages.youmubot;
|
||||
exePath = "/bin/youmubot";
|
||||
};
|
||||
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable."1.83.0".default);
|
||||
# craneLib = inputs.crane.mkLib pkgs;
|
||||
in
|
||||
rec {
|
||||
packages.youmubot = pkgs.callPackage ./package.nix { inherit craneLib; };
|
||||
defaultApp = apps.youmubot;
|
||||
|
||||
defaultPackage = packages.youmubot;
|
||||
# `nix develop`
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ packages.youmubot ];
|
||||
|
||||
# `nix run`
|
||||
apps.youmubot = flake-utils.lib.mkApp {
|
||||
drv = packages.youmubot;
|
||||
exePath = "/bin/youmubot";
|
||||
buildInputs = with pkgs; [ rustfmt clippy sqlx-cli rust-analyzer ];
|
||||
|
||||
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
||||
pkg-config
|
||||
]);
|
||||
|
||||
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
||||
};
|
||||
}) // {
|
||||
overlays.default = final: prev: {
|
||||
youmubot = final.callPackage ./package.nix {
|
||||
craneLib = (inputs.crane.mkLib final).overrideToolchain (p: p.rust-bin.stable.${rustVersion}.default);
|
||||
};
|
||||
defaultApp = apps.youmubot;
|
||||
|
||||
# `nix develop`
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ packages.youmubot ];
|
||||
|
||||
buildInputs = with pkgs; [ rustfmt clippy sqlx-cli rust-analyzer ];
|
||||
|
||||
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
||||
pkg-config
|
||||
]);
|
||||
|
||||
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
||||
};
|
||||
}) // {
|
||||
overlays.default = final: prev: {
|
||||
youmubot = final.callPackage ./package.nix {
|
||||
craneLib = (inputs.crane.mkLib final).overrideToolchain (p: p.rust-bin.stable."1.79.0".default);
|
||||
};
|
||||
# module
|
||||
nixosModules.default = import ./module.nix;
|
||||
};
|
||||
# module
|
||||
nixosModules.default = import ./module.nix;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue