2018-03-31 22:16:38 +02:00
|
|
|
|
# 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, ... }:
|
|
|
|
|
|
2018-11-10 15:24:58 +01:00
|
|
|
|
let
|
2019-10-04 22:38:36 +02:00
|
|
|
|
gitRev = "4c45e960e797d660358a11723e736afee3998261";
|
2018-11-10 15:24:58 +01:00
|
|
|
|
nixpkgs = fetchTarball "https://github.com/nyanloutre/nixpkgs/archive/${gitRev}.tar.gz";
|
|
|
|
|
in
|
2018-03-31 22:16:38 +02:00
|
|
|
|
{
|
2018-09-04 14:05:06 +02:00
|
|
|
|
imports = [
|
2019-10-04 22:01:49 +02:00
|
|
|
|
../common-cli.nix
|
2018-09-04 14:05:06 +02:00
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
./users.nix
|
|
|
|
|
./services.nix
|
|
|
|
|
];
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
boot = {
|
|
|
|
|
loader = {
|
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
|
};
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
supportedFilesystems = [ "zfs" ];
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
tmpOnTmpfs = true;
|
|
|
|
|
};
|
2018-04-05 19:22:09 +02:00
|
|
|
|
|
2018-11-10 15:24:58 +01:00
|
|
|
|
nix.nixPath = [
|
|
|
|
|
"nixpkgs=${nixpkgs}"
|
|
|
|
|
"nixos-config=/etc/nixos/configuration.nix"
|
|
|
|
|
];
|
|
|
|
|
|
2019-02-12 11:15:39 +01:00
|
|
|
|
nixpkgs.config.allowUnfree = false;
|
2020-04-08 12:47:12 +02:00
|
|
|
|
nixpkgs.config.allowUnfreePredicate = (pkg: builtins.elem pkg.pname or (builtins.parseDrvName pkg.name).name [ "factorio-headless" "perl5.30.1-slimserver" "minecraft-server" ]);
|
2019-02-12 11:15:39 +01:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
services.zfs = {
|
|
|
|
|
autoSnapshot.enable = true;
|
|
|
|
|
autoScrub.enable = true;
|
|
|
|
|
};
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2020-08-30 16:25:51 +02:00
|
|
|
|
hardware.usbWwan.enable = true;
|
|
|
|
|
|
2019-04-04 23:47:24 +02:00
|
|
|
|
# eno1 -> VLAN100 -> Internet
|
|
|
|
|
# eno2 -> LAN
|
2019-04-21 11:05:45 +02:00
|
|
|
|
# eno3 -> Legacy client DHCP
|
|
|
|
|
# eno4 -> Pas utilisé
|
2019-04-04 23:47:24 +02:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
networking = {
|
|
|
|
|
hostName = "loutreos"; # Define your hostname.
|
|
|
|
|
hostId = "7e66e347";
|
2019-04-04 23:47:24 +02:00
|
|
|
|
|
2019-12-09 00:11:36 +01:00
|
|
|
|
dhcpcd = {
|
|
|
|
|
persistent = true;
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
interface bouyges
|
2020-08-30 16:25:51 +02:00
|
|
|
|
metric 10
|
2019-12-09 00:11:36 +01:00
|
|
|
|
noarp
|
2020-08-30 16:25:51 +02:00
|
|
|
|
interface enp0s21u2
|
|
|
|
|
metric 999
|
2019-12-09 00:11:36 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
2019-04-27 10:36:01 +02:00
|
|
|
|
|
2020-08-30 21:10:48 +02:00
|
|
|
|
vlans = {
|
|
|
|
|
bouyges = {
|
|
|
|
|
id = 100;
|
|
|
|
|
interface = "eno1";
|
|
|
|
|
};
|
|
|
|
|
chinoiseries = {
|
|
|
|
|
id = 20;
|
|
|
|
|
interface = "eno2";
|
|
|
|
|
};
|
2019-04-04 23:47:24 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
interfaces = {
|
2019-04-27 10:36:01 +02:00
|
|
|
|
eno1.useDHCP = false;
|
2019-04-04 23:47:24 +02:00
|
|
|
|
bouyges = {
|
|
|
|
|
# Adresse MAC BBox ? https://lafibre.info/remplacer-bbox/informations-de-connexion-ftth/msg598303/#msg598303
|
2019-04-27 10:36:01 +02:00
|
|
|
|
macAddress = "E8:AD:A6:21:73:68";
|
2019-04-04 23:47:24 +02:00
|
|
|
|
};
|
|
|
|
|
eno2 = {
|
|
|
|
|
ipv4.addresses = [
|
|
|
|
|
{ address = "10.30.0.1"; prefixLength = 16; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2020-08-30 21:10:48 +02:00
|
|
|
|
chinoiseries = {
|
|
|
|
|
ipv4.addresses = [
|
|
|
|
|
{ address = "10.40.0.1"; prefixLength = 16; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2019-04-04 23:47:24 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# NAT bouyges <-> eno2
|
|
|
|
|
nat = {
|
|
|
|
|
enable = true;
|
2019-04-27 10:36:01 +02:00
|
|
|
|
externalInterface = "bouyges";
|
2019-04-04 23:47:24 +02:00
|
|
|
|
# Permet d'utiliser le SNAT plus rapide au lieu de MASQUERADE
|
|
|
|
|
# externalIP = "0.0.0.0";
|
2020-08-30 21:10:48 +02:00
|
|
|
|
internalIPs = [ "10.30.0.0/16" "10.40.0.0/16" ];
|
|
|
|
|
internalInterfaces = [ "eno2" "chinoiseries" ];
|
2019-06-07 10:28:24 +02:00
|
|
|
|
forwardPorts = [
|
|
|
|
|
{ destination = "10.30.0.1:22"; proto = "tcp"; sourcePort = 8443;}
|
2019-10-22 00:34:08 +02:00
|
|
|
|
{ destination = "10.30.135.35:25565"; proto = "tcp"; sourcePort = 25565; loopbackIPs=[ "195.36.180.44" ];}
|
2019-06-07 10:28:24 +02:00
|
|
|
|
];
|
2019-04-04 23:47:24 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-04-27 11:34:17 +02:00
|
|
|
|
firewall = {
|
2020-04-08 12:45:36 +02:00
|
|
|
|
allowedTCPPorts = [ 80 443 ];
|
2019-04-27 11:34:17 +02:00
|
|
|
|
allowedUDPPorts = [ ];
|
|
|
|
|
interfaces.eno2 = {
|
|
|
|
|
allowedTCPPorts = [
|
|
|
|
|
111 2049 4000 4001 4002 # NFS
|
|
|
|
|
3483 9000 9090 # Slimserver
|
2020-04-08 12:48:42 +02:00
|
|
|
|
1935 # RTMP
|
2019-04-27 11:34:17 +02:00
|
|
|
|
];
|
|
|
|
|
allowedUDPPorts = [
|
|
|
|
|
111 2049 4000 4001 4002 # NFS
|
|
|
|
|
3483 # Slimserver
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
enable = true;
|
|
|
|
|
};
|
2019-04-04 23:47:24 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.dhcpd4 = {
|
|
|
|
|
enable = true;
|
2020-08-30 21:10:48 +02:00
|
|
|
|
interfaces = [ "eno2" "chinoiseries" ];
|
2019-05-01 23:06:17 +02:00
|
|
|
|
machines = [
|
|
|
|
|
{ ethernetAddress = "50:c7:bf:b6:b8:ef"; hostName = "HS110"; ipAddress = "10.30.50.7"; }
|
|
|
|
|
{ ethernetAddress = "ac:1f:6b:4b:01:15"; hostName = "IPMI"; ipAddress = "10.30.1.1"; }
|
2019-10-22 00:34:08 +02:00
|
|
|
|
{ ethernetAddress = "00:1f:c6:6e:d1:f1"; hostName = "minecraftos"; ipAddress = "10.30.135.35"; }
|
2020-08-30 21:10:48 +02:00
|
|
|
|
{ ethernetAddress = "b4:2e:99:ed:24:26"; hostName = "paul-fixe"; ipAddress = "10.30.135.71"; }
|
|
|
|
|
|
2020-09-11 01:59:02 +02:00
|
|
|
|
#ESPHome
|
|
|
|
|
{ ethernetAddress = "e0:98:06:85:e9:ce"; hostName = "salonled"; ipAddress = "10.30.40.1"; }
|
|
|
|
|
{ ethernetAddress = "e0:98:06:86:38:fc"; hostName = "bureauled"; ipAddress = "10.30.40.2"; }
|
|
|
|
|
|
2020-08-30 21:10:48 +02:00
|
|
|
|
# YeeLights
|
|
|
|
|
{ ethernetAddress = "04:cf:8c:b5:7e:18"; hostName = "yeelink-light-color3_miap7e18"; ipAddress = "10.40.249.0"; }
|
|
|
|
|
{ ethernetAddress = "04:cf:8c:b5:2d:28"; hostName = "yeelink-light-color3_miap2d28"; ipAddress = "10.40.249.1"; }
|
|
|
|
|
{ ethernetAddress = "04:cf:8c:b5:71:04"; hostName = "yeelink-light-color3_miap7104"; ipAddress = "10.40.249.2"; }
|
2019-05-01 23:06:17 +02:00
|
|
|
|
];
|
2019-04-04 23:47:24 +02:00
|
|
|
|
extraConfig = ''
|
|
|
|
|
option domain-name-servers 89.234.141.66, 80.67.169.12, 80.67.169.40;
|
|
|
|
|
option subnet-mask 255.255.0.0;
|
|
|
|
|
subnet 10.30.0.0 netmask 255.255.0.0 {
|
2020-08-30 21:10:48 +02:00
|
|
|
|
option routers 10.30.0.1;
|
2019-04-04 23:47:24 +02:00
|
|
|
|
range 10.30.50.0 10.30.250.0;
|
|
|
|
|
}
|
2020-08-30 21:10:48 +02:00
|
|
|
|
subnet 10.40.0.0 netmask 255.255.0.0 {
|
|
|
|
|
option routers 10.40.0.1;
|
|
|
|
|
range 10.40.50.0 10.40.250.0;
|
|
|
|
|
}
|
2019-04-04 23:47:24 +02:00
|
|
|
|
'';
|
2018-09-04 14:05:06 +02:00
|
|
|
|
};
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2018-05-04 15:25:24 +02:00
|
|
|
|
nixpkgs.overlays = [
|
2018-06-09 13:23:26 +02:00
|
|
|
|
(import ../../overlays/riot-web.nix)
|
2018-05-04 15:25:24 +02:00
|
|
|
|
];
|
2018-05-07 11:35:57 +02:00
|
|
|
|
|
2018-09-04 14:05:06 +02:00
|
|
|
|
services.openssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
permitRootLogin = "no";
|
|
|
|
|
passwordAuthentication = false;
|
2020-08-30 21:14:55 +02:00
|
|
|
|
forwardX11 = true;
|
2018-09-04 14:05:06 +02:00
|
|
|
|
};
|
2018-03-31 22:16:38 +02:00
|
|
|
|
|
2020-08-30 16:25:51 +02:00
|
|
|
|
users = {
|
|
|
|
|
groups.autossh = { };
|
|
|
|
|
users.autossh = {
|
|
|
|
|
home = "/home/autossh";
|
|
|
|
|
createHome = true;
|
|
|
|
|
group = "autossh";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.autossh.sessions = [ { extraArguments = "-N -R 0.0.0.0:2222:127.0.0.1:22 loutre@vps772619.ovh.net"; monitoringPort = 20000; name = "backup-ssh-reverse"; user = "autossh"; } ];
|
|
|
|
|
|
2018-03-31 22:16:38 +02:00
|
|
|
|
security.sudo.wheelNeedsPassword = false;
|
|
|
|
|
|
2018-05-03 00:02:19 +02:00
|
|
|
|
system.stateVersion = "18.03";
|
2018-03-31 22:16:38 +02:00
|
|
|
|
}
|