Compare commits

..

3 Commits

Author SHA1 Message Date
Guilhem Saurel
45720e29a8 clanServices/wifi: fix for multiple instances
Without this, `nix build .#checks.x86_64-linux.wifi` fails with:
```
error: The option `nodes.first.systemd.services.NetworkManager-setup-secrets.serviceConfig.ExecStart' has conflicting definition values:
- In `/nix/store/x0…45-source/clanServices/wifi/default.nix, via option mappedServices."self-@clan/wifi".roles.default.perInstance, via option nixosModule': <derivation wifi-secrets>
- In `/nix/store/x0…45-source/clanServices/wifi/default.nix, via option mappedServices."self-@clan/wifi".roles.default.perInstance, via option nixosModule': <derivation wifi-secrets>
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
```
2025-07-16 14:02:03 +02:00
Guilhem Saurel
dfce4e6cd5 clanServices/wifi: update test with a second instance 2025-07-16 14:02:03 +02:00
Jörg Thalheim
5d070511a9 waypipe: disable gpu for now 2025-07-16 14:02:03 +02:00
7 changed files with 20 additions and 131 deletions

View File

@@ -39,7 +39,7 @@ in
};
perInstance =
{ settings, ... }:
{ instanceName, settings, ... }:
{
nixosModule =
{ pkgs, config, ... }:
@@ -86,7 +86,7 @@ in
# service to generate the environment file containing all secrets, as
# expected by the nixos NetworkManager-ensure-profile service
systemd.services.NetworkManager-setup-secrets = {
systemd.services."NetworkManager-setup-secrets-${instanceName}" = {
description = "Generate wifi secrets for NetworkManager";
requiredBy = [ "NetworkManager-ensure-profiles.service" ];
partOf = [ "NetworkManager-ensure-profiles.service" ];

View File

@@ -7,8 +7,16 @@
inventory = {
machines.test = { };
machines.second = { };
instances = {
wg-test-all = {
module.name = "@clan/wifi";
module.input = "self";
roles.default.tags.all = { };
roles.default.settings.networks.all = { };
};
wg-test-one = {
module.name = "@clan/wifi";
module.input = "self";

View File

@@ -1,6 +1,14 @@
{% extends "base.html" %} {% block extrahead %}
<style>
.md-main__inner {
max-width: 100% !important;
}
.md-content {
max-width: 100% !important;
}
.md-main__inner {
margin-top: 0 !important;
}
</style>
{% endblock %} {% block site_nav %}{% endblock %} {% block content %} {{
page.content }} {% endblock %}

View File

@@ -2,86 +2,5 @@
template: options.html
---
<script>
const variables = [
'--md-default-bg-color',
'--md-default-fg-color',
'--md-default-fg-color--light',
'--md-default-fg-color--lightest'
];
let colorScheme = 'default';
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes' && mutation.attributeName === 'data-md-color-scheme') {
colorScheme = mutation.target.getAttribute('data-md-color-scheme');
console.log('color scheme changed', colorScheme);
}
});
});
observer.observe(document.body, {
attributes: true,
attributeFilter: ['data-md-color-scheme']
});
function syncCSSVariables() {
const iframe = document.getElementById('options-frame');
console.log('syncing css variables', iframe);
const iframeDoc = iframe.contentWindow.document;
const iframeRoot = iframeDoc.documentElement;
const targetElement = document.querySelector(`[data-md-color-scheme="${colorScheme}"]`);
const parentStyles = getComputedStyle(targetElement);
console.log('parent styles', parentStyles);
variables.forEach(varName => {
const value = parentStyles.getPropertyValue(varName);
if (value.trim()) {
console.log('setting', varName, value);
iframeRoot.style.setProperty(varName, value.trim());
}
});
// add our custom styling
addCustomCSS(iframe);
}
function addCustomCSS(iframe) {
const iframeDoc = iframe.contentWindow.document;
const cssLink = iframeDoc.createElement('link');
cssLink.id = "clan-css";
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
cssLink.href = "/static/options.css";
iframeDoc.head.appendChild(cssLink);
}
function onIFrameLoad() {
const iframe = document.getElementById('options-frame');
// initial sync of css variables
syncCSSVariables(iframe);
// listen for theme changes
const darkModeQuery = window.matchMedia('(prefers-color-scheme: dark)');
const lightModeQuery = window.matchMedia('(prefers-color-scheme: light)');
darkModeQuery.addEventListener('change', syncCSSVariables);
lightModeQuery.addEventListener('change', syncCSSVariables);
}
</script>
<iframe id="options-frame" src="/options-page/" onload="onIFrameLoad()" height="1000" width="100%"></iframe>
[asciinema-player](static/asciinema-player)
<iframe src="/options-page/" height="1000" width="100%"></iframe>

View File

@@ -20,7 +20,3 @@
.md-nav__item.md-nav__item--section > label > span {
color: var(--md-typeset-a-color);
}
iframe {
border: none;
}

View File

@@ -1,42 +0,0 @@
@font-face {
font-family: "Roboto";
src: url(./Roboto-Regular.ttf) format("truetype");
}
@font-face {
font-family: "Fira Code";
src: url(./FiraCode-VF.ttf) format("truetype");
}
:root {
--f-family: "Roboto";
--f-family-mono: "Fira Code";
--c-page: var(--md-default-bg-color);
--c-card: transparent;
}
header h1 {
color: var(--md-default-fg-color--light);
}
div.card {
border: .05rem solid var(--md-default-fg-color--lightest) !important;
}
form {
label {
gap: 1rem;
input {
background-color: #00000042 !important;
&:hover {
background-color: #ffffff1f !important;
}
}
}
}