diff --git a/defaults/git.nix b/defaults/git.nix index 94d5861..f1090db 100644 --- a/defaults/git.nix +++ b/defaults/git.nix @@ -8,10 +8,16 @@ let name = "git"; cfg = config.nixowos.defaults.${name}; + superCfg = config.programs.${name}; in { options = { nixowos.defaults.${name}.enable = lib.mkEnableOption name; + + # FIXME: this doesn't really belong in defaults/ + programs.${name}.delta.enable = lib.mkEnableOption "delta within git" // { + default = true; + }; }; config = lib.mkIf cfg.enable { @@ -28,10 +34,15 @@ in # causing further problems pull.ff = "only"; - push.autoSetupRemote = true; - + merge.conflictStyle = "zdiff3"; # easiest to understand style commit.verbose = true; # show diffs in commit editor - }; + } + // (lib.optionalAttrs (superCfg.delta.enable && config.nixowos.allowAddingPackages) { + core.pager = "${lib.getExe pkgs.delta}"; + interactive.diffFilter = "${lib.getExe pkgs.delta} --color-only"; + delta.navigate = true; # use n and N to move between diff sections + delta.diff-highlight = true; # simpler mode, highlights inter-line changes + }); }; }; diff --git a/defaults/lix.nix b/defaults/lix.nix index b1eae5d..998a5a4 100644 --- a/defaults/lix.nix +++ b/defaults/lix.nix @@ -17,11 +17,11 @@ in config = lib.mkIf cfg.enable { # use lix, a fork of nix # see: https://lix.systems/about - nix.package = pkgs.lixPackageSets.latest.lix; + nix.package = pkgs.lixPackageSets.lix_2_95.lix; # overlays so that all nix tools use lix nixpkgs.overlays = [ (final: prev: { - inherit (prev.lixPackageSets.latest) + inherit (prev.lixPackageSets.lix_2_95) nixpkgs-review nix-eval-jobs nix-fast-build diff --git a/defaults/nix.nix b/defaults/nix.nix index d6e87a6..2f1364a 100644 --- a/defaults/nix.nix +++ b/defaults/nix.nix @@ -25,11 +25,11 @@ in # source: https://nix.dev/manual/nix/2.26/command-ref/new-cli/nix3-store-optimise nix.settings.auto-optimise-store = true; - # trigger the garbage collector automatically - # when free space in /nix/store goes below this - nix.settings.min-free = 1000000000; # 1GB - # free up to this many bytes in an automatic invocation - # to avoid it taking too long - nix.settings.max-free = 5000000000; # 5GB + environment.systemPackages = + with pkgs; + lib.mkIf config.nixowos.allowAddingPackages [ + nixd + nixfmt + ]; }; } diff --git a/defaults/plasma.nix b/defaults/plasma.nix index 060055c..4a042e9 100644 --- a/defaults/plasma.nix +++ b/defaults/plasma.nix @@ -28,6 +28,11 @@ in config = lib.mkIf cfg.enable { hardware.graphics.enable = true; + fonts = lib.mkIf config.nixowos.allowAddingPackages { + enableDefaultPackages = lib.mkDefault true; + packages = [ pkgs.noto-fonts-cjk-sans ]; + }; + environment.systemPackages = with pkgs; lib.mkIf config.nixowos.allowAddingPackages [ diff --git a/defaults/shell.nix b/defaults/shell.nix index cb9f022..e8df363 100644 --- a/defaults/shell.nix +++ b/defaults/shell.nix @@ -28,6 +28,8 @@ in compsize ffmpeg + + python3 ] ++ ( if config.nixowos.nvidia.enable then @@ -38,6 +40,7 @@ in else [ btop-rocm + nvtopPackages.amd ] ); }; @@ -47,6 +50,9 @@ in # use Fish, the nicest shell :) programs.fish.enable = lib.mkIf config.nixowos.allowAddingPackages true; users.defaultUserShell = lib.mkIf config.nixowos.allowAddingPackages pkgs.fish; + # avoid generating caches (enabled by fish) due to slowdowns during nixos-rebuild + # this may degrade autocompletion + documentation.man.generateCaches = false; environment.shellAliases = { # make nix-shell preserve the user's $SHELL diff --git a/defaults/system.nix b/defaults/system.nix index 836c99c..6811152 100644 --- a/defaults/system.nix +++ b/defaults/system.nix @@ -1,4 +1,5 @@ { + pkgs, lib, config, ... @@ -11,10 +12,19 @@ in { options.nixowos.defaults.${name} = { enable = lib.mkEnableOption name; + + extraPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = with pkgs; [ + sshfs + ]; + }; }; config = lib.mkIf cfg.enable { + environment.systemPackages = lib.mkIf config.nixowos.allowAddingPackages cfg.extraPackages; + boot.loader.grub = lib.mkDefault { # modern installation device = "nodev"; @@ -42,9 +52,6 @@ in tmpfsHugeMemoryPages = "within_size"; }; - # this is useful not only for having a user named "tmp" - # but also if any user wants to use a temporary directory, - # it's much nicer than /tmp because it isn't filled with system files fileSystems."/home/tmp" = lib.mkDefault { fsType = "tmpfs"; diff --git a/nvidia.nix b/nvidia.nix index 5297906..f35deef 100644 --- a/nvidia.nix +++ b/nvidia.nix @@ -22,12 +22,7 @@ in # Enable this if you have graphical corruption issues or application crashes after waking # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead # of just the bare essentials. - powerManagement.enable = true; - # the following is from @tlater:matrix.tlater.net (Lix Off Topic, 2026-06-24) - # `powerManagement.enable` maps to this set of NVIDIA driver features: https://download.nvidia.com/XFree86/Linux-x86_64/610.43.02/README/powermanagement.html - # You can read through those docs yourself, but tl;dr: modern GPUs have more memory than can normally be stored on suspend, so they need a workaround. - # The modern open source drivers can use some cool kernel features that were behind the GPL lock beforehand to achieve that, the proprietary drivers are stuck with a hack. But basically, you always want to enable that option on NixOS. - # The `powermanagement.finegrained` stuff on the other hand has to do with multi-GPU setups. The two options should really not be grouped together like this. + # powerManagement.enable = false; # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver).