chore: auto optimize biweekly; delete generations older than 90d; use single-definition for stateVersion

This commit is contained in:
oddlama 2023-05-01 14:42:36 +02:00
parent 4cee692eff
commit e2e2c2a757
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
8 changed files with 22 additions and 26 deletions

View file

@ -86,6 +86,8 @@
content = import ./nix/secrets.nix inputs;
};
stateVersion = "23.05";
hosts = {
nom = {
type = "nixos";

View file

@ -1,6 +1,7 @@
{
inputs,
pkgs,
stateVersion,
...
}: {
environment.etc."nixos/configuration.nix".source = pkgs.writeText "configuration.nix" ''
@ -32,12 +33,14 @@
builders-use-substitutes = true
experimental-features = nix-command flakes recursive-nix
flake-registry = /etc/nix/registry.json
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
extra-builtins-file = ${../../../nix/extra-builtins.nix}
'';
nixPath = ["nixpkgs=/run/current-system/nixpkgs"];
optimise.automatic = true;
gc.automatic = true;
gc = {
automatic = true;
dates = "biweekly";
options = "--delete-older-than 90d";
};
# Define global flakes for this system
registry = {
nixpkgs.flake = inputs.nixpkgs;
@ -51,6 +54,6 @@
extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs
'';
stateVersion = "23.05";
inherit stateVersion;
};
}

View file

@ -1,5 +1,8 @@
{
imports = [./documentation.nix];
imports = [
./documentation.nix
./nix.nix
];
environment.enableDebugInfo = true;
}

6
hosts/common/dev/nix.nix Normal file
View file

@ -0,0 +1,6 @@
{pkgs, ...}: {
nix.extraOptions = ''
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
extra-builtins-file = ${../../../nix/extra-builtins.nix}
'';
}

View file

@ -1,18 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [virt-manager spice-gtk swtpm];
security.polkit.enable = true;
virtualisation = {
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
ovmf = {
enable = true;
packages = with pkgs; [OVMFFull.fd];
};
swtpm.enable = true;
};
};
spiceUSBRedirection.enable = true;
};
}

View file

@ -26,7 +26,7 @@
'';
in {
isoImage.isoName = lib.mkForce "nixos-image-${nodeName}.iso";
system.stateVersion = "23.05";
system.stateVersion = self.stateVersion;
nix.extraOptions = ''
experimental-features = nix-command flakes recursive-nix
'';

View file

@ -19,7 +19,7 @@ in
pkgs = self.pkgs.${nodeMeta.system};
specialArgs = {
inherit (nixpkgs) lib;
inherit (self) extraLib nodes;
inherit (self) extraLib nodes stateVersion;
inherit inputs;
inherit nodeName;
secrets = self.secrets.content;

View file

@ -16,7 +16,7 @@
];
home = {
stateVersion = "23.05";
inherit stateVersion;
packages = with pkgs; [
bandwhich
btop