From b2bb30a24dde9762ae95f4df157a385064772067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Thu, 5 May 2022 21:24:46 +0200 Subject: [PATCH] feat: set up deploy-rs --- flake.lock | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 27 ++++++++++++++++++++++--- system/nix.nix | 2 ++ 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 9e77c19..2dba5e2 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,44 @@ "type": "github" } }, + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1648475189, + "narHash": "sha256-gAGAS6IagwoUr1B0ohE3iR6sZ8hP4LSqzYLC8Mq3WGU=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "83e0c78291cd08cb827ba0d553ad9158ae5a95c3", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1649676176, @@ -162,6 +200,7 @@ "root": { "inputs": { "agenix": "agenix", + "deploy-rs": "deploy-rs", "flake-utils": "flake-utils", "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", @@ -171,6 +210,21 @@ "nvim-kitty-navigator": "nvim-kitty-navigator", "pre-commit-hooks": "pre-commit-hooks" } + }, + "utils": { + "locked": { + "lastModified": 1648297722, + "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 50062d7..eae1309 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + inputs.deploy-rs = { + url = "github:serokell/deploy-rs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + inputs.pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -31,7 +36,8 @@ }; outputs = { self, nixpkgs, nixos-hardware, flake-utils, home-manager, nur - , agenix, pre-commit-hooks, nvim-kitty-navigator, nixpkgs-glslls }@inputs: + , agenix, deploy-rs, pre-commit-hooks, nvim-kitty-navigator, nixpkgs-glslls + }@inputs: let overlays = { neovim = self: super: @@ -112,8 +118,10 @@ samba.file = ./secrets/samba.age; smtp.file = ./secrets/smtp.age; }; - environment.systemPackages = with pkgs; - [ agenix.defaultPackage.x86_64-linux ]; + environment.systemPackages = with pkgs; [ + agenix.defaultPackage.x86_64-linux + deploy-rs.defaultPackage.x86_64-linux + ]; }) ]; }; @@ -179,6 +187,19 @@ ]; }; + deploy.nodes.felix-rpi4 = { + hostname = "192.168.1.234"; + profiles.system = { + user = "felschr"; + path = deploy-rs.lib.aarch64-linux.activate.nixos + self.nixosConfigurations.felix-rpi4; + }; + }; + + # TODO `nix flake check` fails atm which causes this to fail, too + checks = builtins.mapAttrs + (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; + } // flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; diff --git a/system/nix.nix b/system/nix.nix index b59e61f..be93b9f 100644 --- a/system/nix.nix +++ b/system/nix.nix @@ -7,6 +7,8 @@ options = "--delete-older-than 30d"; }; + nix.trustedUsers = [ "@wheel" ]; + nix.settings = { auto-optimise-store = true; substituters = [ "https://hydra.iohk.io" "https://shajra.cachix.org" ];