From 4190818304cc2e2f23c97f9fc42eea1fd92dfee3 Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Sat, 13 Aug 2022 22:59:05 +0200 Subject: [PATCH] Rework of x-os module / core profile * move core settings to x-os * add option to only install a lite core * rename x-os module to core * remove core profile from flake.nix --- flake.nix | 4 +- modules/{x-os => core}/boot.nix | 6 +-- modules/core/default.nix | 30 +++++++++++ modules/{x-os => core}/fonts.nix | 0 modules/{x-os => core}/i18n.nix | 0 modules/core/modules.nix | 11 ++++ modules/{x-os => core}/networking.nix | 4 +- modules/{x-os => core}/nix.nix | 0 modules/core/packages.nix | 76 +++++++++++++++++++++++++++ modules/{x-os => core}/services.nix | 1 - modules/x-os/default.nix | 10 ---- profiles/core/default.nix | 75 -------------------------- profiles/pub-solar-iso/default.nix | 2 +- 13 files changed, 125 insertions(+), 94 deletions(-) rename modules/{x-os => core}/boot.nix (85%) create mode 100644 modules/core/default.nix rename modules/{x-os => core}/fonts.nix (100%) rename modules/{x-os => core}/i18n.nix (100%) create mode 100644 modules/core/modules.nix rename modules/{x-os => core}/networking.nix (95%) rename modules/{x-os => core}/nix.nix (100%) create mode 100644 modules/core/packages.nix rename modules/{x-os => core}/services.nix (99%) delete mode 100644 modules/x-os/default.nix delete mode 100644 profiles/core/default.nix diff --git a/flake.nix b/flake.nix index 7d43b67c..0c8a1c92 100644 --- a/flake.nix +++ b/flake.nix @@ -118,9 +118,9 @@ users = digga.lib.rakeLeaves ./users; }; suites = with profiles; rec { - base = [ core users.pub-solar users.root ]; + base = [ users.pub-solar users.root ]; iso = base ++ [ base-user graphical pub-solar-iso ]; - pubsolaros = [ core dram full-install base-user users.root ]; + pubsolaros = [ dram full-install base-user users.root ]; anonymous = [ pubsolaros users.pub-solar ]; }; }; diff --git a/modules/x-os/boot.nix b/modules/core/boot.nix similarity index 85% rename from modules/x-os/boot.nix rename to modules/core/boot.nix index dd788d26..9e9af88e 100644 --- a/modules/x-os/boot.nix +++ b/modules/core/boot.nix @@ -1,15 +1,15 @@ { config, pkgs, lib, ... }: with lib; let - cfg = config.pub-solar.x-os; + cfg = config.pub-solar.core; in { - options.pub-solar.x-os.iso-options.enable = mkOption { + options.pub-solar.core.iso-options.enable = mkOption { type = types.bool; default = false; description = "Feature flag for iso builds"; }; - options.pub-solar.x-os.disk-encryption-active = mkOption { + options.pub-solar.core.disk-encryption-active = mkOption { type = types.bool; default = true; description = "Whether it should be assumed that there is a cryptroot device"; diff --git a/modules/core/default.nix b/modules/core/default.nix new file mode 100644 index 00000000..dae70e79 --- /dev/null +++ b/modules/core/default.nix @@ -0,0 +1,30 @@ +{ lib, ... }: + +with lib; +let + psCfg = config.pub-solar; + cfg = config.pub-solar.core; +in +{ + imports = [ + ./boot.nix + ./fonts.nix + ./i18n.nix + ./modules.nix + ./networking.nix + ./nix.nix + ./packages.nix + ./services.nix + ]; + + options.pub-solar.core = { + lite-core-active = mkOption { + description = '' + Whether the node should run as a server or agent. + Note that the server, by default, also runs as an agent. + ''; + default = false; + type = types.bool; + }; + }; +} diff --git a/modules/x-os/fonts.nix b/modules/core/fonts.nix similarity index 100% rename from modules/x-os/fonts.nix rename to modules/core/fonts.nix diff --git a/modules/x-os/i18n.nix b/modules/core/i18n.nix similarity index 100% rename from modules/x-os/i18n.nix rename to modules/core/i18n.nix diff --git a/modules/core/modules.nix b/modules/core/modules.nix new file mode 100644 index 00000000..b55281eb --- /dev/null +++ b/modules/core/modules.nix @@ -0,0 +1,11 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.pub-solar.core; +in +{ + pub-solar.terminal-life.enable = lib.mkIf (!cfg.lite-core-active) true; + pub-solar.audio.enable = lib.mkIf (!cfg.lite-core-active) true; + pub-solar.crypto.enable = lib.mkIf (!cfg.lite-core-active) true; + pub-solar.devops.enable = lib.mkIf (!cfg.lite-core-active) true; +} diff --git a/modules/x-os/networking.nix b/modules/core/networking.nix similarity index 95% rename from modules/x-os/networking.nix rename to modules/core/networking.nix index 347fe750..ce3248d8 100644 --- a/modules/x-os/networking.nix +++ b/modules/core/networking.nix @@ -2,10 +2,10 @@ with lib; -let cfg = config.pub-solar.x-os; +let cfg = config.pub-solar.core; in { - options.pub-solar.x-os = { + options.pub-solar.core = { binaryCaches = mkOption { type = types.listOf types.str; default = [ ]; diff --git a/modules/x-os/nix.nix b/modules/core/nix.nix similarity index 100% rename from modules/x-os/nix.nix rename to modules/core/nix.nix diff --git a/modules/core/packages.nix b/modules/core/packages.nix new file mode 100644 index 00000000..07263245 --- /dev/null +++ b/modules/core/packages.nix @@ -0,0 +1,76 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + psCfg = config.pub-solar; + cfg = config.pub-solar.core; +in +{ + environment = { + systemPackages = with pkgs; [ + # Core unix utility packages + coreutils-full + dnsutils + inetutils + progress + pciutils + usbutils + + wget + openssl + openssh + curl + htop + lsof + psmisc + file + ] + + ++ lib.optionals (!cfg.lite-core-active) [ + mtr + + gitFull + git-lfs + git-bug + + xdg-utils + sysfsutils + renameutils + nfs-utils + moreutils + mailutils + keyutils + input-utils + elfutils + binutils + dateutils + diffutils + findutils + exfat + + + # zippit + zip + unzip + + # Modern modern utilities + p7zip + croc + jq + + # Nix specific utilities + niv + manix + nix-index + nix-tree + nixpkgs-review + # Build broken, python2.7-PyJWT-2.0.1.drv' failed + #nixops + psos + nvd + + # Fun + neofetch + ]; + }; +} diff --git a/modules/x-os/services.nix b/modules/core/services.nix similarity index 99% rename from modules/x-os/services.nix rename to modules/core/services.nix index 98a058a3..61ba6ea0 100644 --- a/modules/x-os/services.nix +++ b/modules/core/services.nix @@ -1,7 +1,6 @@ { config, pkgs, lib, ... }: { - # For rage encryption, all hosts need a ssh key pair services.openssh = { enable = true; diff --git a/modules/x-os/default.nix b/modules/x-os/default.nix deleted file mode 100644 index 0fd734f3..00000000 --- a/modules/x-os/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: { - imports = [ - ./boot.nix - ./fonts.nix - ./i18n.nix - ./networking.nix - ./nix.nix - ./services.nix - ]; -} diff --git a/profiles/core/default.nix b/profiles/core/default.nix deleted file mode 100644 index b35fb673..00000000 --- a/profiles/core/default.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ self, config, lib, pkgs, inputs, ... }: -let inherit (lib) fileContents; -in -{ - # Sets nrdxp.cachix.org binary cache which just speeds up some builds - imports = [ ../cachix ]; - - config = { - pub-solar.terminal-life.enable = true; - pub-solar.audio.enable = true; - pub-solar.crypto.enable = true; - pub-solar.devops.enable = true; - - environment = { - systemPackages = with pkgs; [ - # Core unix utility packages - coreutils-full - progress - dnsutils - inetutils - mtr - pciutils - usbutils - gitFull - git-lfs - git-bug - wget - openssl - openssh - curl - htop - lsof - psmisc - xdg-utils - sysfsutils - renameutils - nfs-utils - moreutils - mailutils - keyutils - input-utils - elfutils - binutils - dateutils - diffutils - findutils - exfat - file - - # zippit - zip - unzip - - # Modern modern utilities - p7zip - croc - jq - - # Nix specific utilities - niv - manix - nix-index - nix-tree - nixpkgs-review - # Build broken, python2.7-PyJWT-2.0.1.drv' failed - #nixops - psos - nvd - - # Fun - neofetch - ]; - }; - }; -} diff --git a/profiles/pub-solar-iso/default.nix b/profiles/pub-solar-iso/default.nix index 24b5e1b3..4aa8c6fd 100644 --- a/profiles/pub-solar-iso/default.nix +++ b/profiles/pub-solar-iso/default.nix @@ -6,6 +6,6 @@ in config = { pub-solar.graphical.wayland.software-renderer.enable = true; pub-solar.sway.terminal = "foot"; - pub-solar.x-os.iso-options.enable = true; + pub-solar.core.iso-options.enable = true; }; }