From 8bb8b4114a8414d29289b8b38c2050101620b84c Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 20 May 2025 19:14:06 +0200 Subject: [PATCH] Add helpful packages to flake --- flake.nix | 83 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/flake.nix b/flake.nix index 8a84049..d3fecc3 100644 --- a/flake.nix +++ b/flake.nix @@ -10,43 +10,65 @@ }; nixConfig = { extra-substituters = [ "https://natsukagami.cachix.org" ]; - extra-trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ]; + extra-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; overlays = [ (import inputs.rust-overlay) ]; - }; - in - rec { - packages.youmubot = pkgs.callPackage ./package.nix { }; + outputs = + { + self, + nixpkgs, + flake-utils, + ... + }@inputs: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ (import inputs.rust-overlay) ]; + }; + in + rec { + packages.youmubot = pkgs.callPackage ./package.nix { }; - defaultPackage = packages.youmubot; + defaultPackage = packages.youmubot; - # `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 - { - inputsFrom = [ packages.youmubot ]; + # `nix develop` + devShell = pkgs.mkShell { + inputsFrom = [ packages.youmubot ]; - buildInputs = with pkgs; [ rustfmt clippy sqlx-cli rust-analyzer ]; + buildInputs = with pkgs; [ + rustfmt + clippy + sqlx-cli + rust-analyzer - nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [ - pkg-config - ]); + curl + jq - RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; - }; - }) // { + sqlite-interactive + ]; + + 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 { }; }; @@ -54,4 +76,3 @@ nixosModules.default = import ./module.nix; }; } -