mx-sanebot: split shell and default out of flake.nix
This commit is contained in:
parent
1e6e41a9cb
commit
871975a597
19
pkgs/mx-sanebot/default.nix
Normal file
19
pkgs/mx-sanebot/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ lib
|
||||||
|
, cargo-docset ? null
|
||||||
|
, openssl
|
||||||
|
, pkg-config
|
||||||
|
, rustPlatform
|
||||||
|
}:
|
||||||
|
|
||||||
|
# docs: <nixpkgs>/doc/languages-frameworks/rust.section.md
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
name = "mx-sanebot";
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkg-config ] ++ lib.optional (cargo-docset != null) cargo-docset;
|
||||||
|
buildInputs = [ openssl ];
|
||||||
|
|
||||||
|
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
}
|
|
@ -11,35 +11,10 @@
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
openssl
|
|
||||||
];
|
|
||||||
in rec {
|
in rec {
|
||||||
packages = {
|
packages.mx-sanebot = pkgs.callPackage ./default.nix { };
|
||||||
# docs: <nixpkgs>/doc/languages-frameworks/rust.section.md
|
|
||||||
mx-sanebot = pkgs.rustPlatform.buildRustPackage {
|
|
||||||
name = "mx-sanebot";
|
|
||||||
src = ./.;
|
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
|
||||||
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
|
||||||
hardeningDisable = [ "fortify" ];
|
|
||||||
inherit buildInputs nativeBuildInputs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
defaultPackage = packages.mx-sanebot;
|
defaultPackage = packages.mx-sanebot;
|
||||||
|
|
||||||
devShells.default = with pkgs; mkShell {
|
devShells.default = ./shell.nix { inherit pkgs; };
|
||||||
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
|
||||||
hardeningDisable = [ "fortify" ];
|
|
||||||
|
|
||||||
# Allow cargo to download crates.
|
|
||||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
||||||
|
|
||||||
inherit buildInputs;
|
|
||||||
nativeBuildInputs = [ cargo ] ++ nativeBuildInputs;
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
13
pkgs/mx-sanebot/shell.nix
Normal file
13
pkgs/mx-sanebot/shell.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mx-sanebot = pkgs.callPackage ./. { };
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = mx-sanebot.buildInputs ++ mx-sanebot.nativeBuildInputs ++ [
|
||||||
|
pkgs.cargo
|
||||||
|
];
|
||||||
|
|
||||||
|
# Allow cargo to download crates.
|
||||||
|
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user