Add formatter

This commit is contained in:
Nicolas Jeannerod 2024-11-08 16:15:39 +01:00
parent aef97d36ad
commit 69336c2624
Signed by: Niols
GPG key ID: 35DB9EC8886E1CB8
2 changed files with 100 additions and 52 deletions

View file

@ -10,27 +10,59 @@
nixops4-nixos.url = "github:nixops4/nixops4/eval"; nixops4-nixos.url = "github:nixops4/nixops4/eval";
}; };
outputs = inputs@{ self, flake-parts, nixpkgs, snf, ... }: outputs =
inputs@{
self,
flake-parts,
nixpkgs,
snf,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ imports = [ inputs.nixops4-nixos.modules.flake.default ];
inputs.nixops4-nixos.modules.flake.default
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
]; ];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
formatter = pkgs.nixfmt-rfc-style;
perSystem = { config, self', inputs', pkgs, system, ... }: { devShells.default = pkgs.mkShell { packages = [ inputs'.nixops4.packages.default ]; };
devShells.default = pkgs.mkShell {
packages = [ inputs'.nixops4.packages.default ];
};
}; };
flake.allVmIds = ["101" "102" "103" "104" "105" "106" "107" "108" "109" "110"]; flake.allVmIds = [
"101"
"102"
"103"
"104"
"105"
"106"
"107"
"108"
"109"
"110"
];
flake.nixosConfigurations.provisioning = flake.nixosConfigurations.provisioning =
let let
inherit (builtins) map listToAttrs; inherit (builtins) map listToAttrs;
makeProvisioningConfiguration = vmid: nixpkgs.lib.nixosSystem { makeProvisioningConfiguration =
vmid:
nixpkgs.lib.nixosSystem {
modules = [ modules = [
{ procolix.vmid = vmid; } { procolix.vmid = vmid; }
./procolixVm.nix ./procolixVm.nix
@ -38,33 +70,34 @@
]; ];
}; };
in in
listToAttrs listToAttrs (
(map map (vmid: {
(vmid: {
name = "fedi${vmid}"; name = "fedi${vmid}";
value = makeProvisioningConfiguration vmid; }) value = makeProvisioningConfiguration vmid;
self.allVmIds); }) self.allVmIds
);
flake.isoInstallers.provisioning = flake.isoInstallers.provisioning =
let inherit (builtins) mapAttrs; in let
mapAttrs inherit (builtins) mapAttrs;
(_: snf.mkInstaller nixpkgs) in
self.nixosConfigurations.provisioning; mapAttrs (_: snf.mkInstaller nixpkgs) self.nixosConfigurations.provisioning;
nixops4Deployments.default = { providers, ... }: nixops4Deployments.default =
{ providers, ... }:
let let
makeProcolixVmResource = vmid: vmconfig: { makeProcolixVmResource = vmid: vmconfig: {
type = providers.local.exec; type = providers.local.exec;
imports = [ imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ];
inputs.nixops4-nixos.modules.nixops4Resource.nixos
];
ssh.opts = ""; ssh.opts = "";
ssh.host = "95.215.187.${vmid}"; ssh.host = "95.215.187.${vmid}";
ssh.hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOW+f+PUuOBVP4IongWpryzYiOwt19smufZksSwnSPyo"; ssh.hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOW+f+PUuOBVP4IongWpryzYiOwt19smufZksSwnSPyo";
nixpkgs = inputs.nixpkgs; nixpkgs = inputs.nixpkgs;
nixos.module = { pkgs, modulesPath, ... }: { nixos.module =
{ pkgs, modulesPath, ... }:
{
imports = [ imports = [
vmconfig vmconfig
{ procolix.vmid = vmid; } { procolix.vmid = vmid; }

View file

@ -1,4 +1,9 @@
{ lib, config, modulesPath, ... }: {
lib,
config,
modulesPath,
...
}:
let let
inherit (lib) mkOption; inherit (lib) mkOption;
@ -6,7 +11,7 @@ let
in in
{ {
imports = [ (modulesPath + "/profiles/qemu-guest.nix")]; imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
options = { options = {
procolix = { procolix = {
@ -60,7 +65,10 @@ in
interface = "eth0"; interface = "eth0";
}; };
nameservers = [ "95.215.185.6" "95.215.185.7" ]; nameservers = [
"95.215.185.6"
"95.215.185.7"
];
}; };
######################################################################## ########################################################################
@ -72,7 +80,14 @@ in
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
initrd = { initrd = {
availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
kernelModules = [ "dm-snapshot" ]; kernelModules = [ "dm-snapshot" ];
}; };
}; };