Ajout de la configuration pour les autoupdate

comin
Lyes Saadi 2026-11-21 16:18:55 +01:00
parent 5fca38d8d5
commit 2497cf0466
No known key found for this signature in database
GPG Key ID: 55A1D803917CF39A
4 changed files with 167 additions and 8 deletions

View File

@ -20,6 +20,44 @@
"type": "github" "type": "github"
} }
}, },
"comin": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1795253528,
"narHash": "sha256-TvzBvAV7KVWsvTCQjRg1oY/lhDbuN9YXLDctGGhXPdU=",
"owner": "nlewo",
"repo": "comin",
"rev": "4cc0f6a9764a0ac73ec248d1475a1372c19b4773",
"type": "github"
},
"original": {
"owner": "nlewo",
"repo": "comin",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1765121682,
"narHash": "sha256-4VBOP18BFeiPkyhy9o4ssBNQEvfvv1kXkasAYd0+rrA=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -40,16 +78,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1793294725, "lastModified": 1770107345,
"narHash": "sha256-loLMnbbS4KhmG2ln9EY6f0YMNCA273Yx02oWYQ9IMeE=", "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6f06d204d8f2d8761d9da78778745974a3216381", "rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixos-26.05", "ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -69,15 +107,50 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1793294725,
"narHash": "sha256-loLMnbbS4KhmG2ln9EY6f0YMNCA273Yx02oWYQ9IMeE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6f06d204d8f2d8761d9da78778745974a3216381",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"comin": "comin",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix_2"
} }
}, },
"treefmt-nix": { "treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1770228511,
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"

View File

@ -16,6 +16,12 @@
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Auto updates
comin = {
url = "github:nlewo/comin";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -24,6 +30,7 @@
nixpkgs, nixpkgs,
flake-parts, flake-parts,
agenix, agenix,
comin,
... ...
}: }:
let let
@ -46,6 +53,7 @@
baseModules = [ baseModules = [
./modules ./modules
agenix.nixosModules.default agenix.nixosModules.default
comin.nixosModules.default
]; ];
in in
(attrsToNixosSystem ./hosts/vm attrs_all_info attrs_vm_info baseModules) (attrsToNixosSystem ./hosts/vm attrs_all_info attrs_vm_info baseModules)

View File

@ -0,0 +1,77 @@
{ lib, info, ... }:
let
inherit (lib) mkIf;
cfg = info.autoUpdate;
in
{
# Options ../info/autoupdate.nix
config = mkIf cfg.enable {
services.comin = {
enable = true;
buildAttemptsLimit = 3;
buildRetryTimer = 5 * 60;
remotes = [
# TODO : à split en deux remotes, l'une pour main, l'autre pour testing
{
name = "origin";
url = "https://gitlab.adm.crans.org/nounous/nixos.git";
poller.period = cfg.period;
branches = {
main =
let
branch =
if cfg.main.enable then
{
branch = "name";
# period = cfg.main.period;
}
else
cfg.testing;
in
{
inherit (cfg) operation;
name = branch.branch;
};
testing = {
inherit (cfg) operation;
name = cfg.testing.branch;
};
};
}
];
exporter = mkIf info.monitoring.comin.enable {
listen_address = info.networking.adm.ipv4.address;
port = 4267;
};
};
nix = mkIf (info.name != "cephiroth") {
distributedBuilds = true;
settings = {
max-jobs = 0;
builders-use-substitutes = true;
};
buildMachines = [
{
hostName = "cephiroth.adm.crans.org";
sshUser = "builder";
sshKey = "/etc/ssh/ssh_host_ed25519_key";
system = "x86_64-linux";
maxJobs = 8;
supportedFeatures = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
];
}
];
};
# TODO : Autoreboot
};
}

View File

@ -13,6 +13,7 @@ in
{ {
imports = [ imports = [
./age.nix ./age.nix
./autoupdate.nix
./grub.nix ./grub.nix
./home.nix ./home.nix
./locale.nix ./locale.nix