Add nix store cache
continuous-integration/drone/push Build encountered an error Details
continuous-integration/drone Build encountered an error Details

main
mat ess 2022-12-21 23:59:24 -05:00
parent 23894ff2b1
commit 013246d114
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
local PROD = 'production'; local PROD = 'production';
local STAGE = 'staging'; local STAGE = 'staging';
local VOLUME = { name: 'site', path: '/site' }; local VOLUMES = { name: 'site', path: '/site' };
local NIX = 'nix --extra-experimental-features nix-command --extra-experimental-features flakes'; local NIX = 'nix --extra-experimental-features nix-command --extra-experimental-features flakes';
local Secrets(secrets) = { local Secrets(secrets) = {
@ -22,7 +22,10 @@ local Step(env, name, cmds, extras={}) =
{ {
name: name + ' ' + env, name: name + ' ' + env,
image: 'nixos/nix:latest', image: 'nixos/nix:latest',
volumes: [VOLUME], volumes: [
{ name: 'site', path: '/site' },
{ name: 'cache', path: '/nix' },
],
commands: cmds, commands: cmds,
when: WhenProd(prod), when: WhenProd(prod),
} + extras; } + extras;
@ -48,7 +51,10 @@ local DeployStep(env) =
type: 'docker', type: 'docker',
name: 'default', name: 'default',
volumes: [{ name: 'site', temp: {} }], volumes: [
{ name: 'site', temp: {} },
{ name: 'cache', host: { path: '/data/nix' } },
],
steps: [ steps: [
NixStep(STAGE), NixStep(STAGE),