Skip to content
Snippets Groups Projects
Commit e537acb6 authored by Tom Prince's avatar Tom Prince
Browse files

Expose all local packages as new module argument.

parent 4f0e3299
No related branches found
No related tags found
3 merge requests!180merge develop into production,!177merge develop into staging,!163Expose all local packages as new module argument.
......@@ -19,4 +19,8 @@
'';
};
};
imports = [
../../nixos/modules/packages.nix
];
}
# A NixOS module which can run a Ristretto-based issuer for PrivateStorage
# ZKAPs.
{ lib, pkgs, config, ... }: let
{ lib, pkgs, ourpkgs, config, ... }: let
cfg = config.services.private-storage-issuer;
zkapissuer = pkgs.callPackage ../pkgs/zkapissuer { };
in {
options = {
services.private-storage-issuer.enable = lib.mkEnableOption "PrivateStorage ZKAP Issuer Service";
services.private-storage-issuer.package = lib.mkOption {
default = zkapissuer.components.exes."PaymentServer-exe";
default = ourpkgs.zkapissuer.components.exes."PaymentServer-exe";
type = lib.types.package;
example = lib.literalExample "pkgs.zkapissuer.components.exes.\"PaymentServer-exe\"";
description = ''
......
# A NixOS module which exposes custom packages to other modules.
{ pkgs, ...}:
{
config = {
# Expose `nixos/pkgs` as a new module argument `ourpkgs`.
_module.args.ourpkgs = pkgs.callPackage ../../nixos/pkgs {};
};
}
# A NixOS module which can instantiate a Tahoe-LAFS storage server in the
# preferred configuration for the Private Storage grid.
{ pkgs, lib, config, ... }:
{ pkgs, ourpkgs, lib, config, ... }:
let
# Grab the configuration for this module for convenient access below.
cfg = config.services.private-storage;
......@@ -8,9 +8,6 @@ let
# TODO: This path copied from tahoe.nix.
tahoe-base = "/var/db/tahoe-lafs";
# Our own nixpkgs fork:
ourpkgs = import ../../nixpkgs-ps.nix {};
# The full path to the directory where the storage server will write
# incident reports.
incidents-dir = "${tahoe-base}/${storage-node-name}/logs/incidents";
......
......@@ -83,21 +83,19 @@ let
command = builtins.concatStringsSep " " argv;
in
"${node}.succeed('set -eo pipefail; ${command} | systemd-cat')";
pspkgs = import ../../../nixpkgs-ps.nix { };
in {
# https://nixos.org/nixos/manual/index.html#sec-nixos-tests
# https://nixos.mayflower.consulting/blog/2019/07/11/leveraging-nixos-tests-in-your-project/
nodes = rec {
# Get a machine where we can run a Tahoe-LAFS client node.
client =
{ config, pkgs, ... }:
{ environment.systemPackages = [
{ config, pkgs, ourpkgs, ... }:
{ imports = [ ../packages.nix ];
environment.systemPackages = [
pkgs.daemonize
# A Tahoe-LAFS configuration capable of using the right storage
# plugin.
pspkgs.privatestorage
ourpkgs.privatestorage
# Support for the tests we'll run.
(pkgs.python3.withPackages (ps: [ ps.requests ps.hyperlink ]))
];
......@@ -110,7 +108,8 @@ in {
storage =
{ config, pkgs, ... }:
{ imports =
[ ../private-storage.nix
[ ../packages.nix
../private-storage.nix
../ssh.nix
];
services.private-storage = {
......@@ -128,7 +127,8 @@ in {
issuer =
{ config, pkgs, ... }:
{ imports =
[ ../issuer.nix
[ ../packages.nix
../issuer.nix
../ssh.nix
];
services.private-storage.sshUsers = sshUsers;
......
{ ... }:
let
pspkgs = import ../../../nixpkgs-ps.nix { };
in {
{
nodes = {
storage = { config, pkgs, ... }: {
storage = { config, pkgs, ourpkgs, ... }: {
imports = [
../packages.nix
../tahoe.nix
];
services.tahoe.nodes.storage = {
package = pspkgs.privatestorage;
package = ourpkgs.privatestorage;
sections = {
node = {
nickname = "storage";
......
# Expose all our locally defined packages as attributes.
# In `gridlib.base`, we expose this as a new `ourpkgs` module argument.
# To access this directly, you can call this as::
#
# pkgs.callPackage ./nixos/pkgs
{buildPlatform, hostPlatform, callPackage}:
let
# Our own nixpkgs fork:
ourpkgs = import ../../nixpkgs-ps.nix {
# Ensure that the fork is configured for the same system
# as we were called with.
localSystem = buildPlatform;
crossSystem = hostPlatform;
# Ensure that configuration of the system where this runs
# doesn't leak into what we build.
# See https://github.com/NixOS/nixpkgs/issues/62513
config = {};
overlays = [];
};
in
{
zkapissuer = callPackage ./zkapissuer {};
inherit (ourpkgs) privatestorage leasereport;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment