mirror of
https://github.com/youwen5/nixos.git
synced 2024-11-24 17:53:51 -08:00
feat: add nh cli
This commit is contained in:
parent
4939d8ef22
commit
5b13a132cc
2 changed files with 33 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -29,17 +30,24 @@
|
||||||
"flakes"
|
"flakes"
|
||||||
];
|
];
|
||||||
optimise.automatic = true;
|
optimise.automatic = true;
|
||||||
gc = {
|
# gc = {
|
||||||
automatic = true;
|
# automatic = true;
|
||||||
dates = "weekly";
|
# dates = "weekly";
|
||||||
options = "--delete-older-than 14d";
|
# options = "--delete-older-than 14d";
|
||||||
};
|
# };
|
||||||
# Free up to 1GiB when there is less than 100MiB left
|
# Free up to 1GiB when there is less than 100MiB left
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
min-free = ${toString (100 * 1024 * 1024)}
|
min-free = ${toString (100 * 1024 * 1024)}
|
||||||
max-free = ${toString (1024 * 1024 * 1024)}
|
max-free = ${toString (1024 * 1024 * 1024)}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.nh = {
|
||||||
|
enable = true;
|
||||||
|
clean.enable = true;
|
||||||
|
clean.extraArgs = "--keep-since 4d --keep 3";
|
||||||
|
flake = "/home/youwen/.config/liminalOS";
|
||||||
|
};
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -84,12 +84,25 @@
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
programs.fish.functions = {
|
programs.fish.functions = {
|
||||||
rebuild = ''doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} switch &| nom'';
|
# rebuild = ''doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} switch &| nom'';
|
||||||
os-test = ''doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} test &| nom'';
|
# os-test = ''doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} test &| nom'';
|
||||||
nixos-update = ''
|
# nixos-update = ''
|
||||||
cd ~/.config/liminalOS
|
# cd ~/.config/liminalOS
|
||||||
nix flake update --commit-lock-file
|
# nix flake update --commit-lock-file
|
||||||
doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} switch &| nom
|
# doas nixos-rebuild --flake ~/.config/liminalOS\#${osConfig.networking.hostName} switch &| nom
|
||||||
|
# '';
|
||||||
|
nh = {
|
||||||
|
body = ''
|
||||||
|
if count $argv > /dev/null
|
||||||
|
if contains -- os $argv or contains -- clean $argv
|
||||||
|
doas ${pkgs.nh}/bin/nh $argv -R
|
||||||
|
else
|
||||||
|
${pkgs.nh}/bin/nh $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
|
${pkgs.nh}/bin/nh
|
||||||
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue