brig: init

This commit is contained in:
Max Headroom 2022-06-14 21:17:15 +02:00
parent 9a9c63a392
commit a4e2711350
6 changed files with 72 additions and 0 deletions

23
modules/brig/default.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs, config, inputs, ... }:
let
inherit (inputs.self.packages.${pkgs.system}) brig;
in
{
environment.systemPackages = [ brig ];
systemd.user.services.brig = {
description = "Brig Daemon";
wantedBy = [ "gnome-session.target" ];
path = [ "/run/wrappers" config.services.ipfs.package ];
serviceConfig = {
ExecStart = "${brig}/bin/brig --repo %h/.brig daemon launch";
#ExecStartPost = "${brig}/bin/brig fstab apply";
Restart = "always";
Slice = "background.slice";
SyslogIdentifier = "brig";
};
environment = {
inherit (config.environment.variables) IPFS_PATH;
};
};
}

View file

@ -3,6 +3,7 @@ with builtins;
let
aspects = [
./autopatch
./brig
./desktop
./enterprise
./firewall
@ -42,6 +43,7 @@ in rec {
desktop = [
modules.desktop
inputs.home-manager.nixosModules.home-manager
brig
nextcloud-client
nix-register-flakes
nix-config

View file

@ -9,6 +9,8 @@ let
};
in
{
brig = pkgs.callPackage ./tools/brig { };
privatevoid-smart-card-ca-bundle = pkgs.callPackage ./data/privatevoid-smart-card-certificate-authority-bundle.nix { };
jdtls = pkgs.callPackage ./development/langservers/jdtls.nix { };

View file

@ -0,0 +1,12 @@
diff --git a/cmd/util.go b/cmd/util.go
index 37ebfe64..ceee4730 100644
--- a/cmd/util.go
+++ b/cmd/util.go
@@ -79,6 +80,7 @@ func guessRepoFolder(ctx *cli.Context) (string, error) {
guessLocations := []string{
// TODO: For now just one.
+ (os.Getenv("HOME") + "/.brig"),
".",
}

View file

@ -0,0 +1,20 @@
{ lib, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "brig";
version = "0.5.3pre";
subPackages = ["."];
patches = [
./default-repo-location.patch
./pin-ls-recursive.patch
];
src = fetchFromGitHub {
owner = "sahib";
repo = "brig";
rev = "6b7eccf8fcbd907fc759f8ca8aa814df8499e2ed";
sha256 = "sha256-lCXSeTIZcIcVcblm9BTUMqTfxO7+BHYQNv6/RlPq14A=";
};
vendorSha256 = "sha256-pFrrMq7VFCwt8KRgJApCq8lPYv0P8hIUOxKJMN9QR0U=";
}

View file

@ -0,0 +1,13 @@
diff --git a/backend/httpipfs/pin.go b/backend/httpipfs/pin.go
index 74c7dec..65d78b8 100644
--- a/backend/httpipfs/pin.go
+++ b/backend/httpipfs/pin.go
@@ -13,7 +13,7 @@ import (
// IsPinned returns true when `hash` is pinned in some way.
func (nd *Node) IsPinned(hash h.Hash) (bool, error) {
ctx := context.Background()
- resp, err := nd.sh.Request("pin/ls", hash.B58String()).Send(ctx)
+ resp, err := nd.sh.Request("pin/ls", hash.B58String()).Option("type", "recursive").Send(ctx)
if err != nil {
return false, err
}