deploy
script in shell
This commit is contained in:
parent
3008a49eee
commit
477bef81a5
4 changed files with 34 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
inputs,
|
||||
lib,
|
||||
config,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
options.fleet.overlays = let
|
||||
|
@ -23,12 +24,17 @@
|
|||
statix.overlays.default
|
||||
nil.overlays.default
|
||||
alejandra.overlays.default
|
||||
(final: _: {
|
||||
inherit (disko.packages.${final.system}) disko;
|
||||
inherit (self.packages.${final.system}) deploy;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
config.perSystem = {
|
||||
system,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
_module.args.pkgs =
|
||||
|
@ -36,5 +42,15 @@
|
|||
(legacyPackages: legacyPackages.extend)
|
||||
inputs.nixpkgsUnstable.legacyPackages.${system}
|
||||
config.fleet.overlays;
|
||||
|
||||
packages =
|
||||
lib.mapAttrs'
|
||||
(name: value: {
|
||||
inherit name;
|
||||
value = pkgs.callPackage "${self}/packages/${name}" {};
|
||||
})
|
||||
(lib.filterAttrs
|
||||
(_: type: type == "directory")
|
||||
(builtins.readDir "${self}/packages"));
|
||||
};
|
||||
}
|
||||
|
|
10
packages/deploy/default.nix
Normal file
10
packages/deploy/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
nixos-rebuild,
|
||||
writeShellApplication,
|
||||
...
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "deploy";
|
||||
text = builtins.readFile ./deploy.sh;
|
||||
runtimeInputs = [nixos-rebuild];
|
||||
}
|
6
packages/deploy/deploy.sh
Normal file
6
packages/deploy/deploy.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
host=${1-mothership}
|
||||
|
||||
nixos-rebuild switch \
|
||||
--flake ".#${host}" \
|
||||
--target-host "root@${host}.fleet" \
|
||||
"${@:2}"
|
|
@ -13,6 +13,8 @@
|
|||
deadnix
|
||||
statix
|
||||
alejandra
|
||||
disko
|
||||
deploy
|
||||
];
|
||||
shellHook = ''
|
||||
export RULES="$(git rev-parse --show-toplevel)/secrets/default.nix";
|
||||
|
|
Loading…
Add table
Reference in a new issue