Refactoring!

This commit is contained in:
fwastring 2025-06-04 12:51:55 +02:00
parent d8f3613304
commit 372d2fb3c9
33 changed files with 14 additions and 1745 deletions

View file

@ -25,37 +25,6 @@
networking.hostName = myhostname;
# services.k3s = {
# enable = true;
# role = "server";
# token = "supersupersecretkey";
# clusterInit = true;
# };
# services = {
# syncthing = {
# enable = true;
# user = "fw";
# dataDir = "/home/fw/syncthing";
# configDir = "/home/fw/.config/syncthing";
# overrideDevices = true; # overrides any devices added or deleted through the WebUI
# overrideFolders = true; # overrides any folders added or deleted through the WebUI
# guiAddress = "0.0.0.0:8384";
# settings = {
# devices = {
# "desktop" = { id = "BGEQVAA-JZM7DQB-7NFEDQ6-K7Q3HQL-P6OSNJ2-TMA3N7B-E6RP3HQ-OAMWJQL"; };
# "laptop" = { id = "2VEN7O3-PB3G2MK-XJI7R5Z-6MHTNN2-WMXERIX-6G7QWSK-VKSWOSH-Q5WFDAI"; };
# };
# folders = {
# "Documents" = { # Name of folder in Syncthing, also the folder ID
# path = "/home/fw/docs"; # Which folder to add to Syncthing
# devices = [ "desktop" ]; # Which devices to share the folder with
# };
# };
# };
# };
# };
services.xserver.dpi = 140;
system.stateVersion = "23.11";

View file

@ -1,41 +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
../../config/base.nix
../../config/users.nix
];
networking.hostName = myhostname;
environment.systemPackages = with pkgs; [
];
services.xserver.dpi = 140;
services = {
openssh = {
enable = true;
ports = [55504];
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
X11Forwarding = true;
};
extraConfig = ''
AllowUsers fw
'';
};
};
system.stateVersion = "23.11";
}

View file

@ -1,100 +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
];
# 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.05"; # Did you read the comment?
}

View file

@ -1,41 +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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/e6dc4f13-d85c-44a0-89ae-d8bbe111bd5c";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/AF48-6246";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/4eb1a6f5-2c5d-4bf1-82d0-797bf2839c52"; }
];
# 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.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,129 +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
../../config/users.nix
../../shared/nginx.nix
];
networking.hostName = myhostname;
nixpkgs = {
overlays = [
];
config = {
allowUnfree = true;
};
};
environment.systemPackages = with pkgs; [
mergerfs
unstable.lego
];
fileSystems."/data" = {
fsType = "fuse.mergerfs";
device = "/mnt/extern*";
options = ["cache.files=partial" "dropcacheonclose=true" "category.create=mfs"];
};
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
nix.nixPath = ["/etc/nix/path"];
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.docker = {
enable = true;
};
networking.networkmanager.enable = true;
environment.sessionVariables = {
EDITOR = "nvim";
TERM = "xterm-256color";
};
time.timeZone = "Europe/Stockholm";
fonts.packages = with pkgs; [
(nerdfonts.override {
fonts = [
"FiraCode"
"Iosevka"
"DroidSansMono"
];
})
];
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";
};
# boot.loader.grub = {
# enable = true;
# device = "/dev/sdc";
# useOSProber = true;
# };
console.keyMap = "sv-latin1";
programs.zsh.enable = true;
security.auditd.enable = true;
services = {
fail2ban = {
enable = true;
};
xserver = {
enable = true;
displayManager = {
startx.enable = true;
};
};
openssh = {
enable = true;
ports = [22];
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
X11Forwarding = true;
};
extraConfig = ''
AllowUsers fw
'';
};
locate = {
enable = true;
locate = pkgs.mlocate;
};
};
system.stateVersion = "23.11";
}

View file

@ -1,34 +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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/220bde85-e58e-48ad-bf5c-e1d3907642c0";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/f11bdce3-851b-427f-a3ab-9ebc9792269a"; }
];
# 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.enp33s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}