2023-08-27 08:21:02 +00:00
|
|
|
{
|
2024-03-17 18:48:49 +00:00
|
|
|
inputs,
|
|
|
|
self,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
perSystem =
|
|
|
|
{ self', pkgs, ... }:
|
2023-11-07 19:53:29 +00:00
|
|
|
let
|
2023-11-09 08:30:25 +00:00
|
|
|
flakeLock = lib.importJSON (self + /flake.lock);
|
|
|
|
flakeInputs = (builtins.removeAttrs inputs [ "self" ]);
|
|
|
|
flakeLockVendoredDeps = flakeLock // {
|
2024-03-17 18:48:49 +00:00
|
|
|
nodes =
|
|
|
|
flakeLock.nodes
|
|
|
|
// (lib.flip lib.mapAttrs flakeInputs (
|
|
|
|
name: _:
|
|
|
|
flakeLock.nodes.${name}
|
|
|
|
// {
|
|
|
|
locked = {
|
|
|
|
inherit (flakeLock.nodes.${name}.locked) narHash;
|
|
|
|
lastModified =
|
|
|
|
# lol, nixpkgs has a different timestamp on the fs???
|
|
|
|
if name == "nixpkgs" then 0 else 1;
|
|
|
|
path = "${inputs.${name}}";
|
|
|
|
type = "path";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
));
|
2023-11-09 08:30:25 +00:00
|
|
|
};
|
2024-03-17 18:48:49 +00:00
|
|
|
flakeLockFile = builtins.toFile "clan-core-flake.lock" (builtins.toJSON flakeLockVendoredDeps);
|
|
|
|
clanCoreWithVendoredDeps =
|
|
|
|
lib.trace flakeLockFile pkgs.runCommand "clan-core-with-vendored-deps" { }
|
|
|
|
''
|
|
|
|
cp -r ${self} $out
|
|
|
|
chmod +w -R $out
|
|
|
|
cp ${flakeLockFile} $out/flake.lock
|
|
|
|
'';
|
2023-11-07 19:53:29 +00:00
|
|
|
in
|
|
|
|
{
|
2024-04-23 16:55:00 +00:00
|
|
|
|
2024-03-17 18:48:49 +00:00
|
|
|
devShells.clan-cli = pkgs.callPackage ./shell.nix { inherit (self'.packages) clan-cli; };
|
2023-11-07 19:53:29 +00:00
|
|
|
packages = {
|
|
|
|
clan-cli = pkgs.python3.pkgs.callPackage ./default.nix {
|
|
|
|
inherit (inputs) nixpkgs;
|
2023-11-09 08:30:25 +00:00
|
|
|
clan-core-path = clanCoreWithVendoredDeps;
|
2023-11-07 19:53:29 +00:00
|
|
|
};
|
2024-05-07 11:23:03 +00:00
|
|
|
clan-cli-docs = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "clan-cli-docs";
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
buildInputs = [ pkgs.python3 ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2024-05-14 10:18:37 +00:00
|
|
|
python docs.py reference
|
2024-05-07 11:23:03 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r out/* $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-07 19:53:29 +00:00
|
|
|
default = self'.packages.clan-cli;
|
2023-07-26 07:27:48 +00:00
|
|
|
};
|
2023-08-02 18:04:16 +00:00
|
|
|
|
2023-11-07 19:53:29 +00:00
|
|
|
checks = self'.packages.clan-cli.tests;
|
|
|
|
};
|
2023-07-20 16:07:27 +00:00
|
|
|
}
|