From 57ea32a88ed029b415f2ea1958aec094ce656274 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 25 Aug 2024 17:54:47 +0000 Subject: [PATCH] flake: extract nixosModules as submodule --- flake.nix | 39 +------------------------------ nix/nixos-modules/default.nix | 43 +++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/flake.nix b/flake.nix index d077d1d..e178e1d 100644 --- a/flake.nix +++ b/flake.nix @@ -188,44 +188,7 @@ }; - nixosModules = { - - # this one includes all of my modules - # - most of them only change things when enabled (e.g. x-banananetwork.*.enable) - # - others only introduce small, reasonable changes if other module’s options are set, as reasonable defaults (if I intend to upstream them) - # however, use on your own discretion - banananetwork = import ./nix/nixos-modules; - - # this one defines common options for my systems to my modules - # you definitely do not want to use this - myOptions = import ./nix/myOptions.nix; - - # this one also includes required dependencies from flake inputs - withDepends = - { config, pkgs, ... }: - { - imports = [ - inputs.disko.nixosModules.disko - inputs.home-manager.nixosModules.home-manager - inputs.impermanence.nixosModules.impermanence - inputs.secrix.nixosModules.secrix - outputs.nixosModules.banananetwork - ]; - config = { - nixpkgs.overlays = [ - # TODO until 24.11 - (lib.mkIf (!lib.versionAtLeast lib.version "24.11") ( - final: prev: { - inherit ((lib.systemSpecificVars pkgs.system).pkgs_unstable) nixfmt-rfc-style wcurl; - } - )) - ]; - }; - }; - - }; - - + nixosModules = importFlakeMod ./nix/nixos-modules; packages = importFlakeModWithSystem ./nix/packages; diff --git a/nix/nixos-modules/default.nix b/nix/nixos-modules/default.nix index c253018..0442f49 100644 --- a/nix/nixos-modules/default.nix +++ b/nix/nixos-modules/default.nix @@ -1,7 +1,19 @@ -# ../../flakes.nix expects this to just be a NixOS module { + inputs, + lib, + outputs, + self, + ... +}@flakeArg: +{ + + default = self.withDepends; - imports = [ + # this one includes all of my modules + # - most of them only change things when enabled (e.g. x-banananetwork.*.enable) + # - others only introduce small, reasonable changes if other module’s options are set, as reasonable defaults (if I intend to upstream them) + # however, use on your own discretion + banananetwork.imports = [ # directories ./extends ./frontend @@ -21,4 +33,31 @@ ./vmCommon.nix ]; + # this one defines common options for my systems to my modules + # you definitely do not want to use this + myOptions = import ../myOptions.nix; + + # this one also includes required dependencies from flake inputs + withDepends = + { config, pkgs, ... }: + { + imports = [ + inputs.disko.nixosModules.disko + inputs.home-manager.nixosModules.home-manager + inputs.impermanence.nixosModules.impermanence + inputs.secrix.nixosModules.secrix + outputs.nixosModules.banananetwork + ]; + config = { + nixpkgs.overlays = [ + # TODO until 24.11 + (lib.mkIf (!lib.versionAtLeast lib.version "24.11") ( + final: prev: { + inherit ((lib.systemSpecificVars pkgs.system).pkgs_unstable) nixfmt-rfc-style wcurl; + } + )) + ]; + }; + }; + }