chore: replace deploy-rs with nixinate

This commit is contained in:
uku 2024-06-23 22:48:22 +02:00
parent d6b34b37e4
commit fca8b6d29c
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
7 changed files with 63 additions and 102 deletions

View file

@ -1,4 +1,12 @@
{ {config, ...}: {
_module.args.nixinate = {
host = config.networking.hostName;
sshUser = "root";
buildOn = "remote";
substituteOnTarget = true;
hermetic = true;
};
services = { services = {
tailscale.extraUpFlags = ["--advertise-exit-node"]; tailscale.extraUpFlags = ["--advertise-exit-node"];

View file

@ -86,30 +86,6 @@
"type": "github" "type": "github"
} }
}, },
"deploy-rs": {
"inputs": {
"flake-compat": [],
"nixpkgs": [
"nixpkgs"
],
"utils": [
"flake-utils"
]
},
"locked": {
"lastModified": 1718194053,
"narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -340,6 +316,26 @@
"type": "github" "type": "github"
} }
}, },
"nixinate": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708891350,
"narHash": "sha256-VOQrKK7Df/IVuNki+NshVuGkTa/Tw0GigPjWcZff6kk=",
"owner": "matthewcroughan",
"repo": "nixinate",
"rev": "452f33c60df5b72ad0858f5f2cf224bdf1f17746",
"type": "github"
},
"original": {
"owner": "matthewcroughan",
"repo": "nixinate",
"type": "github"
}
},
"nixos-wsl": { "nixos-wsl": {
"inputs": { "inputs": {
"flake-compat": [], "flake-compat": [],
@ -417,12 +413,12 @@
"api-rs": "api-rs", "api-rs": "api-rs",
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"crane": "crane", "crane": "crane",
"deploy-rs": "deploy-rs",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"ghostty": "ghostty", "ghostty": "ghostty",
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nixinate": "nixinate",
"nixos-wsl": "nixos-wsl", "nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"systems": "systems_3", "systems": "systems_3",

View file

@ -1,15 +1,37 @@
{ {
description = "example flake idk"; description = "example flake idk";
outputs = {flake-parts, ...} @ inputs: outputs = {
self,
flake-parts,
nixinate,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux"]; systems = ["x86_64-linux"];
imports = [ imports = [
./parts
./systems ./systems
./exprs ./exprs
]; ];
perSystem = {
pkgs,
system,
...
}: {
apps = (nixinate.nixinate.${system} self).nixinate;
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [
just
statix
nix-output-monitor
];
};
formatter = pkgs.alejandra;
};
}; };
inputs = { inputs = {
@ -30,13 +52,6 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
inputs.flake-compat.follows = "";
};
flake-parts = { flake-parts = {
url = "github:hercules-ci/flake-parts"; url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs"; inputs.nixpkgs-lib.follows = "nixpkgs";
@ -64,6 +79,11 @@
inputs.flake-compat.follows = ""; inputs.flake-compat.follows = "";
}; };
nixinate = {
url = "github:matthewcroughan/nixinate";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl = { nixos-wsl = {
url = "github:nix-community/NixOS-WSL"; url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,21 +1,15 @@
# Shamelessly taken from https://github.com/getchoo/flake/blob/d80d49cc7652ea84810c4688212c48277dfc71be/justfile
alias c := check
alias s := switch alias s := switch
alias d := deploy alias d := deploy
default:
@just --choose
check: check:
nix flake check nix flake check
[linux]
switch *args: switch *args:
sudo nixos-rebuild switch --flake . --keep-going {{ args }} @sudo -v
sudo nixos-rebuild switch --flake . --keep-going {{args}} --log-format internal-json |& nom --json
deploy system: deploy system:
deploy -s .#{{ system }} nix run .#{{system}}
lint *args: lint *args:
statix check -i flake.nix **/hardware-configuration.nix {{args}} statix check -i flake.nix **/hardware-configuration.nix {{args}}

View file

@ -1,6 +0,0 @@
{
imports = [
./deploy.nix
./dev.nix
];
}

View file

@ -1,37 +0,0 @@
{
lib,
self,
inputs,
...
}: let
systems = ["etna"];
getDeploy = pkgs:
(pkgs.appendOverlays [
inputs.deploy-rs.overlay
(_: prev: {
deploy-rs = {
inherit (pkgs) deploy-rs;
inherit (prev.deploy-rs) lib;
};
})
])
.deploy-rs;
toDeployNode = hostname: system: {
inherit hostname;
sshUser = "root";
profiles.system.path = let deploy = getDeploy system.pkgs; in deploy.lib.activate.nixos system;
};
in {
flake = {
deploy = {
remoteBuild = true;
fastConnection = false;
nodes = lib.mapAttrs toDeployNode (lib.getAttrs systems self.nixosConfigurations);
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
};
}

View file

@ -1,14 +0,0 @@
{
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [
just
nil
statix
deploy-rs
];
};
formatter = pkgs.alejandra;
};
}