summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-29 20:10:36 +0200
committerAlan Pearce2024-04-29 20:10:36 +0200
commit21398bece441d9afaa8e74539d993c3e976ebce0 (patch)
tree66aa0a1e006a3b57371eaf6be05cc31ebbd9d473
parent7a3f06fe4aa3a61b9d86b6aebdb404eba95d9eb5 (diff)
downloadnixfiles-21398bece441d9afaa8e74539d993c3e976ebce0.tar.lz
nixfiles-21398bece441d9afaa8e74539d993c3e976ebce0.tar.zst
nixfiles-21398bece441d9afaa8e74539d993c3e976ebce0.zip
use `nh` as a nixos-rebuild wrapper with nice output
-rw-r--r--.envrc1
-rw-r--r--system/settings/configuration/nix.nix3
-rw-r--r--system/settings/user-interface.nix9
-rw-r--r--user/settings/fish.nix2
-rw-r--r--user/settings/nixos.nix8
5 files changed, 17 insertions, 6 deletions
diff --git a/.envrc b/.envrc
index 8075d5b0..fa82cfc4 100644
--- a/.envrc
+++ b/.envrc
@@ -4,3 +4,4 @@ else
 	echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
 	use flake
 fi
+FLAKE=$PWD
diff --git a/system/settings/configuration/nix.nix b/system/settings/configuration/nix.nix
index 6b6d51b3..ff870540 100644
--- a/system/settings/configuration/nix.nix
+++ b/system/settings/configuration/nix.nix
@@ -1,4 +1,5 @@
 { config
+, lib
 , pkgs
 , ...
 }: {
@@ -22,7 +23,7 @@
     '';
 
     gc = {
-      automatic = true;
+      automatic = lib.mkDefault true;
       options = "--delete-older-than 14d";
     };
   };
diff --git a/system/settings/user-interface.nix b/system/settings/user-interface.nix
index 915c3ec4..e2784743 100644
--- a/system/settings/user-interface.nix
+++ b/system/settings/user-interface.nix
@@ -61,6 +61,15 @@
 
   programs.dconf.enable = true;
 
+  programs.nh = {
+    enable = true;
+    clean = {
+      enable = true;
+      extraArgs = "--keep-since 14d";
+    };
+  };
+  nix.gc.automatic = ! config.programs.nh.enable;
+
   imports = [
     ./services/xserver.nix
   ];
diff --git a/user/settings/fish.nix b/user/settings/fish.nix
index 7e144e05..0101178c 100644
--- a/user/settings/fish.nix
+++ b/user/settings/fish.nix
@@ -25,7 +25,7 @@
       ];
     # TODO: pre-generate nix-your-shell
     interactiveShellInit = ''
-      ${pkgs.nix-your-shell}/bin/nix-your-shell fish | source
+      ${pkgs.nix-your-shell}/bin/nix-your-shell --nom env fish | source
       bind \es __ghq_repository_search
       # don't bind ctrl-t, it does nice things on macOS/BSD
       set FZF_CTRL_T_COMMAND
diff --git a/user/settings/nixos.nix b/user/settings/nixos.nix
index bae37c56..d30d6a3d 100644
--- a/user/settings/nixos.nix
+++ b/user/settings/nixos.nix
@@ -5,9 +5,9 @@
   ];
 
   home.shellAliases = {
-    srb = "sudo nixos-rebuild";
-    rbs = "sudo nixos-rebuild switch --fast";
-    rbb = "sudo nixos-rebuild boot";
-    rbr = "sudo nixos-rebuild switch --rollback";
+    srb = "nh os";
+    rbs = "nh os switch --fast";
+    rbb = "nh os boot";
+    rbr = "nh os switch --rollback";
   };
 }