From db4eaee48745e93eda2721ebb06ab23eb2f58e11 Mon Sep 17 00:00:00 2001 From: Sijmen Date: Mon, 19 Jun 2023 01:00:40 +0200 Subject: [PATCH] Split up common/configuration.nix --- common/configuration.nix | 94 ---------------------------- common/configuration/console.nix | 10 +++ common/configuration/environment.nix | 11 ++++ common/configuration/fonts.nix | 16 +++++ common/configuration/i18n.nix | 9 +++ common/configuration/main.nix | 19 ++++++ common/configuration/nix.nix | 14 +++++ common/configuration/services.nix | 30 +++++++++ common/configuration/users.nix | 10 +++ framework/configuration.nix | 4 +- nas/configuration.nix | 2 +- thinkpad/configuration.nix | 2 +- 12 files changed, 123 insertions(+), 98 deletions(-) delete mode 100644 common/configuration.nix create mode 100644 common/configuration/console.nix create mode 100644 common/configuration/environment.nix create mode 100644 common/configuration/fonts.nix create mode 100644 common/configuration/i18n.nix create mode 100644 common/configuration/main.nix create mode 100644 common/configuration/nix.nix create mode 100644 common/configuration/services.nix create mode 100644 common/configuration/users.nix diff --git a/common/configuration.nix b/common/configuration.nix deleted file mode 100644 index d3027a9..0000000 --- a/common/configuration.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./home-manager/main.nix - ]; - - nix = { - settings = { - experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - }; - gc = { - automatic = true; - dates = "daily"; - options = "--delete-older-than 14d"; - }; - }; - - nixpkgs.config.allowUnfree = true; - time.timeZone = "Europe/Amsterdam"; - - console = { - earlySetup = true; - font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; - packages = with pkgs; [ terminus_font ]; - keyMap = "us"; - }; - - environment.sessionVariables = rec { - MOZ_ENABLE_WAYLAND = "1"; - NIXOS_OZONE_WL = "1"; - QT_QPA_PLATFORM = "wayland"; - SDL_VIDEODRIVER = "wayland"; - EDITOR = "nvim"; - }; - - i18n = { - defaultLocale = "en_US.UTF-8"; - supportedLocales = [ - "en_US.UTF-8/UTF-8" - "nl_NL.UTF-8/UTF-8" - ]; - }; - - users.users.sijmen = { - isNormalUser = true; - extraGroups = [ "wheel" "docker" "wireshark" "video" "dialout" "libvirt" ]; - description = "Sijmen"; - shell = pkgs.zsh; - }; - - programs.zsh.enable = true; - - services = { - pipewire.enable = true; - gvfs.enable = true; - usbmuxd.enable = true; - smartd.enable = true; - pcscd.enable = true; - fwupd.enable = true; - - printing = { - enable = true; - drivers = with pkgs; [ hplip ]; - }; - - openssh = { - enable = true; - settings = { - PasswordAuthentication = false; - }; - }; - - #syncthing = { - #enable = true; - #user = "sijmen"; - #dataDir = config.users.users.sijmen.home; - #}; - }; - - fonts.fonts = with pkgs; [ - corefonts - dejavu_fonts - iosevka - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - powerline-fonts - source-han-sans - ubuntu_font_family - vistafonts - ]; -} diff --git a/common/configuration/console.nix b/common/configuration/console.nix new file mode 100644 index 0000000..a9c70f0 --- /dev/null +++ b/common/configuration/console.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + console = { + earlySetup = true; + font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; + packages = [ pkgs.terminus_font ]; + keyMap = "us"; + }; +} diff --git a/common/configuration/environment.nix b/common/configuration/environment.nix new file mode 100644 index 0000000..1e836c6 --- /dev/null +++ b/common/configuration/environment.nix @@ -0,0 +1,11 @@ +{ + environment = { + sessionVariables = rec { + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVER = "wayland"; + EDITOR = "nvim"; + }; + }; +} diff --git a/common/configuration/fonts.nix b/common/configuration/fonts.nix new file mode 100644 index 0000000..fc6ee8d --- /dev/null +++ b/common/configuration/fonts.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +{ + fonts.fonts = with pkgs; [ + corefonts + dejavu_fonts + iosevka + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + powerline-fonts + source-han-sans + ubuntu_font_family + vistafonts + ]; +} diff --git a/common/configuration/i18n.nix b/common/configuration/i18n.nix new file mode 100644 index 0000000..151539c --- /dev/null +++ b/common/configuration/i18n.nix @@ -0,0 +1,9 @@ +{ + i18n = { + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ + "en_US.UTF-8/UTF-8" + "nl_NL.UTF-8/UTF-8" + ]; + }; +} diff --git a/common/configuration/main.nix b/common/configuration/main.nix new file mode 100644 index 0000000..5e363c3 --- /dev/null +++ b/common/configuration/main.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../home-manager/main.nix + + ./console.nix + ./environment.nix + ./fonts.nix + ./i18n.nix + ./nix.nix + ./services.nix + ./users.nix + ]; + + nixpkgs.config.allowUnfree = true; + time.timeZone = "Europe/Amsterdam"; + programs.zsh.enable = true; +} diff --git a/common/configuration/nix.nix b/common/configuration/nix.nix new file mode 100644 index 0000000..be808e6 --- /dev/null +++ b/common/configuration/nix.nix @@ -0,0 +1,14 @@ +{ + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + + gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 14d"; + }; + }; +} diff --git a/common/configuration/services.nix b/common/configuration/services.nix new file mode 100644 index 0000000..c7f712a --- /dev/null +++ b/common/configuration/services.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: + +{ + services = { + pipewire.enable = true; + gvfs.enable = true; + usbmuxd.enable = true; + smartd.enable = true; + pcscd.enable = true; + fwupd.enable = true; + + printing = { + enable = true; + drivers = [ pkgs.hplip ]; + }; + + openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + }; + }; + + #syncthing = { + #enable = true; + #user = "sijmen"; + #dataDir = config.users.users.sijmen.home; + #}; + }; +} diff --git a/common/configuration/users.nix b/common/configuration/users.nix new file mode 100644 index 0000000..e547248 --- /dev/null +++ b/common/configuration/users.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + users.users.sijmen = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" "wireshark" "video" "dialout" "libvirt" ]; + description = "Sijmen"; + shell = pkgs.zsh; + }; +} diff --git a/framework/configuration.nix b/framework/configuration.nix index 93af87e..87b7461 100644 --- a/framework/configuration.nix +++ b/framework/configuration.nix @@ -18,7 +18,7 @@ in ./hardware-configuration.nix #lanzaboote.nixosModules.lanzaboote - ../common/configuration.nix + ../common/configuration/main.nix ]; virtualisation = { @@ -223,7 +223,7 @@ in }; }; - #home-manager.users.sijmen.imports = [ ../common/dconf.nix ]; + home-manager.users.sijmen.imports = [ ../common/dconf.nix ]; systemd.services."suspend" = { enable = true; diff --git a/nas/configuration.nix b/nas/configuration.nix index 26a0345..42bd210 100644 --- a/nas/configuration.nix +++ b/nas/configuration.nix @@ -4,7 +4,7 @@ imports = [ ./hardware-configuration.nix - ../common/configuration.nix + ../common/configuration/main.nix ]; hardware = { diff --git a/thinkpad/configuration.nix b/thinkpad/configuration.nix index 5a721b0..5648617 100644 --- a/thinkpad/configuration.nix +++ b/thinkpad/configuration.nix @@ -3,7 +3,7 @@ { imports = [ ./hardware-configuration.nix - ../common/configuration.nix + ../common/configuration/main.nix ]; sound.enable = true;