Modularise deploy-rs and add home-manager configs
This commit is contained in:
@@ -2,5 +2,6 @@
|
||||
home-manager.modules = {
|
||||
common = ./common.nix;
|
||||
gui = ./gui.nix;
|
||||
deploy-rs = ./deploy-rs.nix;
|
||||
};
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{ lib, pkgs, pkgs', inputs, options, config, ... }@args:
|
||||
{ lib, pkgs, pkgs', inputs, config, ... }@args:
|
||||
let
|
||||
inherit (builtins) mapAttrs readFile;
|
||||
inherit (lib) concatMapStrings concatStringsSep optionalAttrs versionAtLeast mkMerge mkIf mkDefault mkOption;
|
||||
@@ -153,6 +153,7 @@ in
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
file
|
||||
tree
|
||||
iperf3
|
||||
];
|
||||
@@ -170,7 +171,9 @@ in
|
||||
(mkIf (config.my.isStandalone || !args.osConfig.home-manager.useGlobalPkgs) {
|
||||
# Note: If globalPkgs mode is on, then these will be overridden by the NixOS equivalents of these options
|
||||
nixpkgs = {
|
||||
overlays = [ ];
|
||||
overlays = [
|
||||
inputs.deploy-rs.overlay
|
||||
];
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
|
38
home-manager/modules/deploy-rs.nix
Normal file
38
home-manager/modules/deploy-rs.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
inherit (builtins) head;
|
||||
inherit (lib) mkMerge mkIf mkDefault;
|
||||
inherit (lib.my) mkBoolOpt';
|
||||
|
||||
cfg = config.my.deploy;
|
||||
in
|
||||
{
|
||||
options.my.deploy = with lib.types; {
|
||||
enable = mkBoolOpt' true "Whether to expose deploy-rs configuration for this home configuration.";
|
||||
inherit (lib.my.deploy-rs) node;
|
||||
|
||||
generate = {
|
||||
home.enable = mkBoolOpt' true "Whether to generate a deploy-rs profile for this home config.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
my.deploy.enable = mkIf (!config.my.isStandalone) false;
|
||||
}
|
||||
(mkIf cfg.enable {
|
||||
my.deploy.node = {
|
||||
profiles = {
|
||||
home = mkIf cfg.generate.home.enable {
|
||||
path = pkgs.deploy-rs.lib.activate.home-manager { inherit (config.home) activationPackage; };
|
||||
profilePath = "/nix/var/nix/profiles/per-user/${config.home.username}/profile";
|
||||
};
|
||||
};
|
||||
|
||||
sshUser = mkDefault config.home.username;
|
||||
user = config.home.username;
|
||||
sudo = mkDefault "sudo -u";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user