From ae1c7b257e63fe132557e5983aa8dd7d68588016 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 19 Mar 2024 08:30:04 +0100 Subject: [PATCH] Add optional system modules --- hosts/default.nix | 7 +++++-- hosts/vbox_nix/default.nix | 15 ++++++++++----- system/network.nix | 15 ++++++++++++++- system/options/cachix.nix | 14 ++++++++++++++ system/options/oomd.nix | 9 +++++++++ system/options/systemd-boot.nix | 12 ++++++++++++ 6 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 system/options/cachix.nix create mode 100644 system/options/oomd.nix create mode 100644 system/options/systemd-boot.nix diff --git a/hosts/default.nix b/hosts/default.nix index f8a2f84..2b5dce1 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,9 +3,12 @@ in { vboxnix = lib.nixosSystem { system = "x86_64-linux"; - modules = [ - ../system + modules = [ ./vbox_nix + ../system + ../system/options/systemd-boot.nix + ../system/options/cachix.nix + ../system/options/oomd.nix ../modules/services/ssh.nix ]; }; diff --git a/hosts/vbox_nix/default.nix b/hosts/vbox_nix/default.nix index 7a3d36e..3467086 100644 --- a/hosts/vbox_nix/default.nix +++ b/hosts/vbox_nix/default.nix @@ -1,11 +1,16 @@ -{lib, ...}: +{ lib, pkgs, ...}: { imports = [ ./hardware-configuration.nix ]; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - timeout = 3; + nix.settings = { + max-jobs = 6; + cores = 6; + }; + + security.sudo.package = pkgs.sudo.override { withInsults = true; }; + security.polkit.enable = true; + services = { + udisks2.enable = true; }; networking.hostName = "vboxnix"; diff --git a/system/network.nix b/system/network.nix index 59aec8d..93c3781 100644 --- a/system/network.nix +++ b/system/network.nix @@ -9,5 +9,18 @@ }; }; - services.resolved.enable = true; + services.resolved = { + enable = true; + fallbackDns = [ + "9.9.9.9" + "2620:fe::fe" + ]; + }; + + # don't wait for network to boot faster + # https://old.reddit.com/r/NixOS/comments/vdz86j/how_to_remove_boot_dependency_on_network_for_a + systemd = { + targets.network-online.wantedBy = lib.mkForce []; # default is [ "multi-user.target" ] + services.NetworkManager-wait-online.wantedBy = lib.mkForce []; # default is [ "network-online.target" ] + }; } diff --git a/system/options/cachix.nix b/system/options/cachix.nix new file mode 100644 index 0000000..a23b11b --- /dev/null +++ b/system/options/cachix.nix @@ -0,0 +1,14 @@ +_: { + nix.settings = { + substituters = [ + "https://nix-community.cachix.org" + "https://nixpkgs-wayland.cachix.org" + "https://viperml.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" + "viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8=" + ]; + }; +} diff --git a/system/options/oomd.nix b/system/options/oomd.nix new file mode 100644 index 0000000..4bc5b92 --- /dev/null +++ b/system/options/oomd.nix @@ -0,0 +1,9 @@ +_: { + systemd.oomd = { + enable = true; + enableSystemSlice = true; + enableRootSlice = true; + enableUserSlices = true; + }; +} + diff --git a/system/options/systemd-boot.nix b/system/options/systemd-boot.nix new file mode 100644 index 0000000..e46beec --- /dev/null +++ b/system/options/systemd-boot.nix @@ -0,0 +1,12 @@ +_: { + boot.loader = { + systemd-boot = { + enable = true; + memtest86.enable = true; + editor = true; + }; + efi.canTouchEfiVariables = true; + timeout = 3; + }; +} +