1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-24 08:32:54 +03:00

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" "utils": "utils_2"
}, },
"locked": { "locked": {
"narHash": "sha256-jG9Y7IiZkB+xKuqsVr2wr0zfV2TNziIIRmv0MHqzis0=", "narHash": "sha256-/htTDxf3/n8lcL7Gnoi3+uamuY/KnlSMWDQ76dzQpac=",
"path": "./lib", "path": "./lib",
"type": "path" "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; #defaultTemplate = self.templates.flk;
templates.flk.path = ./.; templates.flk.path = ./.;
templates.flk.description = "flk template"; templates.flk.description = "flk template";

View File

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

View File

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

View File

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

View File

@ -1,14 +1,17 @@
{ lib }: { lib }:
{ {
hmDefaults = { suites, modules }: { hmDefaults = { suites, modules }:
home-manager = { { options, ... }: {
useGlobalPkgs = true; config = lib.optionalAttrs (options ? home-manager) {
useUserPackages = true; home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit suites; }; extraSpecialArgs = { inherit suites; };
sharedModules = modules; sharedModules = modules;
};
};
}; };
};
globalDefaults = { self, inputs }: globalDefaults = { self, inputs }:
let let