share common config between oven and pastila

This commit is contained in:
Armaël Guéneau 2024-05-27 19:14:59 +02:00
parent d6a6b21ea4
commit 1541c7b011
3 changed files with 51 additions and 84 deletions

46
common/configuration.nix Normal file
View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
{
# Enable the OpenSSH daemon
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "no";
# Activate nix flakes.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "fr-bepo";
};
environment.systemPackages = with pkgs; [
emacs
wget
htop
tmux
bmon # Shows network activity
nixfmt
jnettop
iperf3
ncdu
tig
];
programs.git = {
enable = true;
config.user = {
name = "root";
email = "root@${config.networking.hostName}";
};
config.alias = {
ci = "commit";
co = "checkout";
st = "status";
br = "branch";
};
};
}

View file

@ -6,8 +6,9 @@
{
imports =
[ # Include the results of the hardware scan.
[
./hardware-configuration.nix
../common/configuration.nix
];
# Use the GRUB 2 boot loader.
@ -16,9 +17,6 @@
# serial console
boot.kernelParams = [ "console=ttyS1" ];
# Activate nix flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# network config
networking =
let
@ -75,16 +73,6 @@
};
};
# 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" ];
@ -93,29 +81,6 @@
];
};
# 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 ];
@ -153,4 +118,3 @@
system.stateVersion = "24.05"; # Did you read the comment?
}

View file

@ -6,17 +6,14 @@
{
imports =
[ # Include the results of the hardware scan.
[
./hardware-configuration.nix
../common/configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
boot.loader.grub.device = "/dev/vda";
networking.hostName = "pastila"; # Define your hostname.
networking.hostId = "8425e349";
@ -35,19 +32,6 @@
"51.159.47.26"
];
# Activate nix flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Set your time zone.
time.timeZone = "Europe/Paris";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "fr-bepo";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.armael = {
isNormalUser = true;
@ -57,38 +41,11 @@
];
};
# 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";
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
80
];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you