flake.nix: Add deploy-rs for deployment management
This commit is contained in:
parent
1ddf23bd01
commit
325e8a0ea1
2 changed files with 103 additions and 15 deletions
34
flake.nix
34
flake.nix
|
@ -3,6 +3,7 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -17,6 +18,7 @@
|
|||
self,
|
||||
nixpkgs,
|
||||
sops-nix,
|
||||
deploy-rs,
|
||||
tlaternet-webserver,
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
|
@ -56,6 +58,29 @@
|
|||
};
|
||||
};
|
||||
|
||||
############################
|
||||
# Deployment configuration #
|
||||
############################
|
||||
deploy.nodes.tlaternet = {
|
||||
hostname = "tlater.net";
|
||||
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.tlaternet;
|
||||
};
|
||||
|
||||
sshUser = "tlater";
|
||||
sshOpts = ["-t" "-p" "2222"];
|
||||
fastConnection = true;
|
||||
# Currently broken, see https://github.com/serokell/deploy-rs/issues/78
|
||||
magicRollback = false;
|
||||
};
|
||||
|
||||
#########
|
||||
# Tests #
|
||||
#########
|
||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
||||
|
||||
####################
|
||||
# Helper functions #
|
||||
####################
|
||||
|
@ -76,7 +101,7 @@
|
|||
in {
|
||||
type = "app";
|
||||
program = builtins.toString (writeShellScript "run-vm" ''
|
||||
export QEMU_OPTS="-m 3941 -smp 2 -curses"
|
||||
export QEMU_OPTS="-m 3941 -smp 2 -display curses"
|
||||
export QEMU_NET_OPTS="${qemuNetOpts}"
|
||||
"${vm}/bin/run-tlaternet-vm"
|
||||
'');
|
||||
|
@ -95,18 +120,13 @@
|
|||
nativeBuildInputs = [
|
||||
sops-import-keys-hook
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
nixfmt
|
||||
git-lfs
|
||||
sops-init-gpg-key
|
||||
deploy-rs-bin
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# Work around sudo requiring a full terminal when deploying to
|
||||
# a remote host
|
||||
export NIX_SSHOPTS="-t"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue