modularize configuration of arachnide server

This commit is contained in:
Douze Bé 2024-12-19 15:47:58 +01:00
parent 3e467230b1
commit fb3ddea80f
3 changed files with 50 additions and 59 deletions

View file

@ -4,15 +4,14 @@
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
/var/src/modules/nixin.nix
/var/src/modules/users.nix
]; ];
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# Set NIX_PATH to use nixpkgs deployed with krops
environment.variables.NIX_PATH = lib.mkForce "/var/src";
networking = { networking = {
hostName = "arachnide"; # Define your hostname. hostName = "arachnide"; # Define your hostname.
# Pick only one of the below networking options. # Pick only one of the below networking options.
@ -47,17 +46,6 @@
}; };
}; };
# 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 using networkmanager
# networking.networkmanager.enable = true;
# Set your time zone. # Set your time zone.
time.timeZone = "Etc/UTC"; time.timeZone = "Etc/UTC";
@ -76,48 +64,12 @@
LC_TIME = "fr_FR.UTF-8"; LC_TIME = "fr_FR.UTF-8";
}; };
# Configure keymap in X11
services.xserver.xkb = {
layout = "fr";
variant = "";
};
# Configure console keymap # Configure console keymap
console.keyMap = "fr"; console.keyMap = "fr";
# Define user accounts. Don't forget to set a password with 'passwd'.
users.users.douzeb = {
isNormalUser = true;
description = "douze baie";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRG0CyeeMMrrjTTm/PHgRXD/I4lH/bBPBCGUiL+cBdq douzeb@tux-12"
];
};
users.users.mrflos = {
isNormalUser = true;
description = "mr flos";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBBM+2TwkopAQF7splTWjORQoxjcp67VhodwzvTMlL8g florian@florian-LinuxMint-MBP"
];
};
# Passwordless sudo for members of the wheel group
security.sudo.wheelNeedsPassword = false;
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.shellAliases = {
tm = "tmux new -A -s shared" ;
ll = "ls -al";
};
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -155,15 +107,6 @@
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.ports = [ 144 ];
services.openssh.settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.ipv4.ip_forward" = 1; "net.ipv4.ip_forward" = 1;
"net.ipv6.conf.all.forwarding" = 1; "net.ipv6.conf.all.forwarding" = 1;

View file

@ -0,0 +1,21 @@
# Nixin common configuration for all servers
{ config, pkgs, lib, ... }:
{
# Set NIX_PATH to use nixpkgs deployed with krops
environment.variables.NIX_PATH = lib.mkForce "/var/src";
environment.shellAliases = {
tm = "tmux new -A -s shared" ;
ll = "ls -al";
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.ports = [ 144 ];
services.openssh.settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
}

27
modules/users.nix Normal file
View file

@ -0,0 +1,27 @@
# Admin users
{ config, pkgs, ... }:
{
# Define user accounts. Don't forget to set a password with 'passwd'.
users.users.douzeb = {
isNormalUser = true;
description = "douze baie";
extraGroups = [ "wheel" ];
packages = with pkgs; [];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRG0CyeeMMrrjTTm/PHgRXD/I4lH/bBPBCGUiL+cBdq douzeb@tux-12"
];
};
users.users.mrflos = {
isNormalUser = true;
description = "mr flos";
extraGroups = [ "wheel" ];
packages = with pkgs; [];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBBM+2TwkopAQF7splTWjORQoxjcp67VhodwzvTMlL8g florian@florian-LinuxMint-MBP"
];
};
# Passwordless sudo for members of the wheel group
security.sudo.wheelNeedsPassword = false;
}