summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-29 07:03:10 -0500
committerseth <[email protected]>2023-12-29 07:10:37 -0500
commit550b9057a215eb46943fcae51b27632639ae46d5 (patch)
treefe72c2ae5dbeb65f85308035546a2130d68c0698
parent3eb380133c19b3a50213d6ec416a1fa9c3eab52a (diff)
Revert "systems: nixinate works again"
This reverts commit 874a58f74dea0ee6aa775f43f688e8397bc8cfb5.
-rw-r--r--README.md2
-rw-r--r--flake.lock50
-rw-r--r--flake.nix14
-rw-r--r--justfile12
-rw-r--r--systems/atlas/default.nix8
-rw-r--r--systems/default.nix6
-rw-r--r--systems/deploy.nix44
7 files changed, 94 insertions, 42 deletions
diff --git a/README.md b/README.md
index d3e30f4..eb46f88 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ there are some amazing tools i use to make/manage this flake that i would highly
- [home-manager](https://github.com/nix-community/home-manager)
- [agenix](https://github.com/ryantm/agenix)
- [cachix](https://cachix.org)
-- [nixinate](https://github.com/MatthewCroughan/nixinate)
+- [deploy-rs](https://github.com/serokell/deploy-rs)
- [flake-parts](https://github.com/hercules-ci/flake-parts)
- [terranix](https://github.com/terranix/terranix)
- [lanzaboote](https://github.com/nix-community/lanzaboote)
diff --git a/flake.lock b/flake.lock
index 92fcbec..7e0e24f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -113,6 +113,34 @@
"type": "github"
}
},
+ "deploy": {
+ "inputs": {
+ "flake-compat": [
+ "pre-commit",
+ "flake-compat"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "utils": [
+ "pre-commit",
+ "flake-utils"
+ ]
+ },
+ "locked": {
+ "lastModified": 1703087360,
+ "narHash": "sha256-0VUbWBW8VyiDRuimMuLsEO4elGuUw/nc2WDeuO1eN1M=",
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "rev": "b709d63debafce9f5645a5ba550c9e0983b3d1f7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "type": "github"
+ }
+ },
"fenix": {
"inputs": {
"nixpkgs": [
@@ -354,26 +382,6 @@
"type": "github"
}
},
- "nixinate": {
- "inputs": {
- "nixpkgs": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1688141737,
- "narHash": "sha256-qHrNMYWukOKmKVf6wXOGKj1xxUnOGjvTRbt/PLLXuBE=",
- "owner": "MatthewCroughan",
- "repo": "nixinate",
- "rev": "7902ae845e6cc5bd450e510cdf5e009a6e4a44d9",
- "type": "github"
- },
- "original": {
- "owner": "MatthewCroughan",
- "repo": "nixinate",
- "type": "github"
- }
- },
"nixos-hardware": {
"locked": {
"lastModified": 1702453208,
@@ -561,12 +569,12 @@
"arkenfox": "arkenfox",
"catppuccin": "catppuccin",
"darwin": "darwin",
+ "deploy": "deploy",
"firefox-addons": "firefox-addons",
"getchvim": "getchvim",
"hm": "hm",
"lanzaboote": "lanzaboote",
"nix-index-database": "nix-index-database",
- "nixinate": "nixinate",
"nixos-hardware": "nixos-hardware",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs",
diff --git a/flake.nix b/flake.nix
index 866e3ce..6086bec 100644
--- a/flake.nix
+++ b/flake.nix
@@ -40,6 +40,15 @@
catppuccin.url = "github:Stonks3141/ctp-nix";
+ deploy = {
+ url = "github:serokell/deploy-rs";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ flake-compat.follows = "pre-commit/flake-compat";
+ utils.follows = "pre-commit/flake-utils";
+ };
+ };
+
firefox-addons = {
url = "sourcehut:~rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs = {
@@ -72,11 +81,6 @@
};
};
- nixinate = {
- url = "github:MatthewCroughan/nixinate";
- inputs.nixpkgs.follows = "nixpkgs";
- };
-
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
diff --git a/justfile b/justfile
index 09af5d4..0ac8be8 100644
--- a/justfile
+++ b/justfile
@@ -59,10 +59,16 @@ update-input input:
--commit-lock-file \
--commit-lockfile-summary "flake: update {{ input }}"
+deploy system:
+ nix run \
+ --inputs-from . \
+ 'nixpkgs#deploy-rs' -- \
+ -s '.#{{ system }}'
+
deploy-all:
- for system in "atlas"; do \
- nix run ".#$system"; \
- done
+ nix run \
+ --inputs-from . \
+ 'nixpkgs#deploy-rs' -- -s
pre-commit:
pre-commit run
diff --git a/systems/atlas/default.nix b/systems/atlas/default.nix
index 9e8f926..836aef7 100644
--- a/systems/atlas/default.nix
+++ b/systems/atlas/default.nix
@@ -10,14 +10,6 @@
./teawiebot.nix
];
- _module.args.nixinate = {
- host = config.networking.hostName;
- sshUser = "root";
- buildOn = "remote";
- substituteOnTarget = true;
- hermetic = false;
- };
-
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
diff --git a/systems/default.nix b/systems/default.nix
index bdfaee0..47f6bf6 100644
--- a/systems/default.nix
+++ b/systems/default.nix
@@ -28,6 +28,8 @@
mapNixOS = mapSystems inputs.nixpkgs.lib.nixosSystem;
inherit (import ./common.nix {inherit inputs self;}) darwin nixos server;
in {
+ imports = [./deploy.nix];
+
flake = {
darwinConfigurations = mapDarwin {
caroline = {
@@ -76,8 +78,4 @@ in {
inherit (inputs) openwrt-imagebuilder;
});
};
-
- perSystem = {system, ...}: {
- apps = (inputs.nixinate.nixinate.${system} self).nixinate;
- };
}
diff --git a/systems/deploy.nix b/systems/deploy.nix
new file mode 100644
index 0000000..fbf20d3
--- /dev/null
+++ b/systems/deploy.nix
@@ -0,0 +1,44 @@
+{
+ lib,
+ inputs,
+ self,
+ ...
+}: let
+ targets = ["atlas"];
+ configurations = self.nixosConfigurations // self.darwinConfigurations;
+
+ getDeploy = pkgs:
+ (pkgs.appendOverlays [
+ inputs.deploy.overlay
+ (_: prev: {
+ deploy-rs = {
+ inherit (pkgs) deploy-rs;
+ inherit (prev.deploy-rs) lib;
+ };
+ })
+ ])
+ .deploy-rs;
+
+ toType = system:
+ {
+ "Linux" = "nixos";
+ "Darwin" = "darwin";
+ }
+ .${system};
+
+ toDeployNode = hostname: system: {
+ sshUser = "root";
+ inherit hostname;
+ profiles.system.path = let
+ deploy = getDeploy system.pkgs;
+ type = toType system.pkgs.stdenv.hostPlatform.uname.system;
+ in
+ deploy.lib.activate.${type} system;
+ };
+in {
+ flake.deploy = {
+ remoteBuild = true;
+ fastConnection = false;
+ nodes = lib.mapAttrs toDeployNode (lib.getAttrs targets configurations);
+ };
+}