Skip to content

Commit

Permalink
Extracted out duplicate binary cache config
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Jan 6, 2024
1 parent fd958c3 commit edf2bf6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 1 addition & 4 deletions NixSupport/nixosModules/app.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ in
{
imports = [
ihp.nixosModules.options
ihp.nixosModules.binaryCache
ihp.nixosModules.services_app
ihp.nixosModules.services_worker
ihp.nixosModules.services_migrate
];

# Speed up builds with the IHP binary cache
nix.settings.substituters = [ "https://digitallyinduced.cachix.org" ];
nix.settings.trusted-public-keys = [ "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE=" ];

# Pin the nixpkgs to the IHP nixpkgs
nix.registry.nixpkgs.flake = nixpkgs;
}
Expand Down
8 changes: 4 additions & 4 deletions NixSupport/nixosModules/appWithPostgres.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Running IHP app + a local Postgres connected to it
{ config, pkgs, modulesPath, lib, ihp, ... }:
{ config, nixpkgs, pkgs, modulesPath, lib, ihp, ... }:
let cfg = config.services.ihp;
in
{
imports = [
ihp.nixosModules.options
ihp.nixosModules.binaryCache
ihp.nixosModules.services_app
ihp.nixosModules.services_worker
ihp.nixosModules.services_migrate
];

# Speed up builds with the IHP binary cache
nix.settings.substituters = [ "https://digitallyinduced.cachix.org" ];
nix.settings.trusted-public-keys = [ "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE=" ];
# Pin the nixpkgs to the IHP nixpkgs
nix.registry.nixpkgs.flake = nixpkgs;

# Add swap to avoid running out of memory during builds
swapDevices = [ { device = "/swapfile"; size = 8192; } ];
Expand Down
8 changes: 8 additions & 0 deletions NixSupport/nixosModules/binaryCache.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Configures the IHP binary cache
{ config, nixpkgs, pkgs, modulesPath, lib, ihp, ... }:
{
# Speed up builds with the IHP binary cache
nix.settings.substituters = lib.mkAfter [ "https://digitallyinduced.cachix.org" ];
nix.settings.trusted-public-keys = lib.mkAfter[ "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE=" ];
}

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
services_worker = ./NixSupport/nixosModules/services/worker.nix;
services_migrate = ./NixSupport/nixosModules/services/migrate.nix;
options = ./NixSupport/nixosModules/options.nix;
binaryCache = ./NixSupport/nixosModules/binaryCache.nix;
};
};
}
Expand Down

0 comments on commit edf2bf6

Please sign in to comment.