2023-01-01 00:01:07 +00:00
|
|
|
{
|
|
|
|
description = "A Nix binary cache server";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2023-01-02 04:33:08 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-01-01 00:01:07 +00:00
|
|
|
|
2023-01-02 14:46:12 +00:00
|
|
|
crane = {
|
|
|
|
url = "github:ipetkov/crane";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-compat.follows = "flake-compat";
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
|
2023-01-01 00:01:07 +00:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-02 14:46:12 +00:00
|
|
|
outputs = { self, nixpkgs, flake-utils, crane, ... }: let
|
2023-01-02 04:33:08 +00:00
|
|
|
supportedSystems = flake-utils.lib.defaultSystems;
|
|
|
|
in flake-utils.lib.eachSystem supportedSystems (system: let
|
2023-01-01 00:01:07 +00:00
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
|
2023-01-02 14:46:12 +00:00
|
|
|
craneLib = crane.lib.${system};
|
|
|
|
cranePkgs = pkgs.callPackage ./crane.nix { inherit craneLib; };
|
|
|
|
|
2023-01-01 00:01:07 +00:00
|
|
|
inherit (pkgs) lib;
|
|
|
|
in rec {
|
|
|
|
packages = {
|
|
|
|
default = packages.attic;
|
|
|
|
|
2023-01-02 14:46:12 +00:00
|
|
|
inherit (cranePkgs) attic attic-client attic-server attic-tests;
|
2023-01-01 00:01:07 +00:00
|
|
|
|
2023-01-02 14:46:12 +00:00
|
|
|
attic-nixpkgs = pkgs.callPackage ./package.nix { };
|
2023-01-01 00:01:07 +00:00
|
|
|
|
|
|
|
attic-server-image = pkgs.dockerTools.buildImage {
|
|
|
|
name = "attic-server";
|
|
|
|
tag = "main";
|
2023-01-02 03:59:02 +00:00
|
|
|
copyToRoot = [
|
|
|
|
# Minimal `/bin/sh` for `fly ssh console`
|
|
|
|
pkgs.busybox-sandbox-shell
|
|
|
|
packages.attic-server
|
|
|
|
];
|
2023-01-01 00:01:07 +00:00
|
|
|
config = {
|
|
|
|
Entrypoint = [ "${packages.attic-server}/bin/atticd" ];
|
|
|
|
Cmd = [ "--mode" "api-server" ];
|
|
|
|
Env = [
|
|
|
|
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
book = pkgs.callPackage ./book {
|
|
|
|
attic = packages.attic;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells = {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
inputsFrom = with packages; [ attic book ];
|
|
|
|
nativeBuildInputs = with pkgs; [
|
2023-01-02 17:32:05 +00:00
|
|
|
rustc
|
|
|
|
|
2023-01-01 00:01:07 +00:00
|
|
|
rustfmt clippy
|
|
|
|
cargo-expand cargo-outdated cargo-edit
|
|
|
|
|
|
|
|
sqlite-interactive
|
|
|
|
|
|
|
|
editorconfig-checker
|
|
|
|
|
|
|
|
flyctl
|
|
|
|
] ++ (lib.optionals pkgs.stdenv.isLinux [
|
|
|
|
linuxPackages.perf
|
|
|
|
]);
|
|
|
|
|
|
|
|
NIX_PATH = "nixpkgs=${pkgs.path}";
|
|
|
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
|
|
|
|
|
|
|
|
ATTIC_DISTRIBUTOR = "dev";
|
|
|
|
};
|
|
|
|
|
|
|
|
demo = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = [
|
|
|
|
packages.default
|
|
|
|
];
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
>&2 echo
|
|
|
|
>&2 echo '🚀 Run `atticd` to get started!'
|
|
|
|
>&2 echo
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
devShell = devShells.default;
|
|
|
|
});
|
|
|
|
}
|