From ff839c3153ba2ed6547b2c8cf5ef1f8247f6fbcd Mon Sep 17 00:00:00 2001 From: chayleaf Date: Fri, 1 Nov 2024 01:26:11 +0700 Subject: [PATCH] misc fixes --- home/modules/firefox.nix | 2 +- home/modules/nvim.nix | 2 +- nixos-rebuild.py | 4 +++- system/hosts/nixmsi.nix | 2 +- system/modules/common.nix | 31 ++++++++++++++++--------------- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index bc07a84..0de86f6 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -46,10 +46,10 @@ ublock-origin unpaywall vimium-c + yomitan youtube-shorts-block ]) ++ (with pkgs.firefoxAddons; [ fastforwardteam - rikaitan youtube-nonstop ]); search.default = "search.pavluk.org"; diff --git a/home/modules/nvim.nix b/home/modules/nvim.nix index 87be3ea..1affb1d 100644 --- a/home/modules/nvim.nix +++ b/home/modules/nvim.nix @@ -473,7 +473,7 @@ vimdiffAlias = true; extraConfigLua = compile "main" ( - builtins.concatLists (map (x: if x?plugin && x?config then lib.toList x.config else [ ]) plugins) ++ [ + builtins.concatLists (map (x: lib.toList (x.config or [ ])) plugins) ++ [ (kmSetNs { "" = { rhs = DEFUN (vim.fn.system [ "chmod" "+x" (vim.fn.expand "%") ]); diff --git a/nixos-rebuild.py b/nixos-rebuild.py index 7541d9f..1460c15 100755 --- a/nixos-rebuild.py +++ b/nixos-rebuild.py @@ -19,7 +19,7 @@ def main(): addr = opts["addresses"][cfg] build_host = opts["build_host"].get(cfg) act = args[2] - assert act in ["boot", "switch", "test"] + assert act in ["boot", "switch", "test", "build"] args = args[3:] args.extend( [ @@ -66,6 +66,8 @@ def main(): ret = json.loads(ret.stdout)[0]["outputs"]["out"] print('output', ret) cmds = [] + if act in ["build"]: + return if act in ["boot", "switch"]: cmds.append(["nix-env", "-p", "/nix/var/nix/profiles/system", "--set", ret]) cmds.append( diff --git a/system/hosts/nixmsi.nix b/system/hosts/nixmsi.nix index 65e03b5..ec11f86 100644 --- a/system/hosts/nixmsi.nix +++ b/system/hosts/nixmsi.nix @@ -129,7 +129,7 @@ services.printing.drivers = [ pkgs.hplip ]; # from nix-gaming services.pipewire.lowLatency = { - enable = false; + enable = true; # 96 is mostly fine but has some xruns # 128 has xruns every now and then too quantum = 128; diff --git a/system/modules/common.nix b/system/modules/common.nix index ff7d49a..f9568a8 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -124,6 +124,22 @@ in { # nixos-hardware uses mkDefault here, so we use slightly higher priority services.libinput.enable = mkForceDefault (!cfg.minimal); programs.fuse.userAllowOther = true; + + # registry is used for the new flaky nix command + nix.registry = + builtins.mapAttrs + (_: v: { flake = v; }) + (lib.filterAttrs (k: v: (k != "self" || !cfg.minimal) && v?outputs) inputs); + + # add import'able flake inputs (like nixpkgs) to nix path + # nix path is used for old nix commands (like nix-build, nix-shell) + environment.etc = lib.mapAttrs' + (name: value: { + name = "nix/inputs/${name}"; + value.source = value.outPath or "${value}"; + }) + (lib.filterAttrs (k: v: (k != "self" || !cfg.minimal) && builtins.pathExists "${v}/default.nix") inputs); + } (lib.mkIf cfg.gettyAutologin { @@ -183,21 +199,6 @@ in { }) (lib.mkIf (!cfg.minimal) { - # registry is used for the new flaky nix command - nix.registry = - builtins.mapAttrs - (_: v: { flake = v; }) - (lib.filterAttrs (_: v: v?outputs) inputs); - - # add import'able flake inputs (like nixpkgs) to nix path - # nix path is used for old nix commands (like nix-build, nix-shell) - environment.etc = lib.mapAttrs' - (name: value: { - name = "nix/inputs/${name}"; - value.source = value.outPath or "${value}"; - }) - (lib.filterAttrs (_: v: builtins.pathExists "${v}/default.nix") inputs); - nix.nixPath = [ "/etc/nix/inputs" ]; hardware.pulseaudio.enable = false; services.pipewire = {