MMore stuff

This commit is contained in:
fwastring 2025-09-15 21:08:36 +02:00
parent 01c04cd91c
commit 35fd1799a2
18 changed files with 62 additions and 291 deletions

View file

@ -45,52 +45,43 @@
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
laptop = nixpkgs.lib.nixosSystem {
legacy = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
myhostname = "laptop";
myhostname = "legacy";
};
modules = [
./maskiner/laptop/configuration.nix
./maskiner/legacy/configuration.nix
];
};
desktop = nixpkgs.lib.nixosSystem {
node = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
myhostname = "desktop";
myhostname = "node";
};
modules = [
./maskiner/desktop/configuration.nix
./maskiner/node/configuration.nix
sops-nix.nixosModules.sops
];
};
jobb = nixpkgs.lib.nixosSystem {
core = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
myhostname = "jobb";
myhostname = "core";
};
modules = [
./maskiner/jobb/configuration.nix
./maskiner/core/configuration.nix
stylix.nixosModules.stylix
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
];
};
work-desktop = nixpkgs.lib.nixosSystem {
archive = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
myhostname = "work-desktop";
myhostname = "archive";
};
modules = [
./maskiner/work-desktop/configuration.nix
];
};
macmini = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
myhostname = "macmini";
};
modules = [ ./maskiner/macmini/configuration.nix ];
modules = [ ./maskiner/archive/configuration.nix ];
};
};
};

View file

@ -18,12 +18,12 @@
];
alloy = {
enable = true;
configPath = ./alloy-systemd.yaml;
enable = true;
configPath = ./alloy-systemd.yaml;
};
nixpkgs.config.permittedInsecurePackages = [
"broadcom-sta-6.30.223.271-57-6.12.45"
"broadcom-sta-6.30.223.271-57-6.12.47"
];
nix.settings = {

View file

@ -26,11 +26,12 @@ in
../../moduler/lsp.nix
../../moduler/hyprland.nix
../../moduler/sound.nix
../../moduler/programs/kubernetes-tools.nix
../../moduler/programs/kubernetes-tools.nix
];
kubernetes-tools.enable = true;
sops.defaultSopsFile = ../../secrets/sops.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.secrets.gandi_key = {
@ -46,14 +47,14 @@ in
};
programs.ssh.knownHosts = {
desktop = {
extraHostNames = [ "192.168.1.227" ];
publicKeyFile = ../../keys/rsa_pubkey;
};
"192.168.1.227" = {
publicKeyFile = ../../keys/rsa_pubkey;
};
};
desktop = {
extraHostNames = [ "192.168.1.227" ];
publicKeyFile = ../../keys/rsa_pubkey;
};
"192.168.1.227" = {
publicKeyFile = ../../keys/rsa_pubkey;
};
};
home-manager.extraSpecialArgs = { inherit inputs pkgs; };
home-manager.users.fw = {

View file

@ -20,7 +20,7 @@
../../moduler/signal.nix
../../moduler/uptime-kuma.nix
../../moduler/services/monitoring
../../moduler/services/wireguard-server
../../moduler/services/headscale
# ../../moduler/wastring.nix
];
@ -38,18 +38,22 @@
domain = "grafana.wastring.com";
};
headscale = {
enable = true;
};
prometheus = {
enable = true;
exporters.enable = true;
exporters.enable = true;
};
loki = {
enable = true;
enable = true;
};
alloy = {
enable = true;
configPath = ./alloy-systemd.yaml;
enable = true;
configPath = ./alloy-systemd.yaml;
};
nix.settings = {

View file

@ -1,114 +0,0 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
lib,
config,
pkgs,
myhostname,
...
}:
{
# You can import other NixOS modules here
imports = [
./hardware-configuration.nix
../../moduler/openssh.nix
../../moduler/users.nix
../../moduler/dev.nix
../../moduler/lsp.nix
../../moduler/network.nix
../../moduler/system.nix
../../moduler/k3s.nix
];
nixpkgs = {
overlays = [
];
config = {
allowUnfree = true;
};
};
nix.registry = (lib.mapAttrs (_: flake: { inherit flake; })) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
);
nix.nixPath = [ "/etc/nix/path" ];
users.defaultUserShell = pkgs.bash;
programs.fish.enable = true;
programs.bash = {
interactiveShellInit = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
environment.etc = lib.mapAttrs' (name: value: {
name = "nix/path/${name}";
value.source = value.flake;
}) config.nix.registry;
nix.settings = {
experimental-features = "nix-command flakes";
auto-optimise-store = true;
};
# virtualisation.containers.enable = true;
virtualisation = {
# podman = {
# enable = true;
#
# # Create a `docker` alias for podman, to use it as a drop-in replacement
# dockerCompat = true;
#
# # Required for containers under podman-compose to be able to talk to each other.
# defaultNetwork.settings.dns_enabled = true;
# };
docker = {
enable = true;
liveRestore = false;
};
};
networking.networkmanager.enable = true;
environment.sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERM = "xterm-256color";
};
time.timeZone = "Europe/Stockholm";
fonts.packages = with pkgs; [
nerd-fonts.comic-shanns-mono
nerd-fonts.fira-code
];
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "sv_SE.UTF-8";
LC_IDENTIFICATION = "sv_SE.UTF-8";
LC_MEASUREMENT = "sv_SE.UTF-8";
LC_MONETARY = "sv_SE.UTF-8";
LC_NAME = "sv_SE.UTF-8";
LC_NUMERIC = "sv_SE.UTF-8";
LC_PAPER = "sv_SE.UTF-8";
LC_TELEPHONE = "sv_SE.UTF-8";
LC_TIME = "sv_SE.UTF-8";
};
console.keyMap = "sv-latin1";
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
networking.hostName = myhostname;
services.xserver.dpi = 140;
system.stateVersion = "25.05";
}

View file

@ -1,101 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Stockholm";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "sv_SE.UTF-8";
LC_IDENTIFICATION = "sv_SE.UTF-8";
LC_MEASUREMENT = "sv_SE.UTF-8";
LC_MONETARY = "sv_SE.UTF-8";
LC_NAME = "sv_SE.UTF-8";
LC_NUMERIC = "sv_SE.UTF-8";
LC_PAPER = "sv_SE.UTF-8";
LC_TELEPHONE = "sv_SE.UTF-8";
LC_TIME = "sv_SE.UTF-8";
};
# Configure keymap in X11
services.xserver.xkb = {
layout = "se";
variant = "";
};
# Configure console keymap
console.keyMap = "sv-latin1";
# Define a user account. Don't forget to set a password with passwd.
users.users.fw = {
isNormalUser = true;
description = "Fredrik Wastring";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
git
ssh
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}

View file

@ -1,31 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/a73a76fd-122b-4b72-904c-0c2ab22c36b1";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -92,6 +92,13 @@
enable = true;
};
services.tailscale.enable = true;
networking.firewall = {
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ config.services.tailscale.port ];
};
services = {
printing.enable = true;
clipmenu.enable = true;

View file

@ -8,11 +8,21 @@ with lib;
options = {
headscale = {
enable = mkEnableOption "enables headscale";
port = lib.mkOption {
type = lib.types.int;
default = 8082;
description = "The port that headscale is served on.";
};
domain = lib.mkOption {
type = lib.types.str;
default = "headscale.wastring.com";
description = "The domain that headscale is served on.";
};
baseDomain = lib.mkOption {
type = lib.types.str;
default = "tailnet.wastring.com";
description = "The base-domain that headscale is served on.";
};
};
};
@ -22,21 +32,25 @@ with lib;
headscale = {
enable = true;
address = "0.0.0.0";
port = 8080;
server_url = "https://${domain}";
dns = {
baseDomain = "example.com";
};
port = config.headscale.port;
settings = {
server_url = "https://${config.headscale.domain}";
logtail.enabled = false;
dns = {
base_domain = config.headscale.baseDomain;
nameservers.global = [
"1.1.1.1"
"8.8.8.8"
];
};
};
};
nginx.virtualHosts.${domain} = {
nginx.virtualHosts.${config.headscale.domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.headscale.port}";
proxyPass = "http://localhost:${toString config.headscale.port}";
proxyWebsockets = true;
};
};