Skip to content

Commit

Permalink
nix: update flake
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhb committed Dec 31, 2021
1 parent a7c025b commit 9160fc3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 37 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@
let
pkgs = nixpkgs.legacyPackages.${system};
fenixPkgs = fenix.packages.${system};
haasApiPackage = { rustPlatform, system, systemd ? false, ... }: with pkgs; let
isDarwin = lib.hasSuffix "darwin" system;
isLinux = lib.hasSuffix "linux" system;
in rustPlatform.buildRustPackage rec {
pname = "haas-api";
version = "0.0.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"caddy-0.1.0" = "sha256-kiTfY6bz9+rat6UkP+7u7jbp7AQVULl7jWMok12S5D4=";
};
};
buildInputs = [
(if systemd then postgresql else postgresql.override { systemd = false; })
] ++ lib.optional isDarwin [
darwin.apple_sdk.frameworks.Security
] ++ lib.optional isLinux [
openssl
];
nativeBuildInputs = with pkgs; lib.optional isLinux [
pkg-config
];
enableParallelBuilding = true;
doCheck = false; # FIXME
};
in rec {
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
Expand All @@ -36,13 +62,17 @@
];
};

packages.haas-api = pkgs.rustPlatform.buildRustPackage rec {
pname = "haas-api";
version = "0.0.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
doCheck = false; # FIXME
};
packages.haas-api = pkgs.callPackage haasApiPackage { inherit system; };
packages.haas-api-dockerImage = if pkgs.lib.hasSuffix "linux" system then pkgs.dockerTools.buildLayeredImage {
name = "haas-api";
contents = pkgs.callPackage haasApiPackage { inherit system; /* FIXME */ systemd = true; };
extraCommands = ''
cp ${./Rocket.toml} .
'';
config = {
Cmd = [ "haas_api" ];
};
} else null;

defaultPackage = packages.haas-api;
});
Expand Down

0 comments on commit 9160fc3

Please sign in to comment.