2021-10-23 10:41:06 -04:00
|
|
|
{
|
|
|
|
description = "Peer2Peer Nix-Binary-Cache";
|
|
|
|
|
2021-10-29 08:29:52 -04:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2021-10-23 10:41:06 -04:00
|
|
|
};
|
2021-10-29 08:29:52 -04:00
|
|
|
|
2021-11-03 14:35:06 -04:00
|
|
|
outputs = { self, nixpkgs, flake-utils, ... }: {
|
2021-10-29 08:29:52 -04:00
|
|
|
nixosModules.peerix = import ./module.nix;
|
2021-10-31 21:18:12 -04:00
|
|
|
overlay = import ./overlay.nix { inherit self; };
|
2021-10-29 08:29:52 -04:00
|
|
|
} // flake-utils.lib.eachDefaultSystem (system:
|
2021-11-03 14:35:06 -04:00
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
python = pkgs.python39;
|
|
|
|
packages = map (pkg: python.pkgs.${pkg}) (builtins.filter (v: builtins.isString v && (builtins.stringLength v) > 0) (builtins.split "\n" (builtins.readFile ./requirements.txt)));
|
|
|
|
in {
|
|
|
|
packages = rec {
|
|
|
|
peerix-unwrapped = python.pkgs.buildPythonApplication {
|
|
|
|
pname = "peerix";
|
|
|
|
version = builtins.replaceStrings [ " " "\n" ] [ "" "" ] (builtins.readFile ./VERSION);
|
|
|
|
src = ./.;
|
2021-10-29 08:29:52 -04:00
|
|
|
|
2021-11-03 14:35:06 -04:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
propagatedBuildInputs = with pkgs; [
|
|
|
|
nix
|
|
|
|
nix-serve
|
|
|
|
] ++ packages;
|
|
|
|
};
|
2021-10-29 08:29:52 -04:00
|
|
|
|
2021-11-03 14:35:06 -04:00
|
|
|
peerix = pkgs.writeShellScriptBin "peerix" ''
|
|
|
|
PATH=${pkgs.nix}/bin:${pkgs.nix-serve}:$PATH
|
|
|
|
exec ${peerix-unwrapped}/bin/peerix "$@"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultPackage = self.packages.${system}.peerix;
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
nix-serve
|
|
|
|
niv
|
|
|
|
(python.withPackages (ps: packages))
|
|
|
|
];
|
|
|
|
};
|
2021-10-29 08:29:52 -04:00
|
|
|
|
2021-11-03 14:35:06 -04:00
|
|
|
defaultApp = { type = "app"; program = "${self.packages.${system}.peerix}/bin/peerix"; };
|
|
|
|
});
|
2021-10-23 10:41:06 -04:00
|
|
|
}
|