Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system.extraDependencies #356

Open
antifuchs opened this issue Aug 22, 2021 · 0 comments
Open

system.extraDependencies #356

antifuchs opened this issue Aug 22, 2021 · 0 comments

Comments

@antifuchs
Copy link

antifuchs commented Aug 22, 2021

This nixos option is really useful for warming the cache in a flake-based system configuration that has apps defined, and would be very good to have in nix-darwin as well: By adding the apps' derivations to the store, you get them pre-built (and referenced in the system closure so they don't get gc'ed) without having them clutter up the $PATH.

Here's a super minimal definition that I have in my system:

{ lib, config, ... }:
let
  cfg = config.nixos-compat;
in
{
  options = with lib; {
    nixos-compat.system.extraDependencies = mkOption {
      description = "Extra derivations to build & include in the
        system closure that are otherwise unreferenced.";
      type = types.listOf types.path;
      default = [ ];
    };
  };

  config = {
    environment.etc."nix/extra-dependencies.list" = {
      text = (toString cfg.system.extraDependencies);
    };
  };
}

This lets me add the following module to any darwin mods in my flake definition:

      prebuilt-flake-apps = system: { lib, ... }: {
        _file = "~/home#prebuilt-flake-apps";
        nixos-compat.system.extraDependencies =
          lib.mapAttrsToList (_n: app: app.program)
            (lib.filterAttrs (_n: app: app.type == "app") self.apps.${system});
      };
lf- pushed a commit to lf-/nix-darwin that referenced this issue Jun 6, 2022
I want a newish postgres config to work on my Mac.

This contains a little hack (putting the check-config derivation into
the start script as a comment) to deal with not having LnL7#356.

It's otherwise identical to the upstream module.
lf- pushed a commit to lf-/nix-darwin that referenced this issue Jun 6, 2022
I want a newish postgres config to work on my Mac.

This contains a little hack (putting the check-config derivation into
the start script as a comment) to deal with not having LnL7#356.

It's otherwise identical to the upstream module.
lf- pushed a commit to lf-/nix-darwin that referenced this issue Nov 10, 2022
I want a newish postgres config to work on my Mac.

This contains a little hack (putting the check-config derivation into
the start script as a comment) to deal with not having LnL7#356.

It's otherwise identical to the upstream module.
theutz pushed a commit to theutz/nix-darwin that referenced this issue Apr 19, 2023
I want a newish postgres config to work on my Mac.

This contains a little hack (putting the check-config derivation into
the start script as a comment) to deal with not having LnL7#356.

It's otherwise identical to the upstream module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant