From 744d0b6b5ab5004cde3f52f9303df78047ce13a2 Mon Sep 17 00:00:00 2001 From: buianhhuy96 Date: Mon, 29 Apr 2024 10:07:37 +0300 Subject: [PATCH] Modularize services with flake-parts - Move and rename some modules matching ghaf mainline structure - Create separate folder for hydrajobs - Modularize with flake-parts - Rewrite target config with flake-part modules Signed-off-by: Anh Huy Bui --- config-processor-hardware.nix | 17 ++-- config-processor-installers.nix | 33 ++++++-- flake.lock | 37 +++++++++ flake.nix | 76 ++++++++++-------- hydrajobs/flake-module.nix | 13 +++ modules/desktop/default.nix | 12 +++ .../assets/arrow-circle-left-svgrepo-com.svg | 0 .../assets/arrow-circle-right-svgrepo-com.svg | 0 .../assets/close-circle-svgrepo-com.svg | 0 .../graphics/assets/keyboard.png | Bin .../assets/system-shutdown-symbolic.svg | 0 .../graphics/assets/wallpaper.jpg | Bin modules/{ => desktop}/graphics/default.nix | 0 modules/{ => desktop}/graphics/fonts.nix | 0 modules/{ => desktop}/graphics/sway/config | 0 .../{ => desktop}/graphics/sway/lisgd/config | 0 .../graphics/sway/lisgd/default.nix | 0 .../graphics/sway/nwg-panel/config | 0 .../graphics/sway/nwg-panel/default.nix | 0 .../graphics/sway/nwg-panel/style.css | 0 .../{ => desktop}/graphics/sway/sway.ini.nix | 0 modules/{ => desktop}/graphics/sway/sway.nix | 0 .../{ => desktop}/graphics/window-manager.nix | 0 .../launchers}/default.nix | 0 .../{ => desktop}/profiles/applications.nix | 0 modules/desktop/profiles/default.nix | 10 +++ modules/flake-module.nix | 20 +++++ modules/fmo-module-list.nix | 21 ----- .../dci-service}/default.nix | 0 .../dci-service}/images/.placeholder | 0 modules/fmo-services/default.nix | 15 ++++ .../hostname-service}/default.nix | 0 .../portforwarding-service/default.nix | 0 .../psk-distribution-host}/default.nix | 0 .../psk-distribution-vm}/default.nix | 0 .../registration-agent-laptop/default.nix | 0 modules/installers/default.nix | 12 +++ .../{ => installers}/includeOSS/default.nix | 0 .../pterm-installer/default.nix | 0 .../simple-installer/default.nix | 0 .../{custom-packages => packages}/default.nix | 0 .../libsecret/default.nix | 0 .../nmLauncher/default.nix | 0 .../nwg-bar/default.nix | 0 .../nwg-bar/fix-paths.patch | 0 .../nwg-bar/nwg-bar.nix | 0 .../nwg-panel/default.nix | 0 .../registration-agent/default.nix | 0 .../registration-agent-laptop-with-env.nix | 0 .../registration-agent-laptop.nix | 0 .../registration-agent/remove-test.patch | 0 .../squeekboard/default.nix | 0 .../squeekboard/squeekboard.nix | 0 .../squeekboard/us_wide.patch | 0 .../sway-scripts/default.nix | 0 .../sway-scripts/workspace-switch.nix | 0 modules/profiles/installer.nix | 35 -------- modules/virtualization/microvm/vm.nix | 4 +- 58 files changed, 201 insertions(+), 104 deletions(-) create mode 100644 hydrajobs/flake-module.nix create mode 100644 modules/desktop/default.nix rename modules/{ => desktop}/graphics/assets/arrow-circle-left-svgrepo-com.svg (100%) rename modules/{ => desktop}/graphics/assets/arrow-circle-right-svgrepo-com.svg (100%) rename modules/{ => desktop}/graphics/assets/close-circle-svgrepo-com.svg (100%) rename modules/{ => desktop}/graphics/assets/keyboard.png (100%) rename modules/{ => desktop}/graphics/assets/system-shutdown-symbolic.svg (100%) rename modules/{ => desktop}/graphics/assets/wallpaper.jpg (100%) rename modules/{ => desktop}/graphics/default.nix (100%) rename modules/{ => desktop}/graphics/fonts.nix (100%) rename modules/{ => desktop}/graphics/sway/config (100%) rename modules/{ => desktop}/graphics/sway/lisgd/config (100%) rename modules/{ => desktop}/graphics/sway/lisgd/default.nix (100%) rename modules/{ => desktop}/graphics/sway/nwg-panel/config (100%) rename modules/{ => desktop}/graphics/sway/nwg-panel/default.nix (100%) rename modules/{ => desktop}/graphics/sway/nwg-panel/style.css (100%) rename modules/{ => desktop}/graphics/sway/sway.ini.nix (100%) rename modules/{ => desktop}/graphics/sway/sway.nix (100%) rename modules/{ => desktop}/graphics/window-manager.nix (100%) rename modules/{app-launchers => desktop/launchers}/default.nix (100%) rename modules/{ => desktop}/profiles/applications.nix (100%) create mode 100644 modules/desktop/profiles/default.nix create mode 100644 modules/flake-module.nix delete mode 100644 modules/fmo-module-list.nix rename modules/{fmo-dci-service => fmo-services/dci-service}/default.nix (100%) rename modules/{fmo-dci-service => fmo-services/dci-service}/images/.placeholder (100%) create mode 100644 modules/fmo-services/default.nix rename modules/{fmo-hostname-service => fmo-services/hostname-service}/default.nix (100%) rename modules/{ => fmo-services}/portforwarding-service/default.nix (100%) rename modules/{fmo-psk-distribution-host => fmo-services/psk-distribution-host}/default.nix (100%) rename modules/{fmo-psk-distribution-vm => fmo-services/psk-distribution-vm}/default.nix (100%) rename modules/{ => fmo-services}/registration-agent-laptop/default.nix (100%) create mode 100644 modules/installers/default.nix rename modules/{ => installers}/includeOSS/default.nix (100%) rename modules/{ => installers}/pterm-installer/default.nix (100%) rename modules/{ => installers}/simple-installer/default.nix (100%) rename modules/{custom-packages => packages}/default.nix (100%) rename modules/{custom-packages => packages}/libsecret/default.nix (100%) rename modules/{custom-packages => packages}/nmLauncher/default.nix (100%) rename modules/{custom-packages => packages}/nwg-bar/default.nix (100%) rename modules/{custom-packages => packages}/nwg-bar/fix-paths.patch (100%) rename modules/{custom-packages => packages}/nwg-bar/nwg-bar.nix (100%) rename modules/{custom-packages => packages}/nwg-panel/default.nix (100%) rename modules/{custom-packages => packages}/registration-agent/default.nix (100%) rename modules/{custom-packages => packages}/registration-agent/registration-agent-laptop-with-env.nix (100%) rename modules/{custom-packages => packages}/registration-agent/registration-agent-laptop.nix (100%) rename modules/{custom-packages => packages}/registration-agent/remove-test.patch (100%) rename modules/{custom-packages => packages}/squeekboard/default.nix (100%) rename modules/{custom-packages => packages}/squeekboard/squeekboard.nix (100%) rename modules/{custom-packages => packages}/squeekboard/us_wide.patch (100%) rename modules/{custom-packages => packages}/sway-scripts/default.nix (100%) rename modules/{custom-packages => packages}/sway-scripts/workspace-switch.nix (100%) delete mode 100644 modules/profiles/installer.nix diff --git a/config-processor-hardware.nix b/config-processor-hardware.nix index 6720b09..dd6d5f3 100644 --- a/config-processor-hardware.nix +++ b/config-processor-hardware.nix @@ -23,7 +23,7 @@ let system = "x86_64-linux"; vms = targetconf.vms; - importvm = vmconf: (import ./modules/virtualization/microvm/vm.nix {inherit ghafOS vmconf;}); + importvm = vmconf: (import ./modules/virtualization/microvm/vm.nix {inherit ghafOS vmconf self;}); enablevm = vm: { virtualization.microvm.${vm.name} = { enable = true; @@ -41,6 +41,8 @@ let modules = [ microvm.nixosModules.host + self.nixosModules.fmo-configs + (import "${ghafOS}/modules/host") (import "${ghafOS}/modules/virtualization/microvm/microvm-host.nix") { @@ -78,7 +80,6 @@ let ] ++ map (vm: importvm vms.${vm}) (builtins.attrNames vms) ++ (import "${ghafOS}/modules/module-list.nix") - ++ (import ./modules/fmo-module-list.nix) ++ extraModules ++ (if lib.hasAttr "extraModules" targetconf then targetconf.extraModules else []); }; @@ -93,10 +94,12 @@ let (target "release" []) ]; in { - nixosConfigurations = - builtins.listToAttrs (map (t: lib.nameValuePair t.name t.hostConfiguration) targets); - packages = { - x86_64-linux = - builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); + flake = { + nixosConfigurations = + builtins.listToAttrs (map (t: lib.nameValuePair t.name t.hostConfiguration) targets); + packages = { + x86_64-linux = + builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); + }; }; } diff --git a/config-processor-installers.nix b/config-processor-installers.nix index 8c7e5b8..443f903 100644 --- a/config-processor-installers.nix +++ b/config-processor-installers.nix @@ -42,6 +42,7 @@ let specialArgs = {inherit lib; inherit ghafOS;}; modules = [ + self.nixosModules.installer (import "${ghafOS}/modules/host") ({modulesPath, lib, config, ...}: { imports = [ (modulesPath + "/profiles/all-hardware.nix") ]; @@ -50,12 +51,30 @@ let nixpkgs.config.allowUnfree = true; hardware.enableAllFirmware = true; + + # Installer system profile + # Use less privileged ghaf user + users.users.ghaf = { + isNormalUser = true; + extraGroups = ["wheel" "networkmanager" "video"]; + # Allow the graphical user to login without password + initialHashedPassword = ""; + }; + + # Allow the user to log in as root without a password. + users.users.root.initialHashedPassword = ""; - ghaf = { - profiles.installer.enable = true; + # Allow passwordless sudo from ghaf user + security.sudo = { + enable = lib.mkDefault true; + wheelNeedsPassword = lib.mkImageMediaOverride false; }; + + # Automatically log in at the virtual consoles. + services.getty.autologinUser = lib.mkDefault "ghaf"; }) + # Configs for installation { installer.includeOSS = { enable = lib.mkDefault true; @@ -66,6 +85,7 @@ let }; } + # Installer app { installer.${installerconf.installer.name} = installerApp installerconf.installer; } @@ -77,7 +97,6 @@ let isoImage.squashfsCompression = "lz4"; } ] - ++ (import ./modules/fmo-module-list.nix) ++ (import "${ghafOS}/modules/module-list.nix") ++ extraModules ++ (if lib.hasAttr "extraModules" installerconf then installerconf.extraModules else []); @@ -93,7 +112,9 @@ let (installer "release" []) ]; in { - packages = lib.foldr lib.recursiveUpdate {} (map ({name, system, installerImgDrv, ...}: { - ${system}.${name} = installerImgDrv; - }) targets); + flake = { + packages = lib.foldr lib.recursiveUpdate {} (map ({name, system, installerImgDrv, ...}: { + ${system}.${name} = installerImgDrv; + }) targets); + }; } diff --git a/flake.lock b/flake.lock index 046f001..4836f09 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -155,8 +173,27 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1713714899, + "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "ghafOS": "ghafOS" } }, diff --git a/flake.nix b/flake.nix index 8725008..0cd0322 100644 --- a/flake.nix +++ b/flake.nix @@ -16,12 +16,18 @@ inputs = rec { ghafOS.url = "github:tiiuae/ghaf"; + + # + # Flake and repo structuring configurations + # + # Allows us to structure the flake with the NixOS module system + flake-parts = { + url = "github:hercules-ci/flake-parts"; + }; + }; - outputs = { - self, - ghafOS, - }: let + outputs = inputs @ {ghafOS, flake-parts, self, ...}: let # Retrieve inputs from Ghaf nixpkgs = ghafOS.inputs.nixpkgs; flake-utils = ghafOS.inputs.flake-utils; @@ -43,35 +49,37 @@ generateHwConfig = import ./config-processor-hardware.nix {inherit nixpkgs ghafOS self nixos-hardware nixos-generators lib microvm;}; generateInstConfig = import ./config-processor-installers.nix {inherit nixpkgs ghafOS self nixos-hardware nixos-generators lib microvm;}; in - # Combine list of attribute sets together - lib.foldr lib.recursiveUpdate {} ([ - (flake-utils.lib.eachSystem systems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - hydraJobs = { - packages = { - x86_64-linux = { - fmo-os-installer-public-debug = self.packages.x86_64-linux.fmo-os-installer-public-debug; - fmo-os-installer-public-release = self.packages.x86_64-linux.fmo-os-installer-public-release; - fmo-os-rugged-laptop-7330-public-debug = self.packages.x86_64-linux.fmo-os-rugged-laptop-7330-public-debug; - fmo-os-rugged-laptop-7330-public-release = self.packages.x86_64-linux.fmo-os-rugged-laptop-7330-public-release; - fmo-os-rugged-tablet-7230-public-debug = self.packages.x86_64-linux.fmo-os-rugged-tablet-7230-public-debug; - fmo-os-rugged-tablet-7230-public-release = self.packages.x86_64-linux.fmo-os-rugged-tablet-7230-public-release; - }; - }; - }; - formatter = pkgs.alejandra; - })) - ] - ++ map generateHwConfig [ - (import ./hardware/fmo-os-rugged-laptop-7330.nix) - (import ./hardware/fmo-os-rugged-laptop-7330-public.nix) - (import ./hardware/fmo-os-rugged-tablet-7230.nix) - (import ./hardware/fmo-os-rugged-tablet-7230-public.nix) - ] - ++ map generateInstConfig [ - (import ./installers/fmo-os-installer.nix) - (import ./installers/fmo-os-installer-public.nix) - ]); + flake-parts.lib.mkFlake + { + inherit inputs; + } { + # Toggle this to allow debugging in the repl + # see:https://flake.parts/debug + debug = false; + + systems = [ + "x86_64-linux" + ]; + + imports = [ + ./hydrajobs/flake-module.nix + ./modules/flake-module.nix + ] ++ map generateHwConfig [ + (import ./hardware/fmo-os-rugged-laptop-7330.nix) + (import ./hardware/fmo-os-rugged-laptop-7330-public.nix) + (import ./hardware/fmo-os-rugged-tablet-7230.nix) + (import ./hardware/fmo-os-rugged-tablet-7230-public.nix) + ] ++ map generateInstConfig [ + (import ./installers/fmo-os-installer.nix) + (import ./installers/fmo-os-installer-public.nix) + ]; + + #TODO Fix this + #flake.nixosModules = with lib; + # mapAttrs (_: import) + # (flattenTree (rakeLeaves ./modules)); + + flake.lib = lib; + }; } diff --git a/hydrajobs/flake-module.nix b/hydrajobs/flake-module.nix new file mode 100644 index 0000000..a6fa7a1 --- /dev/null +++ b/hydrajobs/flake-module.nix @@ -0,0 +1,13 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +{self, ...}: +{ + flake.hydraJobs = { + fmo-os-installer-public-debug.x86_64-linux = self.packages.x86_64-linux.fmo-os-installer-public-debug; + fmo-os-installer-public-release.x86_64-linux = self.packages.x86_64-linux.fmo-os-installer-public-release; + fmo-os-rugged-laptop-7330-public-debug.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-laptop-7330-public-debug; + fmo-os-rugged-laptop-7330-public-release.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-laptop-7330-public-release; + fmo-os-rugged-tablet-7230-public-debug.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-tablet-7230-public-debug; + fmo-os-rugged-tablet-7230-public-release.x86_64-linux = self.packages.x86_64-linux.fmo-os-rugged-tablet-7230-public-release; + }; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..3d8934b --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,12 @@ +# Copyright 2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# Ghaf Desktop Experience +# +{ + imports = [ + ./launchers + ./graphics + ./profiles + ]; +} diff --git a/modules/graphics/assets/arrow-circle-left-svgrepo-com.svg b/modules/desktop/graphics/assets/arrow-circle-left-svgrepo-com.svg similarity index 100% rename from modules/graphics/assets/arrow-circle-left-svgrepo-com.svg rename to modules/desktop/graphics/assets/arrow-circle-left-svgrepo-com.svg diff --git a/modules/graphics/assets/arrow-circle-right-svgrepo-com.svg b/modules/desktop/graphics/assets/arrow-circle-right-svgrepo-com.svg similarity index 100% rename from modules/graphics/assets/arrow-circle-right-svgrepo-com.svg rename to modules/desktop/graphics/assets/arrow-circle-right-svgrepo-com.svg diff --git a/modules/graphics/assets/close-circle-svgrepo-com.svg b/modules/desktop/graphics/assets/close-circle-svgrepo-com.svg similarity index 100% rename from modules/graphics/assets/close-circle-svgrepo-com.svg rename to modules/desktop/graphics/assets/close-circle-svgrepo-com.svg diff --git a/modules/graphics/assets/keyboard.png b/modules/desktop/graphics/assets/keyboard.png similarity index 100% rename from modules/graphics/assets/keyboard.png rename to modules/desktop/graphics/assets/keyboard.png diff --git a/modules/graphics/assets/system-shutdown-symbolic.svg b/modules/desktop/graphics/assets/system-shutdown-symbolic.svg similarity index 100% rename from modules/graphics/assets/system-shutdown-symbolic.svg rename to modules/desktop/graphics/assets/system-shutdown-symbolic.svg diff --git a/modules/graphics/assets/wallpaper.jpg b/modules/desktop/graphics/assets/wallpaper.jpg similarity index 100% rename from modules/graphics/assets/wallpaper.jpg rename to modules/desktop/graphics/assets/wallpaper.jpg diff --git a/modules/graphics/default.nix b/modules/desktop/graphics/default.nix similarity index 100% rename from modules/graphics/default.nix rename to modules/desktop/graphics/default.nix diff --git a/modules/graphics/fonts.nix b/modules/desktop/graphics/fonts.nix similarity index 100% rename from modules/graphics/fonts.nix rename to modules/desktop/graphics/fonts.nix diff --git a/modules/graphics/sway/config b/modules/desktop/graphics/sway/config similarity index 100% rename from modules/graphics/sway/config rename to modules/desktop/graphics/sway/config diff --git a/modules/graphics/sway/lisgd/config b/modules/desktop/graphics/sway/lisgd/config similarity index 100% rename from modules/graphics/sway/lisgd/config rename to modules/desktop/graphics/sway/lisgd/config diff --git a/modules/graphics/sway/lisgd/default.nix b/modules/desktop/graphics/sway/lisgd/default.nix similarity index 100% rename from modules/graphics/sway/lisgd/default.nix rename to modules/desktop/graphics/sway/lisgd/default.nix diff --git a/modules/graphics/sway/nwg-panel/config b/modules/desktop/graphics/sway/nwg-panel/config similarity index 100% rename from modules/graphics/sway/nwg-panel/config rename to modules/desktop/graphics/sway/nwg-panel/config diff --git a/modules/graphics/sway/nwg-panel/default.nix b/modules/desktop/graphics/sway/nwg-panel/default.nix similarity index 100% rename from modules/graphics/sway/nwg-panel/default.nix rename to modules/desktop/graphics/sway/nwg-panel/default.nix diff --git a/modules/graphics/sway/nwg-panel/style.css b/modules/desktop/graphics/sway/nwg-panel/style.css similarity index 100% rename from modules/graphics/sway/nwg-panel/style.css rename to modules/desktop/graphics/sway/nwg-panel/style.css diff --git a/modules/graphics/sway/sway.ini.nix b/modules/desktop/graphics/sway/sway.ini.nix similarity index 100% rename from modules/graphics/sway/sway.ini.nix rename to modules/desktop/graphics/sway/sway.ini.nix diff --git a/modules/graphics/sway/sway.nix b/modules/desktop/graphics/sway/sway.nix similarity index 100% rename from modules/graphics/sway/sway.nix rename to modules/desktop/graphics/sway/sway.nix diff --git a/modules/graphics/window-manager.nix b/modules/desktop/graphics/window-manager.nix similarity index 100% rename from modules/graphics/window-manager.nix rename to modules/desktop/graphics/window-manager.nix diff --git a/modules/app-launchers/default.nix b/modules/desktop/launchers/default.nix similarity index 100% rename from modules/app-launchers/default.nix rename to modules/desktop/launchers/default.nix diff --git a/modules/profiles/applications.nix b/modules/desktop/profiles/applications.nix similarity index 100% rename from modules/profiles/applications.nix rename to modules/desktop/profiles/applications.nix diff --git a/modules/desktop/profiles/default.nix b/modules/desktop/profiles/default.nix new file mode 100644 index 0000000..abd51f0 --- /dev/null +++ b/modules/desktop/profiles/default.nix @@ -0,0 +1,10 @@ +# Copyright 2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# Ghaf Graphic Profiles +# +{ + imports = [ + ./applications.nix + ]; +} diff --git a/modules/flake-module.nix b/modules/flake-module.nix new file mode 100644 index 0000000..c950eac --- /dev/null +++ b/modules/flake-module.nix @@ -0,0 +1,20 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# +{inputs, ...}: { + flake.nixosModules = { + fmo-configs.imports = [ + ./packages + ./fmo-services + ./desktop + ../utils/write-to-file + ]; + installer.imports = [ + ./packages + ./installers + ./fmo-services + ../utils/write-to-file + ]; + }; +} diff --git a/modules/fmo-module-list.nix b/modules/fmo-module-list.nix deleted file mode 100644 index 7d0796c..0000000 --- a/modules/fmo-module-list.nix +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -# SPDX-License-Identifier: Apache-2.0 -# -# -[ - ./app-launchers - ./custom-packages - ./graphics - ./includeOSS - ./fmo-dci-service - ./simple-installer - ./pterm-installer - ./fmo-hostname-service - ./profiles/applications.nix - ./profiles/installer.nix - ./portforwarding-service - ./registration-agent-laptop - ../utils/write-to-file - ./fmo-psk-distribution-host - ./fmo-psk-distribution-vm -] diff --git a/modules/fmo-dci-service/default.nix b/modules/fmo-services/dci-service/default.nix similarity index 100% rename from modules/fmo-dci-service/default.nix rename to modules/fmo-services/dci-service/default.nix diff --git a/modules/fmo-dci-service/images/.placeholder b/modules/fmo-services/dci-service/images/.placeholder similarity index 100% rename from modules/fmo-dci-service/images/.placeholder rename to modules/fmo-services/dci-service/images/.placeholder diff --git a/modules/fmo-services/default.nix b/modules/fmo-services/default.nix new file mode 100644 index 0000000..fa9694f --- /dev/null +++ b/modules/fmo-services/default.nix @@ -0,0 +1,15 @@ +# Copyright 2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# Services for FMO +# +{ + imports = [ + ./dci-service + ./hostname-service + ./portforwarding-service + ./psk-distribution-host + ./psk-distribution-vm + ./registration-agent-laptop + ]; +} diff --git a/modules/fmo-hostname-service/default.nix b/modules/fmo-services/hostname-service/default.nix similarity index 100% rename from modules/fmo-hostname-service/default.nix rename to modules/fmo-services/hostname-service/default.nix diff --git a/modules/portforwarding-service/default.nix b/modules/fmo-services/portforwarding-service/default.nix similarity index 100% rename from modules/portforwarding-service/default.nix rename to modules/fmo-services/portforwarding-service/default.nix diff --git a/modules/fmo-psk-distribution-host/default.nix b/modules/fmo-services/psk-distribution-host/default.nix similarity index 100% rename from modules/fmo-psk-distribution-host/default.nix rename to modules/fmo-services/psk-distribution-host/default.nix diff --git a/modules/fmo-psk-distribution-vm/default.nix b/modules/fmo-services/psk-distribution-vm/default.nix similarity index 100% rename from modules/fmo-psk-distribution-vm/default.nix rename to modules/fmo-services/psk-distribution-vm/default.nix diff --git a/modules/registration-agent-laptop/default.nix b/modules/fmo-services/registration-agent-laptop/default.nix similarity index 100% rename from modules/registration-agent-laptop/default.nix rename to modules/fmo-services/registration-agent-laptop/default.nix diff --git a/modules/installers/default.nix b/modules/installers/default.nix new file mode 100644 index 0000000..2493ce6 --- /dev/null +++ b/modules/installers/default.nix @@ -0,0 +1,12 @@ +# Copyright 2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# Installers for FMO +# +{ + imports = [ + ./includeOSS + ./pterm-installer + ./simple-installer + ]; +} diff --git a/modules/includeOSS/default.nix b/modules/installers/includeOSS/default.nix similarity index 100% rename from modules/includeOSS/default.nix rename to modules/installers/includeOSS/default.nix diff --git a/modules/pterm-installer/default.nix b/modules/installers/pterm-installer/default.nix similarity index 100% rename from modules/pterm-installer/default.nix rename to modules/installers/pterm-installer/default.nix diff --git a/modules/simple-installer/default.nix b/modules/installers/simple-installer/default.nix similarity index 100% rename from modules/simple-installer/default.nix rename to modules/installers/simple-installer/default.nix diff --git a/modules/custom-packages/default.nix b/modules/packages/default.nix similarity index 100% rename from modules/custom-packages/default.nix rename to modules/packages/default.nix diff --git a/modules/custom-packages/libsecret/default.nix b/modules/packages/libsecret/default.nix similarity index 100% rename from modules/custom-packages/libsecret/default.nix rename to modules/packages/libsecret/default.nix diff --git a/modules/custom-packages/nmLauncher/default.nix b/modules/packages/nmLauncher/default.nix similarity index 100% rename from modules/custom-packages/nmLauncher/default.nix rename to modules/packages/nmLauncher/default.nix diff --git a/modules/custom-packages/nwg-bar/default.nix b/modules/packages/nwg-bar/default.nix similarity index 100% rename from modules/custom-packages/nwg-bar/default.nix rename to modules/packages/nwg-bar/default.nix diff --git a/modules/custom-packages/nwg-bar/fix-paths.patch b/modules/packages/nwg-bar/fix-paths.patch similarity index 100% rename from modules/custom-packages/nwg-bar/fix-paths.patch rename to modules/packages/nwg-bar/fix-paths.patch diff --git a/modules/custom-packages/nwg-bar/nwg-bar.nix b/modules/packages/nwg-bar/nwg-bar.nix similarity index 100% rename from modules/custom-packages/nwg-bar/nwg-bar.nix rename to modules/packages/nwg-bar/nwg-bar.nix diff --git a/modules/custom-packages/nwg-panel/default.nix b/modules/packages/nwg-panel/default.nix similarity index 100% rename from modules/custom-packages/nwg-panel/default.nix rename to modules/packages/nwg-panel/default.nix diff --git a/modules/custom-packages/registration-agent/default.nix b/modules/packages/registration-agent/default.nix similarity index 100% rename from modules/custom-packages/registration-agent/default.nix rename to modules/packages/registration-agent/default.nix diff --git a/modules/custom-packages/registration-agent/registration-agent-laptop-with-env.nix b/modules/packages/registration-agent/registration-agent-laptop-with-env.nix similarity index 100% rename from modules/custom-packages/registration-agent/registration-agent-laptop-with-env.nix rename to modules/packages/registration-agent/registration-agent-laptop-with-env.nix diff --git a/modules/custom-packages/registration-agent/registration-agent-laptop.nix b/modules/packages/registration-agent/registration-agent-laptop.nix similarity index 100% rename from modules/custom-packages/registration-agent/registration-agent-laptop.nix rename to modules/packages/registration-agent/registration-agent-laptop.nix diff --git a/modules/custom-packages/registration-agent/remove-test.patch b/modules/packages/registration-agent/remove-test.patch similarity index 100% rename from modules/custom-packages/registration-agent/remove-test.patch rename to modules/packages/registration-agent/remove-test.patch diff --git a/modules/custom-packages/squeekboard/default.nix b/modules/packages/squeekboard/default.nix similarity index 100% rename from modules/custom-packages/squeekboard/default.nix rename to modules/packages/squeekboard/default.nix diff --git a/modules/custom-packages/squeekboard/squeekboard.nix b/modules/packages/squeekboard/squeekboard.nix similarity index 100% rename from modules/custom-packages/squeekboard/squeekboard.nix rename to modules/packages/squeekboard/squeekboard.nix diff --git a/modules/custom-packages/squeekboard/us_wide.patch b/modules/packages/squeekboard/us_wide.patch similarity index 100% rename from modules/custom-packages/squeekboard/us_wide.patch rename to modules/packages/squeekboard/us_wide.patch diff --git a/modules/custom-packages/sway-scripts/default.nix b/modules/packages/sway-scripts/default.nix similarity index 100% rename from modules/custom-packages/sway-scripts/default.nix rename to modules/packages/sway-scripts/default.nix diff --git a/modules/custom-packages/sway-scripts/workspace-switch.nix b/modules/packages/sway-scripts/workspace-switch.nix similarity index 100% rename from modules/custom-packages/sway-scripts/workspace-switch.nix rename to modules/packages/sway-scripts/workspace-switch.nix diff --git a/modules/profiles/installer.nix b/modules/profiles/installer.nix deleted file mode 100644 index a4c6d96..0000000 --- a/modules/profiles/installer.nix +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2022-2023 TII (SSRC) and the Ghaf contributors -# SPDX-License-Identifier: Apache-2.0 -# -{ - config, - lib, - ... -}: let - cfg = config.ghaf.profiles.installer; -in - with lib; { - options.ghaf.profiles.installer.enable = mkEnableOption "installer profile"; - - config = mkIf cfg.enable { - # Use less privileged ghaf user - users.users.ghaf = { - isNormalUser = true; - extraGroups = ["wheel" "networkmanager" "video"]; - # Allow the graphical user to login without password - initialHashedPassword = ""; - }; - - # Allow the user to log in as root without a password. - users.users.root.initialHashedPassword = ""; - - # Allow passwordless sudo from ghaf user - security.sudo = { - enable = mkDefault true; - wheelNeedsPassword = mkImageMediaOverride false; - }; - - # Automatically log in at the virtual consoles. - services.getty.autologinUser = mkDefault "ghaf"; - }; - } diff --git a/modules/virtualization/microvm/vm.nix b/modules/virtualization/microvm/vm.nix index 559cee7..5966a33 100644 --- a/modules/virtualization/microvm/vm.nix +++ b/modules/virtualization/microvm/vm.nix @@ -3,6 +3,7 @@ { ghafOS, vmconf, + self, }:{ config, lib, @@ -92,9 +93,10 @@ microvm.qemu.bios.enable = false; microvm.storeDiskType = "squashfs"; - imports = (import "${ghafOS}/modules/module-list.nix") ++ (import ../../fmo-module-list.nix); + imports = (import "${ghafOS}/modules/module-list.nix"); }) addSystemPackages + self.nixosModules.fmo-configs ]; }; cfg = config.ghaf.virtualization.microvm.${vmconf.name};