From 1541c7b0113a6fe7efbee32eed9e7d6fcdbfa9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arma=C3=ABl=20Gu=C3=A9neau?= Date: Mon, 27 May 2024 19:14:59 +0200 Subject: [PATCH] share common config between oven and pastila --- common/configuration.nix | 46 ++++++++++++++++++++++++++++++++++++ oven/configuration.nix | 40 ++------------------------------ pastila/configuration.nix | 49 +++------------------------------------ 3 files changed, 51 insertions(+), 84 deletions(-) create mode 100644 common/configuration.nix diff --git a/common/configuration.nix b/common/configuration.nix new file mode 100644 index 0000000..788730d --- /dev/null +++ b/common/configuration.nix @@ -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"; + }; + }; + +} diff --git a/oven/configuration.nix b/oven/configuration.nix index 75e08d4..018904a 100644 --- a/oven/configuration.nix +++ b/oven/configuration.nix @@ -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? } - diff --git a/pastila/configuration.nix b/pastila/configuration.nix index 571e024..4d46f55 100644 --- a/pastila/configuration.nix +++ b/pastila/configuration.nix @@ -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