mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-25 19:01:43 +01:00
feat: deploy remotely via colmena(instead of nixos-rebuild)
This commit is contained in:
39
lib/colmenaSystem.nix
Normal file
39
lib/colmenaSystem.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
# colemena - Remote Deployment via SSH
|
||||
{
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
specialArgs,
|
||||
nixos-modules,
|
||||
home-module,
|
||||
host_tags,
|
||||
}: let
|
||||
username = specialArgs.username;
|
||||
in
|
||||
{ name, nodes, ... }: {
|
||||
deployment = {
|
||||
targetHost = name; # hostName or IP address
|
||||
targetUser = username;
|
||||
tags = host_tags;
|
||||
};
|
||||
|
||||
imports =
|
||||
nixos-modules
|
||||
++ [
|
||||
{
|
||||
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
# make `nix repl '<nixpkgs>'` use the same nixpkgs as the one used by this flake.
|
||||
environment.etc."nix/inputs/nixpkgs".source = "${nixpkgs}";
|
||||
nix.nixPath = ["/etc/nix/inputs"];
|
||||
}
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
home-manager.extraSpecialArgs = specialArgs;
|
||||
home-manager.users."${username}" = home-module;
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user