auto cleaning of nix store using nix-sweep
This commit is contained in:
Generated
+54
@@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"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": {
|
"claude-code": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
@@ -37,6 +52,21 @@
|
|||||||
"type": "github"
|
"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-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -154,6 +184,29 @@
|
|||||||
"type": "github"
|
"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": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1772972630,
|
"lastModified": 1772972630,
|
||||||
@@ -238,6 +291,7 @@
|
|||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"lanzaboote": "lanzaboote",
|
"lanzaboote": "lanzaboote",
|
||||||
"nix-flatpak": "nix-flatpak",
|
"nix-flatpak": "nix-flatpak",
|
||||||
|
"nix-sweep": "nix-sweep",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"plasma-manager": "plasma-manager"
|
"plasma-manager": "plasma-manager"
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
url = "github:sadjow/claude-code-nix/main";
|
url = "github:sadjow/claude-code-nix/main";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
nix-sweep = {
|
||||||
|
url = "github:jzbor/nix-sweep/main";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixos-hardware, ... }@inputs:
|
outputs = { self, nixos-hardware, ... }@inputs:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
plasma-manager,
|
plasma-manager,
|
||||||
lanzaboote,
|
lanzaboote,
|
||||||
claude-code,
|
claude-code,
|
||||||
|
nix-sweep,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
hardwareConfig: hostConfig:
|
hardwareConfig: hostConfig:
|
||||||
@@ -27,6 +28,7 @@ nixpkgs.lib.nixosSystem {
|
|||||||
lanzaboote.nixosModules.lanzaboote
|
lanzaboote.nixosModules.lanzaboote
|
||||||
hardwareConfig
|
hardwareConfig
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
nix-sweep.nixosModules.default
|
||||||
../modules
|
../modules
|
||||||
hostConfig
|
hostConfig
|
||||||
];
|
];
|
||||||
|
|||||||
+18
-1
@@ -1,10 +1,27 @@
|
|||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ 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 = {
|
nix = {
|
||||||
daemonIOSchedClass = "idle";
|
daemonIOSchedClass = "idle";
|
||||||
daemonCPUSchedPolicy = "idle";
|
daemonCPUSchedPolicy = "idle";
|
||||||
settings.trusted-users = [ "root" "user" ];
|
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