fixing fitbit

This commit is contained in:
2023-11-29 21:08:18 +00:00
parent 44e26348db
commit 0b8ddd6ffb
35 changed files with 45 additions and 765 deletions

View File

@@ -1,48 +0,0 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
lib,
config,
pkgs,
modulesPath,
...
}: {
# You can import other NixOS modules here
imports = [
# Include my hardware settings.
./hardware.nix
# Include static network settings.
./networking.nix
"${modulesPath}/virtualisation/hyperv-image.nix"
];
nixpkgs = {config = {allowUnfree = true;};};
nix = {
settings = {
experimental-features = "nix-command flakes";
auto-optimise-store = true;
};
};
networking.hostName = "HyperV";
boot.loader.systemd-boot.enable = true;
system.stateVersion = "23.05";
mymods = {
gnome.enable = true;
user_sstent.enable = true;
sshd.enable = true;
};
networking.firewall.allowedTCPPorts = [22];
environment.etc."ssh/ssh_host_rsa_key".source = ./ssh/ssh_host_rsa_key;
environment.etc."ssh/ssh_host_rsa_key".mode = "0400";
environment.etc."ssh/ssh_host_rsa_key.pub".source = ./ssh/ssh_host_rsa_key.pub;
environment.etc."ssh/ssh_host_ed25519_key".source = ./ssh/ssh_host_ed25519_key;
environment.etc."ssh/ssh_host_ed25519_key".mode = "0400";
environment.etc."ssh/ssh_host_ed25519_key.pub".source = ./ssh/ssh_host_ed25519_key.pub;
}

View File

@@ -1,37 +0,0 @@
# This is just an example, you should generate yours with nixos-generate-config and put it in here.
{
config,
lib,
modulesPath,
pkgs,
...
}: {
# Set your system kind (needed for flakes)
nixpkgs.hostPlatform = "x86_64-linux";
virtualisation.hypervGuest.videoMode = "1920x1080";
boot.initrd.availableKernelModules = ["sd_mod" "sr_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["hv_sock"];
# fileSystems."/" = {
# device = "/dev/disk/by-label/nixos";
# autoResize = true;
# fsType = "ext4";
# };
# fileSystems."/boot" = {
# device = "/dev/disk/by-label/ESP";
# fsType = "vfat";
# };
fileSystems."/mnt/Public" = {
device = "//192.168.1.109/Public";
fsType = "cifs";
options = let
# this line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
# in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
in ["${automount_opts}"];
};
}

View File

@@ -1,15 +0,0 @@
{
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
hyperv = {
baseImageSize = 8096;
};
# environment.etc = {
# nixos.source = ../..;
# };
}

View File

@@ -1,24 +0,0 @@
{...}: {
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
useDHCP = false;
nameservers = [
"192.168.1.1"
"192.168.1.250"
"8.8.8.8"
"8.8.4.4"
];
defaultGateway = {
address = "192.168.1.1";
};
interfaces.eth0 = {
ipv4.addresses = [
{
address = "192.168.1.230";
prefixLength = 24;
}
];
};
};
}

View File

@@ -1,7 +0,0 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBRqPpgqp6hRtY97TI6Mz5vDrhL62QDJsO7oZtkOacFwAAAAJAcdclzHHXJ
cwAAAAtzc2gtZWQyNTUxOQAAACBRqPpgqp6hRtY97TI6Mz5vDrhL62QDJsO7oZtkOacFwA
AAAEC5jt0tLdgOmfZOlDMV4bDqH5Q4/8/mYmVdQxGwArBYaVGo+mCqnqFG1j3tMjozPm8O
uEvrZAMmw7uhm2Q5pwXAAAAAC3Jvb3RASHlwZXJWAQI=
-----END OPENSSH PRIVATE KEY-----

View File

@@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFGo+mCqnqFG1j3tMjozPm8OuEvrZAMmw7uhm2Q5pwXA root@HyperV

View File

@@ -1,49 +0,0 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2g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9vdEBIeXBlclY=
-----END OPENSSH PRIVATE KEY-----

View File

@@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFr00AO9ojy2RbfV2ECYnBtw/RvGGRIy7dDGuDACieuHb3DgdtbLx3ovZIQtRk+Dz8unw+a0Tve6wS2elym4smQ7onY1efosw9kkfS5ReEjIqNpRpPjfrlJm6+Jnhk+Ps1h5pYFzkTXlnlgZJeaOOV5LL8s2k8vMZVGW9dDrHbeQkCOZfPWIFnN+m8E0OLo0zAxVwMMCDrjwjxiXUz/HESxyGpiZ1AbWHVnByp97AyMbnCBcqqmm6NAnN87m7WF79MrTGfLOFwp615huhSVGOQmszR3Xwm3u6F/vG0FSreiXvMxirS+dYZ2/d3+oUCh90Zs7oCiVTUe6Ty2rtj8DzIwj97HrJFTs6HHHa7lH7YUAG0iI86Tr9rlgWtZ1Nwl7LKqyHUnZtKQ3t4G11CYneQfgjVsUsUcTDuteOIsL9MmWdh/r4IGLV8n6ub3XOrmr0jvzrpJzib6OaQLsyGjrD+PqtHSujzwNIgH06/fqnGS6P4i57ahI986HSsKhW3qH3fAejWpNWMaWgvNcOkgVzlot2MPw5nJBjjY41ilndt0p3YNqGu0uh1e4zz5PAY5xseuu/UyQaghUndmGXKPxsKOyTcDW6mHOdBI12dxlJHC0BwqpwLy95FIWinniiE28o1jZA682auG3zbGVE1WHePrlbJNBVL2HMpH+pkj7eyiw== root@HyperV

View File

@@ -3,23 +3,10 @@
pkgs,
lib,
...
}:
with lib; let
cfg = config.custom.beets;
in {
options.custom.beets = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Beets";
};
};
config = mkIf cfg.enable {
}:{
home.packages = [
pkgs.ffmpeg # for replaygain
];
sops = {
secrets.discogs_json = {
path = "${config.xdg.configHome}/beets/discogs_token.json";
@@ -168,5 +155,4 @@ in {
};
};
};
};
}

View File

@@ -1,65 +0,0 @@
{
#inputs,
lib,
pkgs,
config,
#outputs,
...
}: {
imports =
[
# ./beets.nix
# ./keybase.nix
"${inputs.vscode-server}/modules/vscode-server/home.nix"
];
# ++ (builtins.attrValues outputs.homeManagerModules);
###dotfiles path variable
options._dotfiles = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/home-manager/dotfiles";
description = "Path to the dotfiles in this repository";
};
###secrets path variable
options._secrets = lib.mkOption {
type = lib.types.str;
default = "/run/user/1000/secrets/";
description = "Path to the Secrets runtime";
};
###secretstore path variable
options._secretstore = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/secrets/";
description = "Path to the Secrets storage";
};
config = {
#nixpkgs = {
# overlays = builtins.attrValues outputs.overlays;
# config = {
# allowUnfree = true;
# allowUnfreePredicate = _: true;
# };
#};
#nix = {
# package = lib.mkDefault pkgs.nix;
# settings = {
# experimental-features = ["nix-command" "flakes" "repl-flake"];
# warn-dirty = false;
# };
#};
##VSCode
services.vscode-server.enable = true;
services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs-18_x;
programs = {
home-manager.enable = true;
git.enable = true;
};
};
}

20
home-manager/keybase.nix Normal file
View File

@@ -0,0 +1,20 @@
{
config,
pkgs,
inputs,
lib,
util,
hostName,
...
}:{
services.keybase.enable = true;
services.kbfs.enable = true;
systemd.user.services.keybase.Unit.After = ["sops-nix.service"];
systemd.user.services.kbfs.Unit.After = ["sops-nix.service"];
sops = {
secrets = hm_secrets "$../secrets/user_dotfiles/${username}@${hostName}/keybase/" "${config.xdg.configHome}/keybase/";
};
}

View File

@@ -3,21 +3,8 @@
pkgs,
config,
...
}:
with lib; let
cfg = config.custom.ssh-proxy;
in {
options.custom.ssh-proxy = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable ssh-proxy for WSL
'';
};
};
config = mkIf cfg.enable {
}:{
home.packages = with pkgs; [
npiperelay
socat
@@ -41,5 +28,4 @@ in {
};
};
};
};
}

View File

@@ -8,6 +8,10 @@
imports = [
../common.nix
../user-sstent.nix
../wsl.nix
../syncthing.nix
../mnt_public.nix
../vpn.nix
inputs.nixos-wsl.nixosModules.wsl
];

View File

@@ -12,27 +12,6 @@
inputs.sops-nix.nixosModules.sops
];
###dotfiles path variable
options._dotfiles = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/home-manager/dotfiles";
description = "Path to the dotfiles in this repository";
};
###secrets path variable
options._secrets = lib.mkOption {
type = lib.types.str;
default = "/run/user/1000/secrets";
description = "Path to the Secrets runtime";
};
###secretstore path variable
options._secretstore = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/secrets";
description = "Path to the Secrets storage";
};
config = {
system.stateVersion = "23.05";
@@ -41,18 +20,10 @@
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
};
home-manager = {
useUserPackages = true;
#extraSpecialArgs = {inherit inputs outputs;};
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
];
};
nixpkgs.config.allowUnfree = true;
programs.fuse.userAllowOther = true;
security.sudo.wheelNeedsPassword = false;
virtualisation.docker.enable = true;
virtualisation.docker.enable = true;
# nixpkgs.overlays = overlays;
# Enable nix flakes
@@ -64,6 +35,12 @@
# nix.nixPath = [ "nixpkgs=pkgs.outPath" ];
networking.search = ["node.dc1.consul" "service.dc1.consul"];
##VSCode
services.vscode-server.enable = true;
services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs-18_x;
#services.envfs.enable = true;
environment.systemPackages = [
pkgs.git

View File

@@ -1,44 +0,0 @@
{ system, self, nixpkgs, inputs, ... }:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # Allow proprietary software
};
lib = nixpkgs.lib;
in
{
StuPC-WSL = lib.nixosSystem {
# Laptop profile
inherit system;
specialArgs = { inherit inputs; };
modules = [
#../home-manager #hyprland and sway,go to this dir,choose one
] ++ [
./common.nix
] ++ [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# extraSpecialArgs = { inherit user; };
users.sstent = {
imports = [
(import ../home-manager)
] ++ [
];
};
};
nixpkgs = {
overlays =
[
self.overlays.default
];
};
}
];
};
}

View File

@@ -8,6 +8,10 @@
imports = [
../common.nix
../user-sstent.nix
../wsl.nix
../syncthing.nix
../mnt_public.nix
../vpn.nix
inputs.nixos-wsl.nixosModules.wsl
];

View File

@@ -4,18 +4,13 @@
outputs,
config,
...
}:
with lib; let
cfg = config.custom.mnt_public;
in {
options.custom.mnt_public.enable = mkEnableOption "Enable mnt/Public";
}:{
config = mkIf cfg.enable {
fileSystems."/mnt/Public" = {
device = "//192.168.1.109/Public";
fsType = "cifs";
# options = ["uid=0,gid=1000"];
options = ["guest" "uid=1000"];
};
};
}

View File

@@ -3,14 +3,8 @@
pkgs,
config,
...
}:
with lib; let
cfg = config.custom.sshd;
in {
}:{
#define option to enable this
options.custom.sshd.enable = mkEnableOption "Enable SSH";
config = mkIf cfg.enable {
services.openssh = {
enable = true;
permitRootLogin = "no";
@@ -18,5 +12,5 @@ in {
};
networking.firewall.allowedTCPPorts = [22];
};
}

View File

@@ -5,12 +5,7 @@
config,
...
}:
with lib; let
cfg = config.custom.syncthing;
in {
options.custom.syncthing.enable = mkEnableOption "Enable mnt/Public";
config = mkIf cfg.enable {
{
services.syncthing = {
enable = true;
dataDir = "/home/sstent";
@@ -33,5 +28,5 @@ in {
};
};
};
};
}

View File

@@ -6,12 +6,8 @@
pkgs,
...
}:
with lib; let
cfg = config.custom.wsl;
in {
options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings";
{
config = mkIf cfg.enable {
# Enable native Docker support
virtualisation.docker.enable = true;
@@ -53,5 +49,4 @@ in {
};
wantedBy = ["sysinit.target"];
};
};
}

View File

@@ -1,24 +0,0 @@
{lib, ...}:
with builtins;
with lib; rec {
# attrsToList
attrsToList = attrs:
mapAttrsToList (name: value: {inherit name value;}) attrs;
# mapFilterAttrs ::
# (name -> value -> bool)
# (name -> value -> { name = any; value = any; })
# attrs
mapFilterAttrs = pred: f: attrs: filterAttrs pred (mapAttrs' f attrs);
# Generate an attribute set by mapping a function over a list of values.
genAttrs' = values: f: listToAttrs (map f values);
# anyAttrs :: (name -> value -> bool) attrs
anyAttrs = pred: attrs:
any (attr: pred attr.name attr.value) (attrsToList attrs);
# countAttrs :: (name -> value -> bool) attrs
countAttrs = pred: attrs:
count (attr: pred attr.name attr.value) (attrsToList attrs);
}

View File

@@ -1,37 +0,0 @@
# {lib}:
# lib.makeExtensible (self:
# let
# callLibs = file: import file { lib = self; };
# in
# rec {
# ## Define your own library functions here!
# #id = x: x;
# ## Or in files, containing functions that take {lib}
# map = callLibs ./map.nix;
# ## In configs, they can be used under "lib.our"
# })
{
inputs,
lib,
pkgs,
...
}: let
inherit (lib) makeExtensible attrValues foldr;
inherit (modules) mapModules;
modules = import ./modules.nix {
inherit lib;
self.attrs = import ./attrs.nix {
inherit lib;
self = {};
};
};
mylib = makeExtensible (self:
with self;
mapModules ./.
(file: import file {inherit self lib pkgs inputs;}));
in
mylib.extend
(self: super:
foldr (a: b: a // b) {} (attrValues super))

View File

@@ -1,32 +0,0 @@
{
lib,
pkgs,
...
}:
with builtins;
with lib; {
toCSSFile = file: let
fileName = removeSuffix ".scss" (baseNameOf file);
compiledStyles =
pkgs.runCommand "compileScssFile"
{buildInputs = [pkgs.sass];} ''
mkdir "$out"
scss --sourcemap=none \
--no-cache \
--style compressed \
--default-encoding utf-8 \
"${file}" \
>>"$out/${fileName}.css"
'';
in "${compiledStyles}/${fileName}.css";
toFilteredImage = imageFile: options: let
result = "result.png";
filteredImage =
pkgs.runCommand "filterWallpaper"
{buildInputs = [pkgs.imagemagick];} ''
mkdir "$out"
convert ${options} ${imageFile} $out/${result}
'';
in "${filteredImage}/${result}";
}

View File

@@ -1,30 +0,0 @@
{lib, ...}: let
inherit
(builtins)
readDir
;
inherit
(lib)
filterAttrs
hasPrefix
hasSuffix
mapAttrs'
nameValuePair
;
in rec {
filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
# 'sops' Encrypted Secrets
hm_secrets = dir: out_dir:
filter (name: type: type != null && !(hasPrefix "_" name)) (name: type:
# if type == "regular" && hasSuffix ".age" name
if type == "regular"
then
nameValuePair name {
sopsFile = dir + "/${name}";
format = "binary";
path = out_dir + "/${name}";
}
else nameValuePair "" null) (readDir dir);
}

View File

@@ -1,60 +0,0 @@
{
self,
lib,
...
}: let
inherit (builtins) attrValues readDir pathExists concatLists;
inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix;
inherit (self.attrs) mapFilterAttrs;
in rec {
mapModules = dir: fn:
mapFilterAttrs
(n: v:
v
!= null
&& !(hasPrefix "_" n))
(n: v: let
path = "${toString dir}/${n}";
in
if v == "directory" && pathExists "${path}/default.nix"
then nameValuePair n (fn path)
else if
v
== "regular"
&& n != "default.nix"
&& hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null)
(readDir dir);
mapModules' = dir: fn:
attrValues (mapModules dir fn);
mapModulesRec = dir: fn:
mapFilterAttrs
(n: v:
v
!= null
&& !(hasPrefix "_" n))
(n: v: let
path = "${toString dir}/${n}";
in
if v == "directory"
then nameValuePair n (mapModulesRec path fn)
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null)
(readDir dir);
mapModulesRec' = dir: fn: let
dirs =
mapAttrsToList
(k: _: "${dir}/${k}")
(filterAttrs
(n: v: v == "directory" && !(hasPrefix "_" n))
(readDir dir));
files = attrValues (mapModules dir id);
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
in
map fn paths;
}

View File

@@ -1,29 +0,0 @@
{
inputs,
lib,
pkgs,
...
}:
with lib;
with lib.my; let
sys = "x86_64-linux";
in {
mkHost = path: attrs @ {system ? sys, ...}:
nixosSystem {
inherit system;
specialArgs = {inherit lib inputs system;};
modules = [
{
nixpkgs.pkgs = pkgs;
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
}
(filterAttrs (n: v: !elem n ["system"]) attrs)
../. # /default.nix
(import path)
];
};
mapHosts = dir: attrs @ {system ? system, ...}:
mapModules dir
(hostPath: mkHost hostPath attrs);
}

View File

@@ -1,16 +0,0 @@
{lib, ...}: let
inherit (lib) mkOption types;
in rec {
mkOpt = type: default:
mkOption {inherit type default;};
mkOpt' = type: default: description:
mkOption {inherit type default description;};
mkBoolOpt = default:
mkOption {
inherit default;
type = types.bool;
example = true;
};
}

View File

@@ -1,10 +0,0 @@
{ config, lib, pkgs, ... }: { imports = [
./nixos/mnt_public
./nixos/ssh
./nixos/syncthing
./nixos/vpn
./nixos/wsl2
]; }

View File

@@ -1,8 +0,0 @@
{ config, lib, pkgs, ... }: { imports = [
./home-manager/beets
./home-manager/keybase
./home-manager/ssh-proxy
]; }

View File

@@ -1,34 +0,0 @@
{
config,
pkgs,
inputs,
lib,
util,
hostName,
...
}:
with lib;
with lib.my; let
cfg = config.custom.keybase;
username = config.home.username;
secretstore = config._secretstore;
in {
options.custom.keybase = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable KeyBase";
};
};
config = mkIf cfg.enable {
services.keybase.enable = true;
services.kbfs.enable = true;
systemd.user.services.keybase.Unit.After = ["sops-nix.service"];
systemd.user.services.kbfs.Unit.After = ["sops-nix.service"];
sops = {
secrets = hm_secrets "${secretstore}/user_dotfiles/${username}@${hostName}/keybase/" "${config.xdg.configHome}/keybase/";
};
};
}

View File

@@ -1,18 +0,0 @@
{
lib,
pkgs,
config,
...
}:
with lib; let
secretstore = config._secretstore;
host = config.networking.hostName;
secretpath = "${secretstore}/hosts/${host}/mullvad/device.json";
in {
sops.secrets.device_json = {
sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json";
device_json.format = "binary";
};
environment.etc."mullvad-vpn/device.conf".source = config.sops.secrets.device_json.path;
}

View File

@@ -1,23 +0,0 @@
# This file defines overlays
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs {pkgs = final;};
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}

View File

@@ -1,12 +0,0 @@
rec{
overlay = final: prev:
let
dirContents = builtins.readDir ../pkgs;
genPackage = name: {
inherit name;
value = final.callPackage (../pkgs + "/${name}") { };
};
names = builtins.attrNames dirContents;
in
builtins.listToAttrs (map genPackage names);
}

View File

@@ -1,52 +0,0 @@
{
lib,
stdenv,
fetchurl,
unzip,
}: let
version = "1.6.3";
srcs = {
x86_64-linux = fetchurl {
url = "https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip";
sha256 = "sha256-a572H/0XwDUHqaPVTYFdzrPa5mmsZ/w79CJdHnZM5fY=";
};
# aarch64-linux = fetchurl {
# url =
# "https://deconz.dresden-elektronik.de/debian/stable/deconz_${version}-debian-buster-stable_arm64.deb";
# sha256 = "sha256-zuy4e9bzcRqDeXP6mfzZLCDK/3we25LH6xktnO6HXps=";
# };
};
in
stdenv.mkDerivation rec {
pname = "npiperelay";
inherit version;
src = srcs.${stdenv.hostPlatform.system};
nativeBuildInputs = [unzip];
#buildInputs = [ qtserialport qtwebsockets ];
unpackPhase = ''
mkdir npiperelay-$version
cd npiperelay-$version
unzip $src
'';
#unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
mkdir -p $out/bin
cp npiperelay.exe $out/bin/npiperelay.exe
chmod +x $out/bin/npiperelay.exe
'';
meta = with lib; {
description = "Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)";
# 2019-08-19: The homepage links to old software that doesn't even work --
# it fails to detect ConBee2.
homepage = "https://github.com/rupor-github/wsl-ssh-agent";
license = licenses.free;
platforms = ["x86_64-linux"];
maintainers = with maintainers; [sstent];
};
}