From 8074e9f01e75d6e347f437e2abbdda83ac6dca21 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Wed, 28 Aug 2024 19:30:25 +0700 Subject: [PATCH] nixos: added nix-helper --- home/programs/zsh.nix | 6 ++++-- system/default.nix | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix index 1705393..ef31705 100644 --- a/home/programs/zsh.nix +++ b/home/programs/zsh.nix @@ -30,8 +30,10 @@ in shellAliases = { ls = "${pkgs.eza}/bin/eza -lah"; cat = "${pkgs.bat}/bin/bat"; - update = "sudo nixos-rebuild switch --flake $HOME/dotfiles"; - superupdate = "(cd $HOME/dotfiles && nix flake update && sudo nixos-rebuild switch --flake $HOME/dotfiles)"; + # update = "sudo nixos-rebuild switch --flake $HOME/dotfiles"; + update = "nh os switch"; + # superupdate = "(cd $HOME/dotfiles && nix flake update && sudo nixos-rebuild switch --flake $HOME/dotfiles)"; + superupdate = "nh os switch --update"; lg = "${pkgs.lazygit}/bin/lazygit"; du = "${pkgs.dust}/bin/dust"; uptest = "sudo nixos-rebuild test --flake $HOME/dotfiles"; diff --git a/system/default.nix b/system/default.nix index ff8211a..dac340a 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,4 +1,4 @@ -{ hardware-configuration, profile-path, config, ... }: +{ hardware-configuration, profile-path, config, pkgs, ... }: { imports = [ profile-path @@ -25,11 +25,11 @@ connect-timeout = 5 ''; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; + # nix.gc = { + # automatic = true; + # dates = "weekly"; + # options = "--delete-older-than 7d"; + # }; i18n.defaultLocale = "en_US.UTF-8"; @@ -65,4 +65,19 @@ RestartSec = "10s"; }; }; + + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "/home/${config.profile.user.name}/dotfiles"; + }; + + environment.variables.FLAKE = "/home/${config.profile.user.name}/dotfiles"; + + environment.systemPackages = with pkgs; [ + # Tools for nh + nix-output-monitor + nvd + ]; }