mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-10 04:30:29 +00:00
Make nix module and overlay system-agnostic
This commit is contained in:
parent
7434f7bc64
commit
4845b9d467
2 changed files with 42 additions and 44 deletions
79
flake.nix
79
flake.nix
|
@ -10,51 +10,52 @@
|
||||||
extra-substituters = [ "https://natsukagami.cachix.org" ];
|
extra-substituters = [ "https://natsukagami.cachix.org" ];
|
||||||
trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ];
|
trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ];
|
||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system:
|
outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem
|
||||||
let
|
(system:
|
||||||
pkgs = import nixpkgs { inherit system; };
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
naersk = pkgs.callPackage inputs.naersk { };
|
naersk = pkgs.callPackage inputs.naersk { };
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; };
|
packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; };
|
||||||
|
|
||||||
defaultPackage = packages.youmubot;
|
defaultPackage = packages.youmubot;
|
||||||
|
|
||||||
overlays.default = final: prev: {
|
# `nix run`
|
||||||
youmubot = final.callPackage ./package.nix {
|
apps.youmubot = flake-utils.lib.mkApp {
|
||||||
naersk = final.callPackage inputs.naersk { };
|
drv = packages.youmubot;
|
||||||
|
exePath = "/bin/youmubot";
|
||||||
};
|
};
|
||||||
};
|
defaultApp = apps.youmubot;
|
||||||
|
|
||||||
# `nix run`
|
# `nix develop`
|
||||||
apps.youmubot = flake-utils.lib.mkApp {
|
devShell = pkgs.mkShell
|
||||||
drv = packages.youmubot;
|
{
|
||||||
exePath = "/bin/youmubot";
|
buildInputs =
|
||||||
};
|
nixpkgs.lib.optionals pkgs.stdenv.isDarwin
|
||||||
defaultApp = apps.youmubot;
|
(with pkgs; [
|
||||||
|
libiconv
|
||||||
|
darwin.apple_sdk.frameworks.Security
|
||||||
|
])
|
||||||
|
++ (with pkgs; [
|
||||||
|
openssl
|
||||||
|
cargo
|
||||||
|
rustfmt
|
||||||
|
]);
|
||||||
|
|
||||||
# `nix develop`
|
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
||||||
devShell = pkgs.mkShell
|
pkg-config
|
||||||
{
|
|
||||||
buildInputs =
|
|
||||||
nixpkgs.lib.optionals pkgs.stdenv.isDarwin
|
|
||||||
(with pkgs; [
|
|
||||||
libiconv
|
|
||||||
darwin.apple_sdk.frameworks.Security
|
|
||||||
])
|
|
||||||
++ (with pkgs; [
|
|
||||||
openssl
|
|
||||||
cargo
|
|
||||||
rustfmt
|
|
||||||
]);
|
]);
|
||||||
|
};
|
||||||
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
}) // {
|
||||||
pkg-config
|
overlays.default = final: prev: {
|
||||||
]);
|
youmubot = final.callPackage ./package.nix {
|
||||||
};
|
naersk = final.callPackage inputs.naersk { };
|
||||||
# module
|
};
|
||||||
nixosModule = import ./module.nix defaultPackage;
|
};
|
||||||
});
|
# module
|
||||||
|
nixosModules.default = import ./module.nix;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
youmubot: { config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
|
@ -7,10 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options.services.youmubot = {
|
options.services.youmubot = {
|
||||||
enable = mkEnableOption "Enable youmubot, the discord bot made with Rust.";
|
enable = mkEnableOption "Enable youmubot, the discord bot made with Rust.";
|
||||||
package = mkOption {
|
package = mkPackageOption pkgs "youmubot" { };
|
||||||
type = types.package;
|
|
||||||
default = youmubot;
|
|
||||||
};
|
|
||||||
|
|
||||||
envFile = mkOption {
|
envFile = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|
Loading…
Add table
Reference in a new issue