Compare commits
5 Commits
7d013c83bc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 349181f35b | |||
| 0b8b7564a1 | |||
| 54e0f94af5 | |||
| 977aa539a3 | |||
| d56605e37a |
21
flake.lock
generated
21
flake.lock
generated
@@ -366,6 +366,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772945408,
|
||||
"narHash": "sha256-PMt48sEQ8cgCeljQ9I/32uoBq/8t8y+7W/nAZhf72TQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "1c1d8ea87b047788fd7567adf531418c5da321ec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-matlab": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
@@ -585,6 +605,7 @@
|
||||
"music-reader": "music-reader",
|
||||
"nix-colors": "nix-colors",
|
||||
"nix-gl": "nix-gl",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nix-matlab": "nix-matlab",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-index-database = {
|
||||
url = "github:nix-community/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -94,7 +98,9 @@
|
||||
nixosConfigurations = {
|
||||
# Main laptop
|
||||
aspi = lib.nixosSystem {
|
||||
modules = [./hosts/aspi];
|
||||
modules = [
|
||||
./hosts/aspi
|
||||
];
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
links2 # Tui web-browser
|
||||
lnav # log analyzing tool
|
||||
mc # Tui file browser
|
||||
# nix-index
|
||||
nmap
|
||||
p7zip # unzip 7zip archives
|
||||
parted
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
@@ -9,6 +10,7 @@
|
||||
[
|
||||
../features/fonts
|
||||
../features/nix-helper
|
||||
inputs.nix-index-database.homeModules.default # nix-locate
|
||||
]
|
||||
++ (builtins.attrValues outputs.homeManagerModules);
|
||||
|
||||
@@ -33,9 +35,19 @@
|
||||
|
||||
# systemd.user.startServices = "sd-switch"; # TODO: what is this
|
||||
|
||||
# Expire old hm generations
|
||||
hm-expire = {
|
||||
enable = true;
|
||||
dates = "weekly";
|
||||
expire = "-30 days";
|
||||
};
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
git.enable = true;
|
||||
|
||||
nix-index.enable = true; # allows command-not-found
|
||||
nix-index-database.comma.enable = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
|
||||
@@ -39,6 +39,20 @@
|
||||
"ca-derivations"
|
||||
];
|
||||
|
||||
# Expire old hm generations
|
||||
hm-expire = {
|
||||
enable = true;
|
||||
dates = "weekly";
|
||||
expire = "-30 days";
|
||||
};
|
||||
# Remove unused packets
|
||||
services.nix-gc = {
|
||||
enable = true;
|
||||
automatic = true;
|
||||
frequency = "weekly";
|
||||
persistent = true;
|
||||
};
|
||||
|
||||
# nix.settings. # warn-dirty = false; # TODO: do I want this
|
||||
#
|
||||
# Ensure we can still build when missing-server is not accessible
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
../common/optional/podman.nix
|
||||
../common/optional/wireguard.nix
|
||||
../common/optional/wireshark.nix
|
||||
../common/optional/flatpak.nix
|
||||
|
||||
../common/optional/avahi.nix
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
{outputs, ...}: {
|
||||
# Apply overlays
|
||||
nixpkgs = {
|
||||
# TODO: apply this to hm and nixos without duplicate code
|
||||
@@ -32,10 +28,12 @@
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
persistent = true;
|
||||
};
|
||||
nix.optimise = {
|
||||
automatic = true;
|
||||
dates = ["weekly"]; # Optional; allows customizing optimisation schedule
|
||||
persistent = true;
|
||||
};
|
||||
|
||||
programs.nix-ld.enable = true;
|
||||
|
||||
9
hosts/common/optional/wireshark.nix
Normal file
9
hosts/common/optional/wireshark.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
programs.wireshark = {
|
||||
enable = true;
|
||||
dumpcap.enable = true;
|
||||
usbmon.enable = true;
|
||||
};
|
||||
|
||||
users.users.julian.extraGroups = ["wireshark"];
|
||||
}
|
||||
@@ -5,4 +5,5 @@
|
||||
colors = import ./colors.nix;
|
||||
hostname = import ./hostname.nix;
|
||||
non-nixos = import ./non-nixos.nix;
|
||||
hm-expire = import ./hm-expire.nix;
|
||||
}
|
||||
|
||||
46
modules/home-manager/hm-expire.nix
Normal file
46
modules/home-manager/hm-expire.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.hm-expire;
|
||||
in {
|
||||
options.hm-expire = {
|
||||
enable = lib.mkEnableOption "Whether to enable hm-expire";
|
||||
dates = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "weekly";
|
||||
};
|
||||
expire = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "-30 days";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# This creates a user-level systemd service
|
||||
systemd.user.services.cleanup-home-manager = {
|
||||
Unit = {
|
||||
Description = "Cleanup old Home Manager generations";
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.home-manager}/bin/home-manager expire-generations \"${cfg.expire}\"'";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers.cleanup-home-manager = {
|
||||
Unit = {
|
||||
Description = "Weekly cleanup of Home Manager generations";
|
||||
};
|
||||
Timer = {
|
||||
OnCalendar = cfg.dates;
|
||||
Persistent = true;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["timers.target"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user