I have a nixos integration test defined in my flake that imports two modules.
imports = [
bootstrapMod
webserverMod
];
these modules are built in a let statement using a function that takes a derivation as an input, and then the output of the function is the module.
bootstrapMod = ((import ./service.app.nix) bootstrap);
webserverMod = ((import ./service.webserver.nix) app);
the service files look like this
app:
{ config, lib, pkgs, ... }:
let
cfg = config.services.webserver;
in
{
options.services.webserver = {
enable = lib.mkEnableOption "webserver Service";
path = [ pkgs.nix pkgs.git ];
after = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "network.target" ];
example = [ "network.target" "serve.service" "seeddb.service"];
description = "";
};
};
config = lib.mkIf cfg.enable {
system.stateVersion = "23.05";
systemd.services.webserver = {
environment = {
};
description = "webserver";
after = cfg.after;
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${app}/bin/app";
Type = "simple";
};
};
};
}
and app is a derivation that builds the app. Every time i run a nixos integration test, the app derivation needs to be rebuilt. how can i cache this if the app derivation hasn’t changed?
I was thinking that I could make a separate flake for bootstrap and app, make those outputs of that flake, and import them into this flake but was wondering if that was over complicating things