From 2e7d3954e0c95c9f611063404fa7a921fb85ee30 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 12 May 2023 17:39:09 +0200 Subject: [PATCH] Setup deploy-ts --- .github/workflows/build.yml | 2 ++ flake.lock | 60 ++++++++++++++++++++++++++++++++-- flake.nix | 31 +++++++++--------- home/hosts/Styx.nix | 1 + home/programs/nvim/plugins.nix | 6 ++-- system/flakes/Styx.nix | 2 ++ system/flakes/adsb-antenna.nix | 2 ++ system/flakes/attic.nix | 16 +++++++-- system/flakes/mediaserver.nix | 16 +++++++-- system/flakes/sail.nix | 16 +++++++-- 10 files changed, 125 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f060d1..be6f508 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix build '.#nixosConfigurations.attic.pkgs.attic-server' - run: nix build '.#nixosConfigurations.attic.pkgs.attic-client' + - run: nix build '.#nixosConfigurations.attic.pkgs.deploy-rs' build-arm64-linux: runs-on: buildjet-2vcpu-ubuntu-2204-arm @@ -33,3 +34,4 @@ jobs: name: nifoc authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix build '.#nixosConfigurations.adsb-antenna.pkgs.attic-client' + - run: nix build '.#nixosConfigurations.adsb-antenna.pkgs.deploy-rs' diff --git a/flake.lock b/flake.lock index 73c49bd..2a420b2 100644 --- a/flake.lock +++ b/flake.lock @@ -98,6 +98,28 @@ "type": "github" } }, + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1683779844, + "narHash": "sha256-sIeOU0GsCeQEn5TpqE/jFRN4EGsPsjqVRsPdrzIDABM=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "c80189917086e43d49eece2bd86f56813500a0eb", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -114,6 +136,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -190,11 +228,11 @@ ] }, "locked": { - "lastModified": 1683833146, - "narHash": "sha256-ELF0oXgg0NYGyKtU74HW8CeLstFJwwCGbuahnQla67I=", + "lastModified": 1683892466, + "narHash": "sha256-/zN3pQ4xoyolJoxrtn9oLU4JMjG5+c5K7BeLxZ7BR8o=", "owner": "nix-community", "repo": "home-manager", - "rev": "cc9f65d104e5227d103a529a9fc3687ef4ccb117", + "rev": "70c8bd08e6c186e5c628a4e5af6f7ad67cd344b8", "type": "github" }, "original": { @@ -304,6 +342,7 @@ "agenix": "agenix", "attic": "attic", "darwin": "darwin", + "deploy-rs": "deploy-rs", "home-manager": "home-manager_2", "nifoc-overlay": "nifoc-overlay", "nixpkgs": "nixpkgs" @@ -335,6 +374,21 @@ "repo": "rust-overlay", "type": "github" } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 2fc0737..9900b8d 100644 --- a/flake.nix +++ b/flake.nix @@ -27,42 +27,37 @@ url = "github:nifoc/nix-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; + + deploy-rs = { + url = "github:serokell/deploy-rs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self, ... }: let Styx = import ./system/flakes/Styx.nix { - inherit (inputs) nixpkgs; - inherit (inputs) home-manager; - inherit (inputs) darwin; + inherit (inputs) nixpkgs home-manager darwin; inherit inputs; }; sail = import ./system/flakes/sail.nix { - inherit (inputs) nixpkgs; - inherit (inputs) home-manager; - inherit (inputs) agenix; + inherit (inputs) nixpkgs deploy-rs home-manager agenix; inherit inputs; }; attic = import ./system/flakes/attic.nix { - inherit (inputs) nixpkgs; - inherit (inputs) home-manager; - inherit (inputs) agenix; - inherit (inputs) attic; + inherit (inputs) nixpkgs deploy-rs home-manager agenix attic; inherit inputs; }; mediaserver = import ./system/flakes/mediaserver.nix { - inherit (inputs) nixpkgs; - inherit (inputs) home-manager; - inherit (inputs) agenix; + inherit (inputs) nixpkgs deploy-rs home-manager agenix; inherit inputs; }; adsb-antenna = import ./system/flakes/adsb-antenna.nix { - inherit (inputs) nixpkgs; - inherit (inputs) home-manager; + inherit (inputs) nixpkgs home-manager; inherit inputs; }; in @@ -77,5 +72,11 @@ mediaserver = mediaserver.system; adsb-antenna = adsb-antenna.system; }; + + deploy.nodes = { + sail = sail.deployment; + attic = attic.deployment; + mediaserver = mediaserver.deployment; + }; }; } diff --git a/home/hosts/Styx.nix b/home/hosts/Styx.nix index f6968a7..763c643 100644 --- a/home/hosts/Styx.nix +++ b/home/hosts/Styx.nix @@ -48,6 +48,7 @@ args@{ pkgs, config, lib, ... }: awscli2 curlHTTP3 dasel + deploy-rs exa exiftool fd diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index 257f37a..a00c351 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -418,12 +418,12 @@ in }; neoformat = buildVimPluginFrom2Nix { pname = "neoformat"; - version = "2023-04-14"; + version = "2023-05-12"; src = fetchFromGitHub { owner = "sbdchd"; repo = "neoformat"; - rev = "aca320ad601338c93eca50ab4c86fca964a18d96"; - sha256 = "17wcvqwddw4nlcpfvlaxxkcyl93axb1hqdcn73xb4c1yr8fdwaxi"; + rev = "2d5d071d5957681ae677ee06f6eb879a61b7b618"; + sha256 = "17rs8k6xzy4c8nkiap84h5n7m0wcam06r6mv2z207di0cck2f4pk"; fetchSubmodules = false; }; }; diff --git a/system/flakes/Styx.nix b/system/flakes/Styx.nix index f19bdf8..d1ddb5f 100644 --- a/system/flakes/Styx.nix +++ b/system/flakes/Styx.nix @@ -6,6 +6,7 @@ let overlay-x86 = _: _: { pkgs-x86 = import nixpkgs { system = "x86_64-darwin"; }; }; overlay-agenix = inputs.agenix.overlays.default; overlay-attic = inputs.attic.overlays.default; + overlay-deploy-rs = _: _: { inherit (inputs.deploy-rs.packages.${default-system}) deploy-rs; }; overlay-nifoc = inputs.nifoc-overlay.overlay; nixpkgsConfig = { @@ -13,6 +14,7 @@ let overlay-x86 overlay-agenix overlay-attic + overlay-deploy-rs overlay-nifoc ]; diff --git a/system/flakes/adsb-antenna.nix b/system/flakes/adsb-antenna.nix index d6f548a..dbaf4db 100644 --- a/system/flakes/adsb-antenna.nix +++ b/system/flakes/adsb-antenna.nix @@ -4,11 +4,13 @@ let default-system = "aarch64-linux"; overlay-attic = inputs.attic.overlays.default; + overlay-deploy-rs = _: _: { inherit (inputs.deploy-rs.packages.${default-system}) deploy-rs; }; overlay-nifoc = inputs.nifoc-overlay.overlay; nixpkgsConfig = { overlays = [ overlay-attic + overlay-deploy-rs overlay-nifoc ]; diff --git a/system/flakes/attic.nix b/system/flakes/attic.nix index e18750e..c07ce68 100644 --- a/system/flakes/attic.nix +++ b/system/flakes/attic.nix @@ -1,12 +1,14 @@ -{ nixpkgs, home-manager, agenix, attic, inputs, ... }: +{ nixpkgs, deploy-rs, home-manager, agenix, attic, inputs, ... }: let default-system = "x86_64-linux"; + overlay-deploy-rs = _: _: { inherit (deploy-rs.packages.${default-system}) deploy-rs; }; overlay-nifoc = inputs.nifoc-overlay.overlay; nixpkgsConfig = { overlays = [ + overlay-deploy-rs overlay-nifoc ]; @@ -16,7 +18,7 @@ let }; }; in -{ +rec { system = nixpkgs.lib.nixosSystem { system = default-system; modules = [ @@ -38,4 +40,14 @@ in } ]; }; + + deployment = { + hostname = "builder-attic"; + sshUser = "root"; + remoteBuild = true; + + profiles.system = { + path = deploy-rs.lib.${default-system}.activate.nixos system; + }; + }; } diff --git a/system/flakes/mediaserver.nix b/system/flakes/mediaserver.nix index 6ce14b0..55f75ea 100644 --- a/system/flakes/mediaserver.nix +++ b/system/flakes/mediaserver.nix @@ -1,14 +1,16 @@ -{ nixpkgs, home-manager, agenix, inputs, ... }: +{ nixpkgs, deploy-rs, home-manager, agenix, inputs, ... }: let default-system = "x86_64-linux"; overlay-attic = inputs.attic.overlays.default; + overlay-deploy-rs = _: _: { inherit (deploy-rs.packages.${default-system}) deploy-rs; }; overlay-nifoc = inputs.nifoc-overlay.overlay; nixpkgsConfig = { overlays = [ overlay-attic + overlay-deploy-rs overlay-nifoc ]; @@ -18,7 +20,7 @@ let }; }; in -{ +rec { system = nixpkgs.lib.nixosSystem { system = default-system; modules = [ @@ -38,4 +40,14 @@ in } ]; }; + + deployment = { + hostname = "builder-mediaserver"; + sshUser = "root"; + remoteBuild = true; + + profiles.system = { + path = deploy-rs.lib.${default-system}.activate.nixos system; + }; + }; } diff --git a/system/flakes/sail.nix b/system/flakes/sail.nix index 17e0685..8b78f5e 100644 --- a/system/flakes/sail.nix +++ b/system/flakes/sail.nix @@ -1,14 +1,16 @@ -{ nixpkgs, home-manager, agenix, inputs, ... }: +{ nixpkgs, deploy-rs, home-manager, agenix, inputs, ... }: let default-system = "x86_64-linux"; overlay-attic = inputs.attic.overlays.default; + overlay-deploy-rs = _: _: { inherit (deploy-rs.packages.${default-system}) deploy-rs; }; overlay-nifoc = inputs.nifoc-overlay.overlay; nixpkgsConfig = { overlays = [ overlay-attic + overlay-deploy-rs overlay-nifoc ]; @@ -18,7 +20,7 @@ let }; }; in -{ +rec { system = nixpkgs.lib.nixosSystem { system = default-system; modules = [ @@ -38,4 +40,14 @@ in } ]; }; + + deployment = { + hostname = "builder-sail"; + sshUser = "root"; + remoteBuild = true; + + profiles.system = { + path = deploy-rs.lib.${default-system}.activate.nixos system; + }; + }; }