From b597059d73e2bebd652ecd1474085b675c97b60f Mon Sep 17 00:00:00 2001 From: guangtao Date: Thu, 5 Oct 2023 19:50:22 -0700 Subject: [PATCH] feat: WIP add nixos example --- flake.nix | 20 +++++-------------- lib/exporters/pops.nix | 28 ++++++++++++++++++++------- templates/nixos/flake.nix | 2 +- templates/nixos/nix/lib/exporters.nix | 2 +- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/flake.nix b/flake.nix index 73c3347..5a4c6a5 100644 --- a/flake.nix +++ b/flake.nix @@ -26,35 +26,25 @@ self' = self; home-manager = omnibus.pops.loadInputs.outputs.home-manager; haumea = haumea.lib; + dmerge = inputs.flops.inputs.dmerge; POP = POP.lib; - inherit omnibus flops; + flops = flops.lib; + inherit omnibus; }; }; nixosConfigurations = - (self.exporters.addLoadExtender { + (self.pops.exporters.addLoadExtender { src = ./nixos/nixosConfigurations; inputs = { nixpkgs = omnibus.pops.loadInputs.outputs.nixpkgs; - exporters = self.exporters.outputs.default; + exporters = self.pops.exporters.outputs.default; }; }).outputs.default; in { inherit (lib.outputs.default.exporters) pops; inherit nixosConfigurations lib; - exporters = flops.lib.haumea.pops.default.setInit { - loader = with haumea.lib; loaders.scoped; - src = ./examples; - inputs = { - lib = flops.inputs.nixlib.lib // builtins; - flops = flops.lib; - haumea = flops.inputs.haumea.lib; - dmerge = flops.inputs.dmerge; - POP = POP.lib; - inherit omnibus; - }; - }; templates.default = { path = ./templates/nixos; diff --git a/lib/exporters/pops.nix b/lib/exporters/pops.nix index ece7295..d49f5a3 100644 --- a/lib/exporters/pops.nix +++ b/lib/exporters/pops.nix @@ -1,18 +1,16 @@ { dotfiles = self'.outPath + "/dotfiles"; - # FIXME: needs to fix the logic of loadInputs path - # self'.outPath + ""; - loadInputs = flops.lib.flake.pops.default.setInitInputs ( + loadInputs = flops.flake.pops.default.setInitInputs ( self'.outPath + "/local/lock" ); - loadData = flops.lib.haumea.pops.default.setInit { + loadData = flops.haumea.pops.default.setInit { src = self'.outPath + "/examples/__data"; loader = with haumea; [ matchers.json matchers.toml ]; }; - loadNixOSModules = flops.lib.haumea.pops.default.setInit { + loadNixOSModules = flops.haumea.pops.default.setInit { src = self'.outPath + "/nixos/nixosModules"; type = "nixosModules"; inputs = { @@ -21,7 +19,7 @@ omnibus = self; }; }; - loadHomeModules = flops.lib.haumea.pops.default.setInit { + loadHomeModules = flops.haumea.pops.default.setInit { src = self'.outPath + "/nixos/homeModules"; type = "nixosModules"; inputs = { @@ -38,7 +36,7 @@ src = self'.outPath + "/nixos/nixosProfiles"; type = "nixosProfiles"; }; - srvos = flops.lib.haumea.pops.default.setInit { + srvos = flops.haumea.pops.default.setInit { src = builtins.unsafeDiscardStringContext ( self.loadInputs.outputs.srvos + "/nixos" ); @@ -73,4 +71,20 @@ }; }; }; + + exporters = flops.haumea.pops.default.setInit { + loader = with haumea; loaders.scoped; + src = self'.outPath + "/examples"; + inputs = { + self' = self; + inherit + omnibus + POP + haumea + flops + lib + dmerge + ; + }; + }; } diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix index 77d1633..56652a7 100644 --- a/templates/nixos/flake.nix +++ b/templates/nixos/flake.nix @@ -47,7 +47,7 @@ in { lib = - (inputs.omnibus.exporters.addLoadExtender { + (inputs.omnibus.pops.exporters.addLoadExtender { src = ./nix/lib; inputs = { self' = self; diff --git a/templates/nixos/nix/lib/exporters.nix b/templates/nixos/nix/lib/exporters.nix index a2602f6..e33e6ed 100644 --- a/templates/nixos/nix/lib/exporters.nix +++ b/templates/nixos/nix/lib/exporters.nix @@ -8,7 +8,7 @@ let in { hosts = - (inputs.omnibus.exporters.addLoadExtender { + (inputs.omnibus.pops.exporters.addLoadExtender { src = self'.outPath + "/nixos/hosts"; inputs = inputs // { self'.lib = super;