dref/flake.nix

82 lines
1.9 KiB
Nix
Raw Normal View History

2022-12-11 14:08:07 +00:00
{
2023-07-16 19:20:39 +01:00
description = "Docker registry frontend & basic library";
2022-12-11 14:08:07 +00:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
2022-12-11 18:09:02 +00:00
2022-12-11 18:14:50 +00:00
Xess.url = "github:Xe/Xess";
2022-12-11 14:08:07 +00:00
};
2022-12-11 18:14:50 +00:00
outputs = { self, nixpkgs, crane, flake-utils, Xess, ... }:
2022-12-12 17:13:20 +00:00
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
2022-12-11 14:08:07 +00:00
let
pkgs = import nixpkgs {
inherit system;
};
craneLib = crane.lib.${system};
2023-07-16 19:20:39 +01:00
dref = craneLib.buildPackage {
2022-12-11 14:08:07 +00:00
src = craneLib.cleanCargoSource ./.;
buildInputs = [
# Add additional build inputs here
2023-07-16 10:48:40 +01:00
pkgs.openssl
pkgs.pkg-config
2022-12-11 14:08:07 +00:00
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
};
dockerImage = pkgs.dockerTools.buildImage {
name = "dref";
config = {
2023-07-16 19:20:39 +01:00
Cmd = [ "${dref}/bin/dref" ];
ExposedPorts = {
"3000/tcp" = {};
};
};
};
2022-12-11 14:08:07 +00:00
in
{
checks = {
2023-07-16 19:20:39 +01:00
inherit dref;
2022-12-11 14:08:07 +00:00
};
apps.default = flake-utils.lib.mkApp {
2023-07-16 19:20:39 +01:00
drv = dref;
2022-12-11 14:08:07 +00:00
};
2022-12-11 18:14:50 +00:00
packages = rec {
2023-07-16 19:20:39 +01:00
bin = dref;
docker = dockerImage;
2022-12-11 18:14:50 +00:00
default = pkgs.symlinkJoin {
name = "dref-${bin.version}";
paths = [ bin ];
2022-12-11 18:14:50 +00:00
};
2022-12-11 18:09:02 +00:00
};
2022-12-12 17:13:20 +00:00
defaultPackage = self.packages.${system}.bin;
2022-12-11 14:08:07 +00:00
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
# Extra inputs can be added here
nativeBuildInputs = with pkgs; [
cargo
rustc
rust-analyzer
2023-07-16 10:48:40 +01:00
openssl
pkg-config
2022-12-11 14:08:07 +00:00
];
};
});
}