1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

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; content = import ./nix/secrets.nix inputs;
}; };
stateVersion = "23.05";
hosts = { hosts = {
nom = { nom = {
type = "nixos"; type = "nixos";

View file

@ -1,6 +1,7 @@
{ {
inputs, inputs,
pkgs, pkgs,
stateVersion,
... ...
}: { }: {
environment.etc."nixos/configuration.nix".source = pkgs.writeText "configuration.nix" '' environment.etc."nixos/configuration.nix".source = pkgs.writeText "configuration.nix" ''
@ -32,12 +33,14 @@
builders-use-substitutes = true builders-use-substitutes = true
experimental-features = nix-command flakes recursive-nix experimental-features = nix-command flakes recursive-nix
flake-registry = /etc/nix/registry.json 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"]; nixPath = ["nixpkgs=/run/current-system/nixpkgs"];
optimise.automatic = true; optimise.automatic = true;
gc.automatic = true; gc = {
automatic = true;
dates = "biweekly";
options = "--delete-older-than 90d";
};
# Define global flakes for this system # Define global flakes for this system
registry = { registry = {
nixpkgs.flake = inputs.nixpkgs; nixpkgs.flake = inputs.nixpkgs;
@ -51,6 +54,6 @@
extraSystemBuilderCmds = '' extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs 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; 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 { in {
isoImage.isoName = lib.mkForce "nixos-image-${nodeName}.iso"; isoImage.isoName = lib.mkForce "nixos-image-${nodeName}.iso";
system.stateVersion = "23.05"; system.stateVersion = self.stateVersion;
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes recursive-nix experimental-features = nix-command flakes recursive-nix
''; '';

View file

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

View file

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