From 3509ca4220bfa7fd3a29b4f349e04e613b60ec83 Mon Sep 17 00:00:00 2001 From: guangtao Date: Tue, 10 Oct 2023 01:45:13 -0700 Subject: [PATCH] refactor: update flops --- flake.lock | 12 ++++---- flake.nix | 3 +- lib/exporter/flakeOutputs.nix | 1 + lib/exporter/pops.nix | 12 +++++--- nixos/nixosProfiles/cloud.nix | 38 ++++++++++++++++++++----- nixos/nixosProfiles/presets/openssh.nix | 2 +- tests/nixos/expr.nix | 2 +- tests/srvos/expr.nix | 2 ++ 8 files changed, 52 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index 713282f..99332c5 100644 --- a/flake.lock +++ b/flake.lock @@ -78,11 +78,11 @@ "yants": "yants" }, "locked": { - "lastModified": 1696762256, - "narHash": "sha256-Nc7OLhNQvymJdX5bpydppminR1eRT10VTe9hzryuIQA=", + "lastModified": 1696927051, + "narHash": "sha256-6l7xdYAS77Eqruv8/acx3uVcYPMaxDga2QWPPVXOaZc=", "owner": "gtrunsec", "repo": "flops", - "rev": "d8a533984bf2d9faa06c9eb85cc81c57a0d7c551", + "rev": "5bea3b358b8b5745b6f19e4678a643c57110f0fe", "type": "github" }, "original": { @@ -99,11 +99,11 @@ ] }, "locked": { - "lastModified": 1689557889, - "narHash": "sha256-kllmt6JnHlry+WAASdSMDaRwbiuk2dFhkbW3Qz1w8BU=", + "lastModified": 1696529440, + "narHash": "sha256-bjWiVgh0zrd3dVb1rb5ODC5UY3tnhs2idbhDBc0ETbI=", "owner": "nix-community", "repo": "haumea", - "rev": "d6a9593ff2160ce29bf6d905e9ccbcecd66baeef", + "rev": "d9ec6a90764ddec918ef441e8b83d6aebae9226f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e1aa205..7db5794 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,8 @@ omnibus = { inherit (self) pops; inherit lib; - }; + } // lib.layouts.default.exporter.flakeOutputs; + lib = import ./lib/__init.nix { inherit inputs omnibus; }; lib' = lib.layouts.default; in diff --git a/lib/exporter/flakeOutputs.nix b/lib/exporter/flakeOutputs.nix index 6b6042a..866b1de 100644 --- a/lib/exporter/flakeOutputs.nix +++ b/lib/exporter/flakeOutputs.nix @@ -11,6 +11,7 @@ let ; in { + inherit (outputs) srvos; devshellModules = outputs.devshell.loadModules; devshellProfiles = outputs.devshell.loadProfiles; diff --git a/lib/exporter/pops.nix b/lib/exporter/pops.nix index 128e557..a1132ec 100644 --- a/lib/exporter/pops.nix +++ b/lib/exporter/pops.nix @@ -13,16 +13,20 @@ src = self'.outPath + "/nixos/nixosModules"; type = "nixosModules"; inputs = { - POP = POP.lib; - flops = flops.lib; - omnibus = self; + inherit omnibus POP flops; + inputs = { + inherit (inputs) dmerge; + }; }; }; loadHomeModules = flops.haumea.pops.default.setInit { src = self'.outPath + "/nixos/homeModules"; type = "nixosModules"; inputs = { - omnibus = self; + inherit omnibus POP flops; + inputs = { + inherit (inputs) dmerge; + }; }; }; loadHomeProfiles = self.loadHomeModules.addLoadExtender { diff --git a/nixos/nixosProfiles/cloud.nix b/nixos/nixosProfiles/cloud.nix index f03161c..5e961e0 100644 --- a/nixos/nixosProfiles/cloud.nix +++ b/nixos/nixosProfiles/cloud.nix @@ -1,15 +1,39 @@ # [[file:../../docs/org/nixosProfiles.org::*cloud][cloud:1]] -{ root }: +{ + root, + omnibus, + POP, + flops, + inputs, +}: let + inherit (inputs) dmerge; + srvosCustom = + (omnibus.pops.srvos.addExporters [ + (POP.extendPop flops.haumea.pops.exporter ( + self: super: { + exports.srvosCustom = self.outputs [ { + value = { selfModule }: removeAttrs selfModule [ "imports" ]; + path = [ + "common" + "default" + ]; + } ]; + } + )) + ]).layouts.srvosCustom; presets = root.presets; in with presets; { - default = [ { - boot.cleanTmpDir = true; - boot.tmp.cleanOnBoot = true; - zramSwap.enable = true; - documentation.enable = false; - } ]; + default = [ + srvosCustom.common.default + { + boot.cleanTmpDir = true; + boot.tmp.cleanOnBoot = true; + zramSwap.enable = true; + documentation.enable = false; + } + ]; contabo = [ self.default diff --git a/nixos/nixosProfiles/presets/openssh.nix b/nixos/nixosProfiles/presets/openssh.nix index 6a3e4fe..5364afd 100644 --- a/nixos/nixosProfiles/presets/openssh.nix +++ b/nixos/nixosProfiles/presets/openssh.nix @@ -1,6 +1,6 @@ { omnibus }: { - imports = [ omnibus.srvos.layouts.default.common.openssh ]; + imports = [ omnibus.srvos.common.openssh ]; services.openssh = { enable = true; }; diff --git a/tests/nixos/expr.nix b/tests/nixos/expr.nix index 20924c4..a3a9bcb 100644 --- a/tests/nixos/expr.nix +++ b/tests/nixos/expr.nix @@ -23,6 +23,6 @@ in } // lib.optionalAttrs trace { nixosConfiguration = exporter.layouts.nixosConfiguration [ - exporter.layouts.exporter.nixosProfiles.customProfiles.presets.boot + exporter.layouts.exporter.nixosProfiles.default.presets.boot ]; } diff --git a/tests/srvos/expr.nix b/tests/srvos/expr.nix index 5dba4e4..175c19b 100644 --- a/tests/srvos/expr.nix +++ b/tests/srvos/expr.nix @@ -12,6 +12,8 @@ in (exporter.layouts.nixosConfiguration [ exporter.layouts.exporter.nixosProfiles.default.presets.boot exporter.layouts.exporter.nixosProfiles.default.presets.openssh + # -- suites profile -- + (exporter.layouts.exporter.nixosProfiles.default.cloud { }).default ]).config.services.openssh.settings.KexAlgorithms; } // lib.optionalAttrs trace { }