auto cleaning of nix store using nix-sweep
This commit is contained in:
Generated
+54
@@ -1,5 +1,20 @@
|
||||
{
|
||||
"nodes": {
|
||||
"cf": {
|
||||
"locked": {
|
||||
"lastModified": 1756852014,
|
||||
"narHash": "sha256-OrfTRBwerFrlK1fbWhu1eW40XUrOdE/Rq7IyxthEpcA=",
|
||||
"owner": "jzbor",
|
||||
"repo": "cornflakes",
|
||||
"rev": "7ef6d8be9b66f46cee3af1d5797e01f301b93149",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jzbor",
|
||||
"repo": "cornflakes",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"claude-code": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
@@ -37,6 +52,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane_2": {
|
||||
"locked": {
|
||||
"lastModified": 1762538466,
|
||||
"narHash": "sha256-8zrIPl6J+wLm9MH5ksHcW7BUHo7jSNOu0/hA0ohOOaM=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "0cea393fffb39575c46b7a0318386467272182fe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@@ -154,6 +184,29 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-sweep": {
|
||||
"inputs": {
|
||||
"cf": "cf",
|
||||
"crane": "crane_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772493505,
|
||||
"narHash": "sha256-4EWS5n9wWSNEUuqj8Nh3sPCjjRSOEh4bUd7j+wqDpSA=",
|
||||
"owner": "jzbor",
|
||||
"repo": "nix-sweep",
|
||||
"rev": "6fed48ccc7afdca7f8ea1b20260bcf736aad9ee2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jzbor",
|
||||
"ref": "main",
|
||||
"repo": "nix-sweep",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1772972630,
|
||||
@@ -238,6 +291,7 @@
|
||||
"home-manager": "home-manager",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nix-sweep": "nix-sweep",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"plasma-manager": "plasma-manager"
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
url = "github:sadjow/claude-code-nix/main";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-sweep = {
|
||||
url = "github:jzbor/nix-sweep/main";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixos-hardware, ... }@inputs:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
plasma-manager,
|
||||
lanzaboote,
|
||||
claude-code,
|
||||
nix-sweep,
|
||||
...
|
||||
}:
|
||||
hardwareConfig: hostConfig:
|
||||
@@ -27,6 +28,7 @@ nixpkgs.lib.nixosSystem {
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
hardwareConfig
|
||||
home-manager.nixosModules.home-manager
|
||||
nix-sweep.nixosModules.default
|
||||
../modules
|
||||
hostConfig
|
||||
];
|
||||
|
||||
+18
-1
@@ -1,10 +1,27 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
let
|
||||
keepGenerations = if config.boot.lanzaboote.enable then
|
||||
config.boot.lanzaboote.configurationLimit
|
||||
else if config.boot.loader.systemd-boot.enable then
|
||||
config.boot.loader.systemd-boot.configurationLimit
|
||||
else null;
|
||||
in
|
||||
{
|
||||
nix = {
|
||||
daemonIOSchedClass = "idle";
|
||||
daemonCPUSchedPolicy = "idle";
|
||||
settings.trusted-users = [ "root" "user" ];
|
||||
gc.automatic = true;
|
||||
};
|
||||
|
||||
# Clean up nix store from old configurations usinx nix-sweep
|
||||
services.nix-sweep = {
|
||||
enable = true;
|
||||
|
||||
# Automatically determine configuration limit from bootloader
|
||||
keepMax = keepGenerations;
|
||||
keepMin = if keepGenerations != null then keepGenerations else 10;
|
||||
|
||||
gc = true; # Run GC afterwards
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user