move stuff to parts dir

This commit is contained in:
uku 2024-01-19 12:24:48 +01:00
parent a7b8dd7141
commit e868b5913f
Signed by: uku
GPG key ID: 7D01D7B105E77166
6 changed files with 10 additions and 5 deletions

45
parts/ci.nix Normal file
View file

@ -0,0 +1,45 @@
{
self,
inputs,
...
}: {
perSystem = {
lib,
pkgs,
system,
...
}: {
packages = let
overlay = lib.fix (final: (import ../exprs/overlay.nix final pkgs));
# do not include a package if it's not available on the system or if it's broken
isValid = _: v:
lib.elem pkgs.system (v.meta.platforms or [pkgs.system]) && !(v.meta.broken or false);
in
lib.filterAttrs isValid overlay;
};
flake.ghaMatrix.include = let
inherit (inputs.nixpkgs) lib;
platforms = {
"x86_64-linux" = {
os = "ubuntu-latest";
};
};
in
lib.pipe platforms [
builtins.attrNames # get systems
(systems: lib.getAttrs systems self.packages) # get packages of each system
(lib.mapAttrs (_: builtins.attrNames)) # keep only the name of each package
# map each package in each system to an attrset
(lib.mapAttrsToList (system:
builtins.map (pkg: {
inherit (platforms.${system}) os;
pkg = "packages.${system}.${pkg}";
})))
lib.flatten
];
}

7
parts/default.nix Normal file
View file

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

37
parts/deploy.nix Normal file
View file

@ -0,0 +1,37 @@
{
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;
};
}

14
parts/dev.nix Normal file
View file

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