services specialArg stage 1

This commit is contained in:
kat witch 2021-08-06 23:11:46 +01:00
parent aef9c37ee6
commit 3c9475cdcf
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
30 changed files with 14 additions and 103 deletions

View file

@ -1 +0,0 @@
{ ... }: { }

View file

@ -1,23 +0,0 @@
{ lib, config, ... }: with lib; {
config = {
deploy.targets.ostara = {
nodeNames = singleton "ostara";
tf = {
resources.ostara = {
provider = "null";
type = "resource";
connection = {
port = 62954;
host = "192.168.1.245";
};
};
};
};
network.nodes.ostara = {
imports = lib.hostImport "ostara";
networking = {
hostName = "ostara";
};
};
};
}

View file

@ -1,58 +0,0 @@
{ lib, config, users, pkgs, profiles, ... }:
with lib;
{
imports = [ ./hw.nix profiles.laptop ];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
networking.hostId = "9f89b327";
networking.hostName = "ostara";
networking.useDHCP = false;
networking.interfaces.enp1s0.useDHCP = true;
networking.interfaces.wlp2s0.useDHCP = true;
kw.fw.public.interfaces = singleton "wlp2s0";
kw.fw.public.tcp.ports = [ 9981 9982 ];
hardware.firmware = [ pkgs.libreelec-dvb-firmware ];
services.tvheadend.enable = true;
systemd.services.tvheadend.enable = lib.mkForce false;
systemd.services.tvheadend-kat = {
description = "Tvheadend TV streaming server";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${pkgs.tvheadend}/bin/tvheadend \
--http_root /tvheadend \
--http_port 9981 \
--htsp_port 9982 \
-f \
-C \
-p ${config.users.users.tvheadend.home}/tvheadend.pid \
-u tvheadend \
-g video
'';
serviceConfig = {
Type = "forking";
PIDFile = "${config.users.users.tvheadend.home}/tvheadend.pid";
Restart = "always";
RestartSec = 5;
User = "tvheadend";
Group = "video";
ExecStop = "${pkgs.coreutils}/bin/rm ${config.users.users.tvheadend.home}/tvheadend.pid";
};
};
system.stateVersion = "20.09";
}

View file

@ -1,20 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "uhci_hcd" "ehci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/469a684b-eb8f-48a8-8f98-be58528312c4";
fsType = "ext4";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/2223e305-79c9-45b3-90d7-560dcc45775a"; }];
}

View file

@ -5,6 +5,14 @@ let
sourceCache = import ./cache.nix {
inherit sources lib;
};
publicServices = lib.modList {
modulesDir = ./config/services;
};
privateServices-base = lib.mkIf (builtins.pathExists ./config/trusted/services) (lib.modList {
modulesDir = ./config/trusted/services;
});
privateServices = privateServices-base.content;
services = lib.modListMerge publicServices privateServices;
profiles = lib.modList {
modulesDir = ./config/profiles;
};
@ -34,7 +42,7 @@ let
./config/modules/meta/default.nix
] ++ map (hostName: ./config/hosts + "/${hostName}/meta.nix") hostNames;
specialArgs = {
inherit sources profiles users;
inherit sources profiles users services;
};
};
inherit (eval) config;

View file

@ -12,5 +12,6 @@
{
inherit (colorHelpers) hextorgba;
hostImport = import ./host-import.nix { inherit lib; };
modListMerge = import ./intersect-merge.nix { inherit lib; };
modList = import ./module-list.nix { inherit lib; };
}; in katlib

View file

@ -0,0 +1,4 @@
{ lib }: pathsA: pathsB: with lib; let
pathIntersection = intersectLists (attrNames pathsA) (attrNames pathsB);
pathMerger = pathA: pathB: { imports = [ pathA pathB ]; };
in pathsA // pathsB // genAttrs pathIntersection (key: (pathMerger pathsA.${key} pathsB.${key}))