1
0
forked from clan/clan-core

clanModule.sshd: Deactivate password auth. Change flake template to every machine having its own disko.nix file.

This commit is contained in:
Luis Hebendanz 2024-05-20 19:11:12 +02:00
parent da5f363bee
commit c8456f7d68
9 changed files with 56 additions and 82 deletions

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }:
{
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = false;
services.openssh.hostKeys = [
{

View File

@ -121,9 +121,6 @@ theme:
icon: material/weather-sunny
name: Switch to light mode
extra_javascript:
- static/main.js
extra_css:
- static/asciinema-player/custom-theme.css
- static/asciinema-player/asciinema-player.css

View File

@ -1,72 +0,0 @@
let preferDarkTheme = prefersDarkMode();
let theme = localStorage.getItem('theme');
if (theme !== null) {
setColorTheme(theme);
} else {
setColorTheme(preferDarkTheme ? "dark" : "light");
}
// Get the media query list object for the prefers-color-scheme media feature
const colorSchemeQueryList = window.matchMedia("(prefers-color-scheme: dark)");
// Add an event listener for the change event
colorSchemeQueryList.addEventListener("change", handleColorSchemeChange);
function setColorTheme(theme) {
if (theme === "dark") {
document.body.setAttribute('data-md-color-scheme', 'slate');
document.body.setAttribute('data-md-color-media', '(prefers-color-scheme: dark)')
localStorage.setItem('theme', 'dark');
} else {
document.body.setAttribute('data-md-color-scheme', 'default');
document.body.setAttribute('data-md-color-media', '(prefers-color-scheme: light)')
localStorage.setItem('theme', 'light');
}
}
// A function that returns true if the user prefers dark mode, false otherwise
function prefersDarkMode() {
// Check if the browser supports the prefers-color-scheme media query
if (window.matchMedia) {
// Get the current value of the media query
let colorScheme = window.matchMedia("(prefers-color-scheme: dark)");
// Return true if the media query matches, false otherwise
return colorScheme.matches;
} else {
// If the browser does not support the media query, return false by default
return false;
}
}
// A function that executes some logic based on the color scheme preference
function handleColorSchemeChange(e) {
if (e.matches) {
// The user prefers dark mode
setColorTheme("dark");
} else {
// The user prefers light mode
setColorTheme("light");
}
}
// Detects if user pressed on the "change theme" button
document.addEventListener('DOMContentLoaded', function () {
function handleThemeChange() {
const isDarkMode = document.body.getAttribute('data-md-color-media').includes('dark');
console.log(`Theme is now ${isDarkMode ? 'dark' : 'light'}`);
// Detect the current theme
}
// Initial check
handleThemeChange();
// MutationObserver to detect changes to the `data-md-color-scheme` attribute
const observer = new MutationObserver(handleThemeChange);
observer.observe(document.body, {
attributes: true,
attributeFilter: ['data-md-color-media']
});
});

View File

@ -23,7 +23,6 @@
jon = {
imports = [
./modules/shared.nix
./modules/disko.nix
./machines/jon/configuration.nix
];
@ -56,7 +55,6 @@
sara = {
imports = [
./modules/shared.nix
./modules/disko.nix
./machines/sara/configuration.nix
];

View File

@ -3,7 +3,13 @@ let
username = config.networking.hostName;
in
{
imports = [ ./hardware-configuration.nix ];
imports = [
./hardware-configuration.nix
./disko.nix
];
# Locale service discovery and mDNS
services.avahi.enable = true;
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;

View File

@ -4,7 +4,13 @@ let
username = config.networking.hostName;
in
{
imports = [ ./hardware-configuration.nix ];
imports = [
./hardware-configuration.nix
./disko.nix
];
# Locale service discovery and mDNS
services.avahi.enable = true;
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;

View File

@ -0,0 +1,41 @@
{ lib, ... }:
{
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disk = {
main = {
type = "disk";
# Set the following in flake.nix for each maschine:
# device = <uuid>;
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@ -4,7 +4,4 @@
clan-core.clanModules.sshd
clan-core.clanModules.root-password
];
# Locale service discovery and mDNS
services.avahi.enable = true;
}