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

129
flake.nix
View file

@ -10,84 +10,117 @@
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; } {
imports = [
inputs.nixops4-nixos.modules.flake.default
imports = [ 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 =
let
inherit (builtins) map listToAttrs;
makeProvisioningConfiguration = vmid: nixpkgs.lib.nixosSystem {
modules = [
{ procolix.vmid = vmid; }
./procolixVm.nix
inputs.disko.nixosModules.default
];
};
makeProvisioningConfiguration =
vmid:
nixpkgs.lib.nixosSystem {
modules = [
{ procolix.vmid = vmid; }
./procolixVm.nix
inputs.disko.nixosModules.default
];
};
in
listToAttrs
(map
(vmid: {
name = "fedi${vmid}";
value = makeProvisioningConfiguration vmid; })
self.allVmIds);
listToAttrs (
map (vmid: {
name = "fedi${vmid}";
value = makeProvisioningConfiguration vmid;
}) self.allVmIds
);
flake.isoInstallers.provisioning =
let inherit (builtins) mapAttrs; in
mapAttrs
(_: snf.mkInstaller nixpkgs)
self.nixosConfigurations.provisioning;
let
inherit (builtins) mapAttrs;
in
mapAttrs (_: snf.mkInstaller nixpkgs) self.nixosConfigurations.provisioning;
nixops4Deployments.default = { providers, ... }:
nixops4Deployments.default =
{ providers, ... }:
let
makeProcolixVmResource = vmid: vmconfig: {
type = providers.local.exec;
imports = [
inputs.nixops4-nixos.modules.nixops4Resource.nixos
];
imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ];
ssh.opts = "";
ssh.host = "95.215.187.${vmid}";
ssh.hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOW+f+PUuOBVP4IongWpryzYiOwt19smufZksSwnSPyo";
nixpkgs = inputs.nixpkgs;
nixos.module = { pkgs, modulesPath, ... }: {
imports = [
vmconfig
{ procolix.vmid = vmid; }
./procolixVm.nix
inputs.snf.nixosModules.fediversity
inputs.disko.nixosModules.default
];
};
nixos.module =
{ pkgs, modulesPath, ... }:
{
imports = [
vmconfig
{ procolix.vmid = vmid; }
./procolixVm.nix
inputs.snf.nixosModules.fediversity
inputs.disko.nixosModules.default
];
};
};
in
{
providers.local = inputs.nixops4-nixos.modules.nixops4Provider.local;
{
providers.local = inputs.nixops4-nixos.modules.nixops4Provider.local;
resources = {
fedi101 = makeProcolixVmResource "101" {
fediversity = {
enable = true;
domain = "fediversity.niols.fr";
pixelfed.enable = true;
};
resources = {
fedi101 = makeProcolixVmResource "101" {
fediversity = {
enable = true;
domain = "fediversity.niols.fr";
pixelfed.enable = true;
};
};
};
};
};
}

View file

@ -1,4 +1,9 @@
{ lib, config, modulesPath, ... }:
{
lib,
config,
modulesPath,
...
}:
let
inherit (lib) mkOption;
@ -6,7 +11,7 @@ let
in
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix")];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
options = {
procolix = {
@ -60,7 +65,10 @@ in
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;
};
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" ];
};
};