Format Flake

This commit is contained in:
Gabriel Simmer 2024-06-20 21:19:13 +01:00
parent ff72e9d520
commit 6af528ff9e
Signed by: arch
SSH key fingerprint: SHA256:m3OEcdtrnBpMX+2BDGh/byv3hrCekCLzDYMdvGEKPPQ

View file

@ -13,45 +13,46 @@
docker-utils.url = "github:collinarnett/docker-utils"; docker-utils.url = "github:collinarnett/docker-utils";
}; };
outputs = { self, nixpkgs, crane, flake-utils, docker-utils, ... }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
crane,
flake-utils,
docker-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs; craneLib = crane.mkLib pkgs;
# Common arguments can be set here to avoid repeating them later
# Note: changes here will rebuild all dependency crates
commonArgs = { commonArgs = {
src = craneLib.cleanCargoSource ./.; src = craneLib.cleanCargoSource ./.;
strictDeps = true; strictDeps = true;
buildInputs = with pkgs;[ buildInputs = with pkgs;
[
openssl openssl
pkg-config pkg-config
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ]
# Additional darwin specific inputs can be set here ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv pkgs.libiconv
]; ];
}; };
my-crate = craneLib.buildPackage (commonArgs // { my-crate = craneLib.buildPackage (commonArgs
// {
cargoArtifacts = craneLib.buildDepsOnly commonArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Additional environment variables or build phases/hooks can be set
# here *without* rebuilding all dependency crates
# MY_CUSTOM_VAR = "some value";
}); });
dockerImage = pkgs.dockerTools.buildImage { dockerImage = pkgs.dockerTools.buildImage {
name = "git.gmem.ca/arch/duplikate"; name = "git.gmem.ca/arch/duplikate";
tag = "latest-${system}"; tag = "latest-${system}";
config = { config = {
Cmd = [ "${my-crate}/bin/duplikate" ]; Cmd = ["${my-crate}/bin/duplikate"];
}; };
}; };
in in {
{
checks = { checks = {
inherit my-crate; inherit my-crate;
}; };
@ -78,13 +79,8 @@
}; };
devShells.default = craneLib.devShell { devShells.default = craneLib.devShell {
# Inherit inputs from checks.
checks = self.checks.${system}; checks = self.checks.${system};
# Additional dev-shell environment variables can be set directly
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
# Extra inputs can be added here; cargo and rustc are provided by default.
packages = with pkgs; [ packages = with pkgs; [
rust-analyzer rust-analyzer
]; ];