From 3cb158b36fe785003284e1a88dffa008f670220a Mon Sep 17 00:00:00 2001 From: cnst Date: Sat, 28 Sep 2024 17:35:56 +0200 Subject: [PATCH] some minor fixes --- .../wm/hyprland/toothpick/keybinds.nix | 2 -- home/users/cnst/shell.nix | 8 ++--- home/users/toothpick/shell.nix | 8 ++--- hosts/cnix/default.nix | 13 +------- hosts/cnix/modules.nix | 13 ++++++-- hosts/cnixpad/default.nix | 2 ++ hosts/cnixpad/modules.nix | 9 +++++ hosts/default.nix | 4 --- hosts/toothpc/default.nix | 2 ++ hosts/toothpc/modules.nix | 9 +++++ system/modules/default.nix | 1 + system/modules/nix/nh/default.nix | 33 +++++++++++++++++++ system/nix/default.nix | 20 ++++++----- system/nix/nh/cnst/default.nix | 9 ----- system/nix/nh/toothpick/default.nix | 9 ----- system/nix/nixpkgs/default.nix | 6 ++-- 16 files changed, 91 insertions(+), 57 deletions(-) create mode 100644 system/modules/nix/nh/default.nix delete mode 100644 system/nix/nh/cnst/default.nix delete mode 100644 system/nix/nh/toothpick/default.nix diff --git a/home/modules/wm/hyprland/toothpick/keybinds.nix b/home/modules/wm/hyprland/toothpick/keybinds.nix index 0727c1c7..db5aba1d 100644 --- a/home/modules/wm/hyprland/toothpick/keybinds.nix +++ b/home/modules/wm/hyprland/toothpick/keybinds.nix @@ -17,7 +17,6 @@ in { "$passwordManager" = "keepassxc"; "$tuirun" = "tuirun-toggle.sh"; "$menu" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --"; - "$menuw" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --"; "$browser" = "firefox"; "$browserinc" = "firefox --private-window"; "$ranger" = "rangerscript"; @@ -50,7 +49,6 @@ in { "$mod, P, pseudo," # dwindle "$mod, J, togglesplit," # dwindle "$mod, C, exec, hyprctl dispatch exec copyq toggle" - "$mod, TAB, exec, $menuw" # Move focus with mainMod + arrow keys "$mod, left, movefocus, l" diff --git a/home/users/cnst/shell.nix b/home/users/cnst/shell.nix index c5fa85df..ed67819f 100644 --- a/home/users/cnst/shell.nix +++ b/home/users/cnst/shell.nix @@ -29,10 +29,10 @@ in { nixdev = "nix develop ~/.nix-config -c $SHELL"; nixconfig = "cd /home/$USER/.nix-config/"; ll = "ls -l"; - nixupdate = "nh os switch -v -H $HOST && sudo nix run /home/$USER/.nix-config"; - nixup = "nh os switch -H $HOST && sudo nix run /home/$USER/.nix-config"; - flakeupdate = "nh os switch -u -v -H $HOST && sudo nix run /home/$USER/.nix-config"; - flakeup = "nh os switch -u -H $HOST && sudo nix run /home/$USER/.nix-config"; + nixupdate = "nh os switch -v -H $HOST"; + nixup = "nh os switch -H $HOST"; + flakeupdate = "nh os switch -u -v -H $HOST"; + flakeup = "nh os switch -u -H $HOST"; ".." = "cd .."; "..." = "cd ../../"; "...." = "cd ../../../"; diff --git a/home/users/toothpick/shell.nix b/home/users/toothpick/shell.nix index 73d70190..9796dfd8 100644 --- a/home/users/toothpick/shell.nix +++ b/home/users/toothpick/shell.nix @@ -29,10 +29,10 @@ in { nixdev = "nix develop ~/.nix-config -c $SHELL"; nixconfig = "cd /home/$USER/.nix-config/"; ll = "ls -l"; - nixupdate = "nh os switch -v -H $HOST && sudo nix run /home/$USER/.nix-config"; - nixup = "nh os switch -H $HOST && sudo nix run /home/$USER/.nix-config"; - flakeupdate = "nh os switch -u -v -H $HOST && sudo nix run /home/$USER/.nix-config"; - flakeup = "nh os switch -u -H $HOST && sudo nix run /home/$USER/.nix-config"; + nixupdate = "nh os switch -v -H $HOST"; + nixup = "nh os switch -H $HOST"; + flakeupdate = "nh os switch -u -v -H $HOST"; + flakeup = "nh os switch -u -H $HOST"; ".." = "cd .."; "..." = "cd ../../"; "...." = "cd ../../../"; diff --git a/hosts/cnix/default.nix b/hosts/cnix/default.nix index 3d9074b6..26872ad3 100644 --- a/hosts/cnix/default.nix +++ b/hosts/cnix/default.nix @@ -8,7 +8,6 @@ in { users.users.cnst = { isNormalUser = true; - # hashedPasswordFile = config.age.secrets.openai.path; shell = pkgs.zsh; extraGroups = ifTheyExist [ "wheel" @@ -36,17 +35,7 @@ in { ./modules.nix ]; - # boot = { - # consoleLogLevel = 3; - # kernelPackages = lib.mkForce pkgs.linuxPackages_latest; - # kernelParams = [ - # "amd_pstate=active" - # "quiet" - # "splash" - # ]; - # }; - - # environment.variables.COPILOT_API_KEY = config.age.secrets.cnstcopilot.path; + environment.variables.FLAKE = "/home/cnst/.nix-config"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; diff --git a/hosts/cnix/modules.nix b/hosts/cnix/modules.nix index 0ba66883..4964fffb 100644 --- a/hosts/cnix/modules.nix +++ b/hosts/cnix/modules.nix @@ -66,11 +66,20 @@ }; }; }; + nix = { + nh = { + enable = true; + clean = { + enable = true; + extraArgs = "--keep 3 --keep-since 21d"; + }; + }; + }; studio = { blender = { - enable = false; + enable = true; hip = { - enable = false; + enable = true; }; }; gimp = { diff --git a/hosts/cnixpad/default.nix b/hosts/cnixpad/default.nix index 40d0d5d0..1f042667 100644 --- a/hosts/cnixpad/default.nix +++ b/hosts/cnixpad/default.nix @@ -42,6 +42,8 @@ in { } ]; + environment.variables.FLAKE = "/home/cnst/.nix-config"; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; } diff --git a/hosts/cnixpad/modules.nix b/hosts/cnixpad/modules.nix index a342d748..62137bd9 100644 --- a/hosts/cnixpad/modules.nix +++ b/hosts/cnixpad/modules.nix @@ -66,6 +66,15 @@ }; }; }; + nix = { + nh = { + enable = true; + clean = { + enable = true; + extraArgs = "--keep 3 --keep-since 21d"; + }; + }; + }; studio = { blender = { enable = false; diff --git a/hosts/default.nix b/hosts/default.nix index 4bec81b6..52f8f50d 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,7 +3,6 @@ inputs, homeImports, self, - pkgs, ... }: { flake.nixosConfigurations = let @@ -34,7 +33,6 @@ shared ++ [ ./cnix - "${mod}/nix/nh/cnst" "${mod}/dev" { home-manager = { @@ -52,7 +50,6 @@ shared ++ [ ./toothpc - "${mod}/nix/nh/toothpick" "${mod}/dev" { home-manager = { @@ -70,7 +67,6 @@ shared ++ [ ./cnixpad - "${mod}/nix/nh/cnst" "${mod}/dev" { home-manager = { diff --git a/hosts/toothpc/default.nix b/hosts/toothpc/default.nix index 42da94c8..02bec33b 100644 --- a/hosts/toothpc/default.nix +++ b/hosts/toothpc/default.nix @@ -35,6 +35,8 @@ in { ./modules.nix ]; + environment.variables.FLAKE = "/home/toothpick/.nix-config"; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; } diff --git a/hosts/toothpc/modules.nix b/hosts/toothpc/modules.nix index 048d9122..e9df56fd 100644 --- a/hosts/toothpc/modules.nix +++ b/hosts/toothpc/modules.nix @@ -67,6 +67,15 @@ }; }; }; + nix = { + nh = { + enable = true; + clean = { + enable = true; + extraArgs = "--keep 3 --keep-since 21d"; + }; + }; + }; studio = { blender = { enable = false; diff --git a/system/modules/default.nix b/system/modules/default.nix index f624b219..848c2ebb 100644 --- a/system/modules/default.nix +++ b/system/modules/default.nix @@ -13,6 +13,7 @@ "${systemModules}/hardware/graphics/nvidia" "${systemModules}/hardware/logitech" "${systemModules}/hardware/network" + "${systemModules}/nix/nh" "${systemModules}/studio/blender" "${systemModules}/studio/gimp" "${systemModules}/studio/inkscape" diff --git a/system/modules/nix/nh/default.nix b/system/modules/nix/nh/default.nix new file mode 100644 index 00000000..c1cf198c --- /dev/null +++ b/system/modules/nix/nh/default.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf mkEnableOption mkOption; + cfg = config.modules.nix.nh; +in { + options = { + modules.nix.nh = { + enable = mkEnableOption "Enables nix helper"; + clean = { + enable = mkEnableOption "Enables nix helper cleaning"; + extraArgs = mkOption { + type = lib.types.str; + description = "Extra arguments for the clean command"; + default = ""; + }; + }; + }; + }; + config = mkIf cfg.enable { + programs = { + nh = { + enable = cfg.enable; + clean = { + enable = cfg.clean.enable; + extraArgs = cfg.clean.extraArgs; + }; + }; + }; + }; +} diff --git a/system/nix/default.nix b/system/nix/default.nix index 59f2d72a..fe80afed 100644 --- a/system/nix/default.nix +++ b/system/nix/default.nix @@ -1,3 +1,4 @@ +# Yanked from https://github.com/fufexan/dotfiles { inputs, lib, @@ -21,10 +22,13 @@ console.useXkbConfig = true; - nix = { + nix = let + flakeInputs = lib.filterAttrs (_: v: lib.isType "flake" v) inputs; + in { package = pkgs.lix; + # pin the registry to avoid downloading and evaling a new nixpkgs version every time - registry = lib.mapAttrs (_: v: {flake = v;}) inputs; + registry = lib.mapAttrs (_: v: {flake = v;}) flakeInputs; # set the path for channels compat nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; @@ -42,11 +46,11 @@ trusted-users = ["root" "@wheel"]; }; - gc = { - automatic = true; - dates = "weekly"; - # Keep the last 3 generations - options = "--delete-older-than 30d"; - }; + # gc = { + # automatic = true; + # dates = "weekly"; + # # Keep the last 3 generations + # options = "--delete-older-than 30d"; + # }; }; } diff --git a/system/nix/nh/cnst/default.nix b/system/nix/nh/cnst/default.nix deleted file mode 100644 index f017d427..00000000 --- a/system/nix/nh/cnst/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - environment.variables.FLAKE = "/home/cnst/.nix-config"; - programs = { - nh = { - enable = true; - flake = "/home/cnst/.nix-config"; - }; - }; -} diff --git a/system/nix/nh/toothpick/default.nix b/system/nix/nh/toothpick/default.nix deleted file mode 100644 index 0b9b7627..00000000 --- a/system/nix/nh/toothpick/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - environment.variables.FLAKE = "/home/toothpick/.nix-config"; - programs = { - nh = { - enable = true; - flake = "/home/toothpick/.nix-config"; - }; - }; -} diff --git a/system/nix/nixpkgs/default.nix b/system/nix/nixpkgs/default.nix index 7a31be8f..96d7c24c 100644 --- a/system/nix/nixpkgs/default.nix +++ b/system/nix/nixpkgs/default.nix @@ -1,9 +1,9 @@ { nixpkgs = { overlays = [ - (_: prev: { - python312 = prev.python312.override {packageOverrides = _: pysuper: {nose = pysuper.pynose;};}; - }) + # (_: prev: { + # python312 = prev.python312.override {packageOverrides = _: pysuper: {nose = pysuper.pynose;};}; + # }) ]; config = { allowUnfree = true;