diff --git a/flake.nix b/flake.nix index 96b46c9..300dda6 100644 --- a/flake.nix +++ b/flake.nix @@ -10,51 +10,52 @@ extra-substituters = [ "https://natsukagami.cachix.org" ]; trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ]; }; - outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { inherit system; }; + outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { inherit system; }; - naersk = pkgs.callPackage inputs.naersk { }; - in - rec { - packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; }; + naersk = pkgs.callPackage inputs.naersk { }; + in + rec { + packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; }; - defaultPackage = packages.youmubot; + defaultPackage = packages.youmubot; - overlays.default = final: prev: { - youmubot = final.callPackage ./package.nix { - naersk = final.callPackage inputs.naersk { }; + # `nix run` + apps.youmubot = flake-utils.lib.mkApp { + drv = packages.youmubot; + exePath = "/bin/youmubot"; }; - }; + defaultApp = apps.youmubot; - # `nix run` - apps.youmubot = flake-utils.lib.mkApp { - drv = packages.youmubot; - exePath = "/bin/youmubot"; - }; - defaultApp = apps.youmubot; + # `nix develop` + devShell = pkgs.mkShell + { + buildInputs = + nixpkgs.lib.optionals pkgs.stdenv.isDarwin + (with pkgs; [ + libiconv + darwin.apple_sdk.frameworks.Security + ]) + ++ (with pkgs; [ + openssl + cargo + rustfmt + ]); - # `nix develop` - devShell = pkgs.mkShell - { - 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 ]); - - nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [ - pkg-config - ]); - }; - # module - nixosModule = import ./module.nix defaultPackage; - }); + }; + }) // { + overlays.default = final: prev: { + youmubot = final.callPackage ./package.nix { + naersk = final.callPackage inputs.naersk { }; + }; + }; + # module + nixosModules.default = import ./module.nix; + }; } diff --git a/module.nix b/module.nix index 720f11a..34ddac9 100644 --- a/module.nix +++ b/module.nix @@ -1,4 +1,4 @@ -youmubot: { config, pkgs, lib, ... }: +{ config, pkgs, lib, ... }: with lib; let @@ -7,10 +7,7 @@ in { options.services.youmubot = { enable = mkEnableOption "Enable youmubot, the discord bot made with Rust."; - package = mkOption { - type = types.package; - default = youmubot; - }; + package = mkPackageOption pkgs "youmubot" { }; envFile = mkOption { type = types.path;