Merge pull request 'waypipe: mark only supported on Linux' (#2573) from sandbox into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/2573
This commit is contained in:
Mic92
2024-12-11 14:38:36 +00:00
8 changed files with 74 additions and 25 deletions

5
docs/README.md Normal file
View File

@@ -0,0 +1,5 @@
# Serve documentation locally
```
$ nix develop .#docs -c mkdocs serve
```

View File

@@ -11,8 +11,11 @@
treefmt.programs.nixfmt.enable = true;
treefmt.programs.nixfmt.package = pkgs.nixfmt-rfc-style;
treefmt.programs.deadnix.enable = true;
treefmt.programs.clang-format.enable = true;
treefmt.settings.global.excludes = [
"*.png"
"*.svg"
"package-lock.json"
"*.jpeg"
"*.gitignore"
".vscode/*"
@@ -24,6 +27,44 @@
"*.age"
"*.list"
"*.desktop"
# ignore symlink
"docs/site/manual/contribute.md"
"*_test_cert"
"*_test_key"
"*/gnupg-home/*"
"*/sops/secrets/*"
"vars/*"
# prettier messes up our mkdocs flavoured markdown
"*.md"
"checks/lib/ssh/privkey"
"checks/lib/ssh/pubkey"
"checks/matrix-synapse/synapse-registration_shared_secret"
"checks/mumble/machines/peer1/facts/mumble-cert"
"checks/mumble/machines/peer2/facts/mumble-cert"
"checks/secrets/clan-secrets"
"checks/secrets/sops/groups/group/machines/machine"
"checks/syncthing/introducer/introducer_device_id"
"checks/syncthing/introducer/introducer_test_api"
"docs/site/static/asciinema-player/asciinema-player.css"
"docs/site/static/asciinema-player/asciinema-player.min.js"
"nixosModules/clanCore/vars/secret/sops/eval-tests/populated/vars/my_machine/my_generator/my_secret"
"pkgs/clan-cli/tests/data/gnupg.conf"
"pkgs/clan-cli/tests/data/password-store/.gpg-id"
"pkgs/clan-cli/tests/data/ssh_host_ed25519_key"
"pkgs/clan-cli/tests/data/sshd_config"
"pkgs/clan-vm-manager/.vscode/lhebendanz.weaudit"
"pkgs/clan-vm-manager/bin/clan-vm-manager"
"pkgs/distro-packages/vagrant_insecure_key"
"sops/secrets/test-backup-age.key/secret"
];
treefmt.settings.formatter.ruff-format.includes = [
"*/bin/clan"
"*/bin/clan-app"
"*/bin/clan-config"
];
treefmt.settings.formatter.shellcheck.includes = [
"scripts/pre-commit"
];
treefmt.programs.prettier = {
enable = true;
@@ -32,6 +73,7 @@
"*.css"
"*.html"
"*.js"
"*.json"
"*.json5"
"*.jsx"
"*.mdx"

View File

@@ -1,4 +1,5 @@
import contextlib
import platform
import socket
import subprocess
import time
@@ -11,6 +12,9 @@ VMADDR_CID_HYPERVISOR = 2
def test_vsock_port(port: int) -> bool:
if platform.system() != "Linux":
msg = "vsock is only supported on Linux"
raise NotImplementedError(msg)
try:
s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM)
s.connect((VMADDR_CID_HYPERVISOR, port))

View File

@@ -1,10 +1,10 @@
#define _GNU_SOURCE
#include <dlfcn.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <pwd.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct passwd *(*getpwnam_type)(const char *name);

View File

@@ -10,9 +10,7 @@
},
"options": {
"nixos": {
"expr": "(let pkgs = import <nixpkgs> { }; in (pkgs.lib.evalModules { modules
= (import <nixpkgs/nixos/modules/module-list.nix>) ++ [ ({...}: {
nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options"
"expr": "(let pkgs = import <nixpkgs> { }; in (pkgs.lib.evalModules { modules = (import <nixpkgs/nixos/modules/module-list.nix>) ++ [ ({...}: { nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options"
},
"home-manager": {
"expr": "(builtins.getFlake \"github:nix-community/home-manager\").homeConfigurations.<name>.options"

View File

@@ -12,21 +12,21 @@ typedef uint32_t uid_t;
};
#define WRAPPER(ret, name) static ret _fakeroot_wrapper_##name
#define WRAPPER_DEF(name) \
__attribute__((used)) static struct dyld_interpose _fakeroot_interpose_##name \
__attribute__((section("__DATA,__interpose"))) = { &_fakeroot_wrapper_##name, &name };
__attribute__(( \
used)) static struct dyld_interpose _fakeroot_interpose_##name \
__attribute__((section("__DATA,__interpose"))) = { \
&_fakeroot_wrapper_##name, &name};
#else
#define WRAPPER(ret, name) ret name
#define WRAPPER_DEF(name)
#endif
WRAPPER(uid_t, geteuid)(const char * path, int flags, ...)
{
WRAPPER(uid_t, geteuid)(const char *path, int flags, ...) {
return 0; // Fake root
}
WRAPPER_DEF(geteuid)
WRAPPER(uid_t, getuid)(const char * path, int flags, ...)
{
WRAPPER(uid_t, getuid)(const char *path, int flags, ...) {
return 0; // Fake root
}
WRAPPER_DEF(getuid)