added options to build with to avoid removing and re-adding stuff

This commit is contained in:
twoneis 2024-01-13 22:06:10 +01:00
parent 90b5d970be
commit 066b65c34c
8 changed files with 81 additions and 56 deletions

View file

@ -1,6 +1,7 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: {
imports = [ imports = [
./hardware-config.nix ./hardware-config.nix
./options.nix
]; ];
networking.hostName = "desktop"; networking.hostName = "desktop";

View file

@ -0,0 +1,5 @@
{ ... }: {
withNiri = false;
withGnome = true;
withVM = false;
}

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ imports = [
./hardware-config.nix ./hardware-config.nix
./options.nix
]; ];
networking.hostName = "surface"; networking.hostName = "surface";

View file

@ -0,0 +1,5 @@
{ ... }: {
withNiri = false;
withGnome = true;
withVM = false;
}

View file

@ -2,80 +2,88 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ pkgs, ... }: { { pkgs, lib, config, ... }: {
options = {
withNiri = with lib; mkEnableOption "Enable niri";
withGnome = with lib; mkEnableOption "Enable gnome";
withVM = with lib; mkEnableOption "Enable VM related configuration";
};
imports = [ imports = [
./audio.nix ./audio.nix
./containers.nix ./containers.nix
./fonts.nix ./fonts.nix
./gnome ./gnome
./niri ./niri
./virt.nix
]; ];
config = {
# Allow packages from nixpkgs # Allow packages from nixpkgs
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; allowUnfree = true;
};
#Optimise nix store
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
}; };
settings.auto-optimise-store = true;
};
# Enable nix flakes #Optimise nix store
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
settings.auto-optimise-store = true;
};
# Disable documentation # Enable nix flakes
documentation.nixos.enable = false; nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Enable networking # Disable documentation
networking.networkmanager.enable = true; documentation.nixos.enable = false;
# Set your time zone. # Enable networking
time.timeZone = "Europe/Amsterdam"; networking.networkmanager.enable = true;
# Select internationalisation properties. # Set your time zone.
i18n.defaultLocale = "en_US.UTF-8"; time.timeZone = "Europe/Amsterdam";
i18n.extraLocaleSettings = { # Select internationalisation properties.
LC_ADDRESS = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system. i18n.extraLocaleSettings = {
services.xserver.enable = true; LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Remove XTerm # Enable the X11 windowing system.
services.xserver.excludePackages = [ pkgs.xterm ]; services.xserver.enable = true;
# Configure keymap in X11 # Remove XTerm
services.xserver = { services.xserver.excludePackages = [ pkgs.xterm ];
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents. # Configure keymap in X11
services.printing.enable = false; services.xserver = {
layout = "us";
xkbVariant = "";
};
# Security # Enable CUPS to print documents.
security.rtkit.enable = true; services.printing.enable = false;
# Define a user account. Don't forget to set a password with passwd. # Security
users.users.twoneis = { security.rtkit.enable = true;
isNormalUser = true;
description = "twoneis"; # Define a user account. Don't forget to set a password with passwd.
extraGroups = [ "networkmanager" "wheel" ]; users.users.twoneis = {
isNormalUser = true;
description = "twoneis";
extraGroups = [ "networkmanager" "wheel" ];
};
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { { pkgs, lib, config, ... }: lib.mkIf (config.withGnome) {
# Enable the GNOME Desktop Environment. # Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true; services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true; services.xserver.desktopManager.gnome.enable = true;

View file

@ -1,3 +1,3 @@
{ ... }: { { lib, config, ... }: lib.mkIf (config.withNiri) {
programs.niri.enable = true; programs.niri.enable = true;
} }

5
modules/system/virt.nix Normal file
View file

@ -0,0 +1,5 @@
{ lib, config, ... }: lib.mkIf (config.withVM) {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
users.users.twoneis.extraGroups = [ "libvirtd" ];
}