156 lines
4.3 KiB
Nix
156 lines
4.3 KiB
Nix
# Edit this configuration file to define what should be installed on
|
|
# your system. Help is available in the configuration.nix(5) man page, on
|
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
imports =
|
|
[ # Include the results of the hardware scan.
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
# Use the GRUB 2 boot loader.
|
|
boot.loader.grub.enable = true;
|
|
boot.loader.grub.device = "/dev/sda";
|
|
# serial console
|
|
boot.kernelParams = [ "console=ttyS1" ];
|
|
|
|
# Activate nix flakes
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
# network config
|
|
networking =
|
|
let
|
|
# ports forwarded to pastila (on the same port)
|
|
portsPastila = [
|
|
80
|
|
22
|
|
];
|
|
pastila = proto: portFrom: portTo: {
|
|
destination = "10.0.42.100:" + builtins.toString portTo;
|
|
proto = proto;
|
|
sourcePort = portFrom;
|
|
};
|
|
in
|
|
{
|
|
hostName = "oven";
|
|
|
|
useDHCP = false;
|
|
|
|
# Static public IP, online.net gateway & DNS
|
|
interfaces."enp1s0".ipv4.addresses = [{
|
|
address = "51.15.168.181";
|
|
prefixLength = 24;
|
|
}];
|
|
defaultGateway = {
|
|
address = "51.15.168.1";
|
|
interface = "enp1s0";
|
|
};
|
|
nameservers = [
|
|
"51.159.47.28"
|
|
"51.159.47.26"
|
|
];
|
|
|
|
bridges = {
|
|
"br0" = { interfaces = []; };
|
|
};
|
|
interfaces."br0".ipv4.addresses = [{
|
|
address = "10.0.42.1";
|
|
prefixLength = 24;
|
|
}];
|
|
|
|
nat = {
|
|
enable = true;
|
|
internalInterfaces = ["br0"];
|
|
externalInterface = "enp1s0";
|
|
forwardPorts =
|
|
builtins.map (port: pastila "tcp" port port) portsPastila ++
|
|
builtins.map (port: pastila "udp" port port) portsPastila;
|
|
};
|
|
|
|
firewall = {
|
|
allowedTCPPorts = portsPastila ++ [ 2222 ];
|
|
allowedUDPPorts = portsPastila;
|
|
};
|
|
};
|
|
|
|
# Set your time zone.
|
|
time.timeZone = "Europe/Paris";
|
|
|
|
# Select internationalisation properties.
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
console = {
|
|
font = "Lat2-Terminus16";
|
|
keyMap = "fr-bepo";
|
|
};
|
|
|
|
users.users.armael = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" "libvirtd" ];
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRa9ABfjRX61sygceiefWnyWK0+gZ5YaaCDxUQeE2LT armael@teabox"
|
|
];
|
|
};
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
# $ nix search wget
|
|
environment.systemPackages = with pkgs; [
|
|
vim
|
|
wget
|
|
emacs
|
|
htop
|
|
bmon
|
|
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;
|
|
services.openssh.settings.PermitRootLogin = "no";
|
|
services.openssh.ports = [ 2222 ];
|
|
|
|
# Set up the hypervisor
|
|
virtualisation.libvirtd = {
|
|
enable = true;
|
|
qemu.runAsRoot = false;
|
|
onShutdown = "shutdown";
|
|
parallelShutdown = 10;
|
|
};
|
|
|
|
|
|
# Copy the NixOS configuration file and link it from the resulting system
|
|
# (/run/current-system/configuration.nix). This is useful in case you
|
|
# accidentally delete configuration.nix.
|
|
# system.copySystemConfiguration = true;
|
|
|
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
|
#
|
|
# Most users should NEVER change this value after the initial install, for any reason,
|
|
# even if you've upgraded your system to a new NixOS release.
|
|
#
|
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
|
# to actually do that.
|
|
#
|
|
# This value being lower than the current NixOS release does NOT mean your system is
|
|
# out of date, out of support, or vulnerable.
|
|
#
|
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
|
# and migrated your data accordingly.
|
|
#
|
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
|
system.stateVersion = "24.05"; # Did you read the comment?
|
|
|
|
}
|
|
|