forked from fabian/nix
Merge commit 'b424cc1c1c
'
This commit is contained in:
commit
9f38ea87a6
7 changed files with 171 additions and 20 deletions
|
@ -9,11 +9,11 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
}: let
|
}: let
|
||||||
mapOverlayOverride = namespace: overlay: final: prev: let
|
mapOverlayOverride = prefix: overlay: final: prev: let
|
||||||
overlayPkgs = overlay final prev;
|
overlayPkgs = overlay final prev;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"${namespace}" = builtins.removeAttrs overlayPkgs ["override"];
|
"${prefix}" = (prev.${prefix} or {}) // builtins.removeAttrs overlayPkgs ["override"];
|
||||||
}
|
}
|
||||||
// (overlayPkgs.override or {});
|
// (overlayPkgs.override or {});
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
packages =
|
packages =
|
||||||
(import nixpkgs {
|
(import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [(mapOverlayOverride doctrineNoPkgs.prefix (import ./pkgs))];
|
overlays = [self.overlays.default];
|
||||||
}).${
|
}).${
|
||||||
doctrineNoPkgs.prefix
|
doctrineNoPkgs.prefix
|
||||||
};
|
};
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
}
|
}
|
||||||
# NB: Preserve the relative order
|
# NB: Preserve the relative order
|
||||||
{
|
{
|
||||||
overlay = self.overlays.default;
|
overlay = mapOverlayOverride prefix (import ./pkgs);
|
||||||
condition = true;
|
condition = true;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -164,24 +164,12 @@
|
||||||
}
|
}
|
||||||
// optionalAttrs (paths ? nixosSource) {
|
// optionalAttrs (paths ? nixosSource) {
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
nixosSystem = {modules}:
|
|
||||||
lib.makeOverridable nixpkgs.lib.nixosSystem {
|
|
||||||
inherit modules pkgs system;
|
|
||||||
|
|
||||||
specialArgs = {
|
|
||||||
inherit flakes;
|
|
||||||
|
|
||||||
doctrine = mkDoctrine {
|
|
||||||
inherit pkgs;
|
|
||||||
namespace = "sys";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
hostConfig = platform:
|
hostConfig = platform:
|
||||||
nixosSystem {
|
self.lib.mkSystem {
|
||||||
|
inherit flakes pkgs;
|
||||||
|
doctrine = doctrineNoPkgs;
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
self.nixosModules.default
|
|
||||||
nixosSourcePath
|
nixosSourcePath
|
||||||
platform
|
platform
|
||||||
];
|
];
|
||||||
|
@ -213,6 +201,29 @@
|
||||||
in
|
in
|
||||||
lib.mapAttrs home (importAll {root = hmPlatformsPath;});
|
lib.mapAttrs home (importAll {root = hmPlatformsPath;});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkSystem = {
|
||||||
|
pkgs,
|
||||||
|
flakes,
|
||||||
|
doctrine,
|
||||||
|
modules,
|
||||||
|
}:
|
||||||
|
flakes.nixpkgs.lib.makeOverridable flakes.nixpkgs.lib.nixosSystem {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (pkgs) system;
|
||||||
|
|
||||||
|
modules = [self.nixosModules.default] ++ modules;
|
||||||
|
|
||||||
|
specialArgs = {
|
||||||
|
inherit flakes;
|
||||||
|
|
||||||
|
doctrine = self.lib.mkDoctrine {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (doctrine) prefix;
|
||||||
|
namespace = "sys";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
13
trivionomicon/modules/soju/default.nix
Normal file
13
trivionomicon/modules/soju/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
doctrine,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
doctrine.lib.mkModule {
|
||||||
|
inherit config;
|
||||||
|
name = "soju";
|
||||||
|
sys = ./sys.nix;
|
||||||
|
options = ./options.nix;
|
||||||
|
}
|
16
trivionomicon/modules/soju/options.nix
Normal file
16
trivionomicon/modules/soju/options.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{lib, ...}:
|
||||||
|
with lib.types; {
|
||||||
|
sys = {
|
||||||
|
fullyQualifiedDomain = lib.mkOption {
|
||||||
|
type = str;
|
||||||
|
example = "soju.trivionomicon.com";
|
||||||
|
description = "fully qualified domain name to be used by soju";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = port;
|
||||||
|
default = 6697;
|
||||||
|
description = "port to be used by soju";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
47
trivionomicon/modules/soju/sys.nix
Normal file
47
trivionomicon/modules/soju/sys.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
cfg,
|
||||||
|
doctrine,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; {
|
||||||
|
security.acme.certs."${cfg.fullyQualifiedDomain}" = {
|
||||||
|
reloadServices = ["soju.service"];
|
||||||
|
group = "soju";
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [cfg.port];
|
||||||
|
|
||||||
|
services.soju = let
|
||||||
|
sojuCertDir = config.security.acme.certs."${cfg.fullyQualifiedDomain}".directory;
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
hostName = "${cfg.fullyQualifiedDomain}";
|
||||||
|
listen = ["ircs://[::]:${toString cfg.port}"];
|
||||||
|
tlsCertificate = "${sojuCertDir}/fullchain.pem";
|
||||||
|
tlsCertificateKey = "${sojuCertDir}/key.pem";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.soju = {
|
||||||
|
after = ["acme-${cfg.fullyQualifiedDomain}.service"];
|
||||||
|
serviceConfig = {
|
||||||
|
DynamicUser = mkForce false; # fuck dynamic users
|
||||||
|
User = "soju";
|
||||||
|
Group = "soju";
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = "read-only";
|
||||||
|
PrivateTmp = true;
|
||||||
|
RemoveIPC = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.soju = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "soju";
|
||||||
|
};
|
||||||
|
groups.soju = {};
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,5 +5,6 @@ in {
|
||||||
override = {};
|
override = {};
|
||||||
|
|
||||||
athena-bccr = callPackage ./athena-bccr {};
|
athena-bccr = callPackage ./athena-bccr {};
|
||||||
|
snapborg = final.python3Packages.callPackage ./snapborg {};
|
||||||
spliit = callPackage ./spliit {};
|
spliit = callPackage ./spliit {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From c363931656938f9cc3354b8e2797fe9abac1b0e3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alejandro Soto <alejandro@34project.org>
|
||||||
|
Date: Sun, 31 Aug 2025 13:30:45 -0600
|
||||||
|
Subject: [PATCH] Remove "env" arg from subprocess calls
|
||||||
|
|
||||||
|
---
|
||||||
|
snapborg/borg.py | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/snapborg/borg.py b/snapborg/borg.py
|
||||||
|
index 89a3d84..b74ddf7 100644
|
||||||
|
--- a/snapborg/borg.py
|
||||||
|
+++ b/snapborg/borg.py
|
||||||
|
@@ -173,11 +173,10 @@ def launch_borg(args, password=None, print_output=False, dryrun=False, cwd=None)
|
||||||
|
# TODO: parse output from JSON log lines
|
||||||
|
try:
|
||||||
|
if print_output:
|
||||||
|
- subprocess.run(cmd, env=env, check=True, cwd=cwd)
|
||||||
|
+ subprocess.run(cmd, check=True, cwd=cwd)
|
||||||
|
else:
|
||||||
|
subprocess.check_output(cmd,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
- env=env,
|
||||||
|
cwd=cwd)
|
||||||
|
except CalledProcessError as e:
|
||||||
|
if e.returncode == 1:
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
34
trivionomicon/pkgs/snapborg/default.nix
Normal file
34
trivionomicon/pkgs/snapborg/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
borgbackup,
|
||||||
|
buildPythonApplication,
|
||||||
|
fetchFromGitHub,
|
||||||
|
lib,
|
||||||
|
packaging,
|
||||||
|
pyyaml,
|
||||||
|
}:
|
||||||
|
buildPythonApplication {
|
||||||
|
pname = "snapborg";
|
||||||
|
version = "0.1.0-unstable-20250331";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
repo = "snapborg";
|
||||||
|
owner = "enzingerm";
|
||||||
|
|
||||||
|
rev = "7e860395319f995161a6e0c7954ce47635e3cd59";
|
||||||
|
hash = "sha256-RzYL4IHulk1Q/ALWFs6YCTeCO8ohwqXH2NMHRctRVSA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./0001-Remove-env-arg-from-subprocess-calls.patch # Fixes broken $PATH when calling borg
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
borgbackup
|
||||||
|
packaging
|
||||||
|
pyyaml
|
||||||
|
];
|
||||||
|
|
||||||
|
preFixup = ''
|
||||||
|
makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [borgbackup]})
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue