From 384fe2a6e137c2264ae63cbf497d06885cb5ca96 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 1 Dec 2023 16:53:51 -0500 Subject: [PATCH] feat: separate custom pkgs from nixpkgs --- common/default.nix | 1 + common/overlays/default.nix | 1 + common/overlays/spotifywm/default.nix | 3 ++ .../spotifywm/spotifywm.nix} | 0 common/pkgs/default.nix | 29 ++++++++++++------- devices/wim/modules/security.nix | 19 +++++++----- home/hyprland/default.nix | 12 +------- modules/ags/default.nix | 12 ++++---- 8 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 common/overlays/spotifywm/default.nix rename common/{pkgs/spotifywm/default.nix => overlays/spotifywm/spotifywm.nix} (100%) diff --git a/common/default.nix b/common/default.nix index 873c497..3334329 100644 --- a/common/default.nix +++ b/common/default.nix @@ -64,6 +64,7 @@ nur.hmModules.nur ./home + ./pkgs # Make the vars be the same on Nix and HM ./vars.nix diff --git a/common/overlays/default.nix b/common/overlays/default.nix index c2ea4a0..6ed68ce 100644 --- a/common/overlays/default.nix +++ b/common/overlays/default.nix @@ -10,6 +10,7 @@ nixpkgs.overlays = [ (import ./blueberry) + (import ./spotifywm) (import ./squeekboard) neovim-flake.overlay diff --git a/common/overlays/spotifywm/default.nix b/common/overlays/spotifywm/default.nix new file mode 100644 index 0000000..f9f8b2f --- /dev/null +++ b/common/overlays/spotifywm/default.nix @@ -0,0 +1,3 @@ +(final: prev: { + spotifywm = final.callPackage ./spotifywm.nix {}; +}) diff --git a/common/pkgs/spotifywm/default.nix b/common/overlays/spotifywm/spotifywm.nix similarity index 100% rename from common/pkgs/spotifywm/default.nix rename to common/overlays/spotifywm/spotifywm.nix diff --git a/common/pkgs/default.nix b/common/pkgs/default.nix index d754155..ff3b3c4 100644 --- a/common/pkgs/default.nix +++ b/common/pkgs/default.nix @@ -1,12 +1,21 @@ -{...}: let - mkPackage = name: (final: prev: { - ${name} = final.callPackage ./${name} {}; - }); +{lib, pkgs, ...}: let + mkPackage = name: v: { + ${name} = pkgs.callPackage ./${name} {}; + }; + + rmNotPackage = name: value: + value == "directory" && + builtins.pathExists ./${name}/default.nix; + + packages = lib.attrsets.filterAttrs rmNotPackage (builtins.readDir ./.); + + pkgSet = lib.attrsets.concatMapAttrs mkPackage packages; in { - nixpkgs.overlays = [ - (mkPackage "coloryou") - (mkPackage "input-emulator") - (mkPackage "pam-fprint-grosshack") - (mkPackage "spotifywm") - ]; + imports = [{ + options.customPkgs = lib.mkOption { + type = lib.types.attrs; + }; + }]; + + customPkgs = pkgSet; } diff --git a/devices/wim/modules/security.nix b/devices/wim/modules/security.nix index 2068eb9..c6fb97d 100644 --- a/devices/wim/modules/security.nix +++ b/devices/wim/modules/security.nix @@ -1,8 +1,13 @@ { pkgs, lib, + config, ... -}: { +}: let + grosshack = config.customPkgs.pam-fprint-grosshack; + grosshackSo = "${grosshack}/lib/security/pam_fprintd_grosshack.so"; + gnomeSo = "${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so"; +in { services.fprintd.enable = true; # https://www.reddit.com/r/NixOS/comments/z7i83r/fingertip_tip_start_fprintd_at_boot_for_a_quick/ @@ -28,7 +33,7 @@ sudo.text = '' # Account management. - auth sufficient ${pkgs.pam-fprint-grosshack}/lib/security/pam_fprintd_grosshack.so + auth sufficient ${grosshackSo} auth sufficient pam_unix.so try_first_pass nullok account required pam_unix.so @@ -48,15 +53,15 @@ account required pam_unix.so # Authentication management. - auth sufficient ${pkgs.pam-fprint-grosshack}/lib/security/pam_fprintd_grosshack.so + auth sufficient ${grosshackSo} auth optional pam_unix.so nullok likeauth - auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so + auth optional ${gnomeSo} auth sufficient pam_unix.so try_first_pass nullok auth required pam_deny.so # Password management. password sufficient pam_unix.so nullok yescrypt - password optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so use_authtok + password optional ${gnomeSo} use_authtok # Session management. session required pam_env.so conffile=/etc/pam/environment readenv=0 @@ -64,7 +69,7 @@ session required pam_loginuid.so session required ${pkgs.pam}/lib/security/pam_lastlog.so silent session optional ${pkgs.systemd}/lib/security/pam_systemd.so - session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start + session optional ${gnomeSo} auto_start ''; polkit-1.text = '' @@ -72,7 +77,7 @@ account required pam_unix.so # Authentication management. - auth sufficient ${pkgs.pam-fprint-grosshack}/lib/security/pam_fprintd_grosshack.so + auth sufficient ${grosshackSo} auth sufficient pam_unix.so try_first_pass nullok auth required pam_deny.so diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index b136d06..71f4703 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -8,7 +8,6 @@ ... }: let # Nix utils - symlink = config.lib.file.mkOutOfStoreSymlink; optionals = lib.lists.optionals; # Config stuff @@ -26,11 +25,6 @@ in { ../wofi ]; - xdg.configFile = with lib; - mkIf (pathExists confPath) { - "hypr/main.conf".source = symlink confPath; - }; - wayland.windowManager.hyprland = { enable = true; package = hyprland.packages.x86_64-linux.default; @@ -182,11 +176,7 @@ in { vfr = true; }; - source = - [] - ++ optionals (lib.pathExists confPath) [ - "~/.config/hypr/main.conf" - ]; + source = [confPath]; }; }; diff --git a/modules/ags/default.nix b/modules/ags/default.nix index 01b3e79..590646e 100644 --- a/modules/ags/default.nix +++ b/modules/ags/default.nix @@ -27,24 +27,24 @@ in { extraPackages = [pkgs.libgudev]; }; - home.packages = with pkgs; - [ + home.packages = + [config.customPkgs.coloryou] + ++ (with pkgs; [ # ags sassc - coloryou playerctl ## gui pavucontrol # TODO: replace with ags widget networkmanagerapplet # TODO: replace with ags widget - ] - ++ (optionals isTouchscreen [ + ]) + ++ (optionals isTouchscreen (with pkgs; [ # touchscreen lisgd squeekboard ydotool blueberry - ]); + ])); }) ]; }