diff --git a/infra/common/default.nix b/infra/common/default.nix index 0630f2f..5093233 100644 --- a/infra/common/default.nix +++ b/infra/common/default.nix @@ -1,7 +1,37 @@ +{ lib, pkgs, ... }: + +let + inherit (lib) mkDefault; + +in { imports = [ ./hardware.nix ./networking.nix ./users.nix ]; + + time.timeZone = "Europe/Amsterdam"; + i18n.defaultLocale = "en_US.UTF-8"; + system.stateVersion = "24.05"; # do not change + nixpkgs.hostPlatform = mkDefault "x86_64-linux"; + + environment.systemPackages = with pkgs; [ + (pkgs.vim_configurable.customize { + name = "vim"; + vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { + start = [ vim-nix ]; # load plugin on startup + }; + vimrcConfig.customRC = '' + " your custom vimrc + set nocompatible + set backspace=indent,eol,start + " Turn on syntax highlighting by default + syntax on + " ... + ''; + }) + wget + subversion + ]; } diff --git a/infra/common/networking.nix b/infra/common/networking.nix index 49a069b..b6968c8 100644 --- a/infra/common/networking.nix +++ b/infra/common/networking.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let - inherit (lib) mkOption; + inherit (lib) mkOption mkDefault; in { @@ -23,6 +23,9 @@ in hostName = config.procolix.vm.name; domain = "procolix.com"; + ## REVIEW: Do we actually need that, considering that we have static IPs? + useDHCP = mkDefault true; + interfaces = { eth0 = { ipv4 = { diff --git a/infra/common/users.nix b/infra/common/users.nix index 8bf33ac..098994d 100644 --- a/infra/common/users.nix +++ b/infra/common/users.nix @@ -29,6 +29,8 @@ security.sudo.wheelNeedsPassword = false; + nix.settings.trusted-users = [ "@wheel" ]; + ## FIXME: Remove direct root authentication once NixOps4 supports users with ## password-less sudo. users.root.openssh.authorizedKeys.keys = [ diff --git a/infra/vm02116/configuration.nix b/infra/vm02116/configuration.nix index 01f855f..3a4b6f0 100644 --- a/infra/vm02116/configuration.nix +++ b/infra/vm02116/configuration.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { imports = [ ../common ]; @@ -9,54 +7,9 @@ ip6 = "2a00:51c0:12:1201::20"; }; - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - (pkgs.vim_configurable.customize { - name = "vim"; - vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { - start = [ vim-nix ]; # load plugin on startup - }; - vimrcConfig.customRC = '' - " your custom vimrc - set nocompatible - set backspace=indent,eol,start - " Turn on syntax highlighting by default - syntax on - " ... - ''; - }) - wget - subversion - ]; - ## vm02116 is running on old hardware based on a Xen VM environment, so it ## needs these extra options. Once the VM gets moved to a newer node, these ## two options can safely be removed. boot.initrd.availableKernelModules = [ "xen_blkfront" ]; services.xe-guest-utilities.enable = 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. - # - # 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"; } diff --git a/infra/vm02116/hardware-configuration.nix b/infra/vm02116/hardware-configuration.nix index 2110792..5ad9e85 100644 --- a/infra/vm02116/hardware-configuration.nix +++ b/infra/vm02116/hardware-configuration.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { fileSystems."/" = { device = "/dev/disk/by-uuid/3802a66d-e31a-4650-86f3-b51b11918853"; @@ -10,8 +8,4 @@ device = "/dev/disk/by-uuid/2CE2-1173"; fsType = "vfat"; }; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/infra/vm02179/configuration.nix b/infra/vm02179/configuration.nix index 59a5add..1974593 100644 --- a/infra/vm02179/configuration.nix +++ b/infra/vm02179/configuration.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { imports = [ ../common ]; @@ -8,42 +6,4 @@ ip4 = "185.206.232.179"; ip6 = "2a00:51c0:12:1201::179"; }; - - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - nix = { - settings.trusted-users = [ "@wheel" ]; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - (pkgs.vim_configurable.customize { - name = "vim"; - vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { - start = [ vim-nix ]; # load plugin on startup - }; - vimrcConfig.customRC = '' - " your custom vimrc - set nocompatible - set backspace=indent,eol,start - " Turn on syntax highlighting by default - syntax on - " ... - ''; - }) - wget - ]; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? } diff --git a/infra/vm02179/hardware-configuration.nix b/infra/vm02179/hardware-configuration.nix index 36a2506..5b89888 100644 --- a/infra/vm02179/hardware-configuration.nix +++ b/infra/vm02179/hardware-configuration.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { fileSystems."/" = { device = "/dev/disk/by-uuid/119863f8-55cf-4e2f-ac17-27599a63f241"; @@ -14,8 +12,4 @@ "dmask=0022" ]; }; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/infra/vm02186/hardware-configuration.nix b/infra/vm02186/hardware-configuration.nix index d2d567f..c9538ea 100644 --- a/infra/vm02186/hardware-configuration.nix +++ b/infra/vm02186/hardware-configuration.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { fileSystems."/" = { device = "/dev/disk/by-uuid/833ac0f9-ad8c-45ae-a9bf-5844e378c44a"; @@ -14,8 +12,4 @@ "dmask=0022" ]; }; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/infra/vm02186/procolix-configuration.nix b/infra/vm02186/procolix-configuration.nix index ea0c923..9cd4bf0 100644 --- a/infra/vm02186/procolix-configuration.nix +++ b/infra/vm02186/procolix-configuration.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { imports = [ ../common ]; @@ -8,38 +6,4 @@ ip4 = "185.206.232.186"; ip6 = "2a00:51c0:12:1201::186"; }; - - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - (pkgs.vim_configurable.customize { - name = "vim"; - vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { - start = [ vim-nix ]; # load plugin on startup - }; - vimrcConfig.customRC = '' - " your custom vimrc - set nocompatible - set backspace=indent,eol,start - " Turn on syntax highlighting by default - syntax on - " ... - ''; - }) - wget - ]; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? } diff --git a/infra/vm02187/configuration.nix b/infra/vm02187/configuration.nix index 3c58f39..6aaf946 100644 --- a/infra/vm02187/configuration.nix +++ b/infra/vm02187/configuration.nix @@ -70,39 +70,4 @@ }; users.users.nginx.extraGroups = [ "acme" ]; - - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - (pkgs.vim_configurable.customize { - name = "vim"; - vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { - start = [ vim-nix ]; # load plugin on startup - }; - vimrcConfig.customRC = '' - " your custom vimrc - set nocompatible - set backspace=indent,eol,start - " Turn on syntax highlighting by default - syntax on - " ... - ''; - }) - wget - ]; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? - } diff --git a/infra/vm02187/hardware-configuration.nix b/infra/vm02187/hardware-configuration.nix index 24a8a49..c95e55d 100644 --- a/infra/vm02187/hardware-configuration.nix +++ b/infra/vm02187/hardware-configuration.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { fileSystems."/" = { device = "/dev/disk/by-uuid/a46a9c46-e32b-4216-a4aa-8819b2cd0d49"; @@ -14,8 +12,4 @@ "dmask=0022" ]; }; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; }