clan-core/pkgs/clan-cli/flake-module.nix

47 lines
1.5 KiB
Nix
Raw Normal View History

{ inputs, self, lib, ... }:
{
2023-12-30 22:10:43 +00:00
perSystem = { self', pkgs, ... }:
2023-11-07 19:53:29 +00:00
let
flakeLock = lib.importJSON (self + /flake.lock);
flakeInputs = (builtins.removeAttrs inputs [ "self" ]);
flakeLockVendoredDeps = flakeLock // {
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";
};
})
);
};
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
{
devShells.clan-cli = pkgs.callPackage ./shell.nix {
2023-12-15 11:15:22 +00:00
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;
clan-core-path = clanCoreWithVendoredDeps;
2023-11-07 19:53:29 +00:00
};
default = self'.packages.clan-cli;
};
2023-11-07 19:53:29 +00:00
checks = self'.packages.clan-cli.tests;
};
2023-08-03 09:31:56 +00:00
}