improve home-manager and deploy-rs integration

move both to be setup in template
only set home-manager options if they exist
This commit is contained in:
Pacman99 2021-05-02 10:35:29 -07:00 committed by David Arnold
parent 7bf605d08c
commit b8f7cdbe63
6 changed files with 36 additions and 27 deletions

View File

@ -79,7 +79,7 @@
"utils": "utils_2"
},
"locked": {
"narHash": "sha256-jG9Y7IiZkB+xKuqsVr2wr0zfV2TNziIIRmv0MHqzis0=",
"narHash": "sha256-/htTDxf3/n8lcL7Gnoi3+uamuY/KnlSMWDQ76dzQpac=",
"path": "./lib",
"type": "path"
},

View File

@ -79,6 +79,10 @@
};
};
homeConfigurations = devos.lib.mkHomeConfigurations self.nixosConfigurations;
deploy.nodes = devos.lib.mkDeployNodes self.nixosConfigurations { };
#defaultTemplate = self.templates.flk;
templates.flk.path = ./.;
templates.flk.description = "flk template";

View File

@ -19,18 +19,19 @@
strings = import ./strings.nix { lib = combinedLib; };
modules = import ./modules.nix { lib = combinedLib; };
importers = import ./importers.nix { lib = combinedLib; };
generators = import ./generators.nix { lib = combinedLib; };
mkFlake = {
__functor = import ./mkFlake {
generators = import ./generators.nix {
lib = combinedLib;
inherit deploy;
};
mkFlake = {
__functor = import ./mkFlake { lib = combinedLib; };
evalArgs = import ./mkFlake/evalArgs.nix { lib = combinedLib; };
};
pkgs-lib = import ./pkgs-lib {
lib = nixpkgs.lib // self;
lib = combinedLib;
inherit deploy devshell;
};

View File

@ -1,4 +1,4 @@
{ lib }:
{ lib, deploy }:
{
mkHomeConfigurations = nixosConfigurations:
with lib;
@ -12,7 +12,7 @@
in
foldl recursiveUpdate { } (attrValues hmConfigs);
mkDeployNodes =
mkDeployNodes = hosts: extraConfig:
/**
Synopsis: mkNodes _nixosConfigurations_
@ -20,14 +20,18 @@
where _nixosConfigurations_ are `nodes`.
**/
deploy: lib.mapAttrs (_: config: {
lib.mapAttrs
(_: config: lib.recursiveUpdate
{
hostname = config.config.networking.hostName;
profiles.system = {
user = "root";
path = deploy.lib.x86_64-linux.activate.nixos config;
};
});
}
extraConfig)
hosts;
mkSuites = { suites, profiles }:
let

View File

@ -1,4 +1,4 @@
{ lib, deploy }:
{ lib }:
let
inherit (builtins) mapAttrs attrNames attrValues head isFunction;
in
@ -71,9 +71,6 @@ lib.systemFlake (lib.mergeAny
nixosModules = lib.exporter.modulesFromList cfg.nixos.hostDefaults.modules;
homeModules = lib.exporter.modulesFromList cfg.home.modules;
homeConfigurations = lib.mkHomeConfigurations self.nixosConfigurations;
deploy.nodes = lib.mkDeployNodes deploy self.nixosConfigurations;
overlays = lib.exporter.overlaysFromChannelsExporter {
# since we can't detect overlays owned by self

View File

@ -1,6 +1,8 @@
{ lib }:
{
hmDefaults = { suites, modules }: {
hmDefaults = { suites, modules }:
{ options, ... }: {
config = lib.optionalAttrs (options ? home-manager) {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
@ -9,6 +11,7 @@
sharedModules = modules;
};
};
};
globalDefaults = { self, inputs }:
let