From 6d0f3a99645cf42a9227b8f18181ff73c606fd57 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 5 Dec 2020 14:18:57 +0100 Subject: [PATCH] Reorganise profiles/options --- machines/nunotaba/configuration.nix | 2 +- machines/sayuri/configuration.nix | 2 +- modules/base.nix | 85 ------------------------- modules/default.nix | 98 +++++++++++++++++++++++++++++ modules/options.nix | 7 --- profiles/base.nix | 14 ----- 6 files changed, 100 insertions(+), 108 deletions(-) delete mode 100644 modules/base.nix create mode 100644 modules/default.nix delete mode 100644 modules/options.nix delete mode 100644 profiles/base.nix diff --git a/machines/nunotaba/configuration.nix b/machines/nunotaba/configuration.nix index ba713bc..19cac9b 100644 --- a/machines/nunotaba/configuration.nix +++ b/machines/nunotaba/configuration.nix @@ -9,7 +9,7 @@ ../../modules/restic.nix ../../modules/ssd.nix ../../modules/libvirt.nix - ../../profiles/base.nix + ../../modules ../../profiles/dev.nix ../../users/simon ]; diff --git a/machines/sayuri/configuration.nix b/machines/sayuri/configuration.nix index 60c3319..7da6bf8 100644 --- a/machines/sayuri/configuration.nix +++ b/machines/sayuri/configuration.nix @@ -9,7 +9,7 @@ ../../modules/libvirt.nix ../../modules/restic.nix ../../modules/ssd.nix - ../../profiles/base.nix + ../../modules ../../profiles/dev.nix ../../users/simon ]; diff --git a/modules/base.nix b/modules/base.nix deleted file mode 100644 index d9e2bd0..0000000 --- a/modules/base.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ./options.nix - ./tools.nix - ./communication.nix - ./creative.nix - ./cups.nix - ./fonts.nix - ./tools.nix - ./media.nix - ./network-manager.nix - ./office.nix - ./pulseaudio.nix - ./sway.nix - ./web.nix - ]; - - # Essential system tools - environment.systemPackages = with pkgs; [ - git - git-crypt # used to store secrets in configuration - git-lfs # not so essential, but required to clone config - htop - tmux - vim - ]; - - # Clean temporary files on boot - boot.cleanTmpDir = true; - - # Disable firewall - networking.firewall.enable = lib.mkDefault false; - - # Set zsh as default shell - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - - # Sane swapping - boot.kernel.sysctl."vm.swapiness" = 10; - - # Store logs persistently - services.journald.extraConfig = "Storage = persistent"; - - # Hard drive monitoring - services.smartd.enable = true; - # Network monitoring - services.vnstat.enable = true; - - # Authentication/Encryption agents - programs.gnupg.agent.enable = true; - programs.ssh.startAgent = true; - - # NixOS state version (see https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion) - system.stateVersion = "20.03"; - - nix = { - # Make sudoers trusted nix users - trustedUsers = [ "@wheel" ]; - - # On-the-fly optimisation of nix store - autoOptimiseStore = true; - - # Make nix build in background less noticeable - daemonIONiceLevel = 5; # 0-7 - }; - systemd.services.nix-daemon.serviceConfig.CPUSchedulingPolicy = "batch"; - - nixpkgs.config = { - # Explicitly allow unfree packages (rule of thumb: assets ok, code not ok) - allowUnfreePredicate = ( - pkg: builtins.elem (lib.getName pkg) [ - "corefonts" - "vista-fonts" - ] - ); - # Add unstable channel - packageOverrides = pkgs: { - unstable = import (builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz") { - config = config.nixpkgs.config; - }; - }; - }; -} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..23df285 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,98 @@ +{ config, lib, pkgs, ... }: + +{ + # Options that affect multiple modules + options.sbruder = { + gui = lib.mkEnableOption "gui"; + }; + + # All modules are imported but non-essential modules are activated by + # configuration options + imports = [ + ./communication.nix + ./creative.nix + ./cups.nix + ./docker.nix + ./fonts.nix + ./grub.nix + ./locales.nix + ./media.nix + ./network-manager.nix + ./office.nix + ./prometheus/node_exporter.nix + ./pulseaudio.nix + ./ssh.nix + ./sway.nix + ./tools.nix + ./udev.nix + ./web.nix + ]; + + config = { + # Essential system tools + environment.systemPackages = with pkgs; [ + git + git-crypt # used to store secrets in configuration + git-lfs # not so essential, but required to clone config + htop + tmux + vim + ]; + + # Clean temporary files on boot + boot.cleanTmpDir = true; + + # Disable firewall + networking.firewall.enable = lib.mkDefault false; + + # Set zsh as default shell + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + # Sane swapping + boot.kernel.sysctl."vm.swapiness" = 10; + + # Store logs persistently + services.journald.extraConfig = "Storage = persistent"; + + # Hard drive monitoring + services.smartd.enable = true; + # Network monitoring + services.vnstat.enable = true; + + # Authentication/Encryption agents + programs.gnupg.agent.enable = true; + programs.ssh.startAgent = true; + + # NixOS state version (see https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion) + system.stateVersion = "20.03"; + + nix = { + # Make sudoers trusted nix users + trustedUsers = [ "@wheel" ]; + + # On-the-fly optimisation of nix store + autoOptimiseStore = true; + + # Make nix build in background less noticeable + daemonIONiceLevel = 5; # 0-7 + }; + systemd.services.nix-daemon.serviceConfig.CPUSchedulingPolicy = "batch"; + + nixpkgs.config = { + # Explicitly allow unfree packages (rule of thumb: assets ok, code not ok) + allowUnfreePredicate = ( + pkg: builtins.elem (lib.getName pkg) [ + "corefonts" + "vista-fonts" + ] + ); + # Add unstable channel + packageOverrides = pkgs: { + unstable = import (builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz") { + config = config.nixpkgs.config; + }; + }; + }; + }; +} diff --git a/modules/options.nix b/modules/options.nix deleted file mode 100644 index e5b3fa3..0000000 --- a/modules/options.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - options.sbruder = { - gui = lib.mkEnableOption "Enable gui configuration"; - }; -} diff --git a/profiles/base.nix b/profiles/base.nix deleted file mode 100644 index 19976f2..0000000 --- a/profiles/base.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: - -{ - imports = - [ - ../modules/base.nix - ../modules/docker.nix - ../modules/grub.nix - ../modules/locales.nix - ../modules/prometheus/node_exporter.nix - ../modules/ssh.nix - ../modules/udev.nix - ]; -}