From a3e8f369365e4e7749d0e86c084bad753799afbf Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Sat, 8 Jul 2023 19:00:13 +0300 Subject: [PATCH] add overlays, add nix search defaults --- default.nix | 17 +++++++++++++++-- hosts/sakotop/configuration.nix | 25 ++++++++++--------------- modules/default.nix | 1 + modules/desktop/bspwm/default.nix | 14 +++++++++----- modules/shell/default.nix | 5 +++++ modules/shell/nix/default.nix | 5 +++++ modules/shell/nix/search.nix | 18 ++++++++++++++++++ overlays/default.nix | 30 +++++++++++++++++++++++++++++- 8 files changed, 92 insertions(+), 23 deletions(-) create mode 100644 modules/shell/default.nix create mode 100644 modules/shell/nix/default.nix create mode 100644 modules/shell/nix/search.nix diff --git a/default.nix b/default.nix index 2efa7179..49f01291 100644 --- a/default.nix +++ b/default.nix @@ -4,12 +4,25 @@ # home manager inputs.home-manager.nixosModules.default # modules - #i dont think this is right + # import for each folder + # modules/desktop IMPORT + # modules/desktop/example DO NOT IMPORT, + # add entry to module's default.nix outputs.nixosModules.desktop + outputs.nixosModules.shell ]; - + + # flakes nix.settings.experimental-features = [ "nix-command" "flakes"]; + # import the overlays + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + ]; + }; + # grub (mount efi partition to /boot/efi) # why /boot/efi? instead of /efi? # 1. when dualbooting, windows makes the efi partition 100mb instead of 512mb+ (we need this for generations diff --git a/hosts/sakotop/configuration.nix b/hosts/sakotop/configuration.nix index 5483567a..f93ebb8e 100644 --- a/hosts/sakotop/configuration.nix +++ b/hosts/sakotop/configuration.nix @@ -12,16 +12,17 @@ networking.hostName = "sakotop"; # Define your hostname. # Enable the X11 windowing system. - services.xserver = { - enable = true; - # bspwm - windowManager.bspwm.enable = true; - layout = "us"; - }; + #services.xserver = { + # enable = true; + # # bspwm + # windowManager.bspwm.enable = true; + # layout = "us"; + #}; modules = { desktop = { kitty.enable = true; + bspwm.enable = true; }; }; @@ -107,9 +108,9 @@ keepassxc tree dmenu - rofi - kitty - polybar + #rofi + #kitty + #polybar steam winetricks wineWowPackages.staging @@ -143,12 +144,6 @@ XDG_RUNTIME_DIR = "/run/user/1000"; }; - # TODO(sako):: make overlays in different folder - nixpkgs.overlays = [ - (final: prev: { qutebrowser = prev.qutebrowser.override { enableWideVine = true; }; }) - (final: prev: { polybar = prev.polybar.override { pulseSupport = true;}; }) - ]; - # garbage collection nix.gc = { automatic = true; diff --git a/modules/default.nix b/modules/default.nix index 3cfd0142..f973b691 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,3 +1,4 @@ { desktop = import ./desktop; + shell = import ./shell; } diff --git a/modules/desktop/bspwm/default.nix b/modules/desktop/bspwm/default.nix index 1f92f3b8..c0431e66 100644 --- a/modules/desktop/bspwm/default.nix +++ b/modules/desktop/bspwm/default.nix @@ -1,4 +1,4 @@ -{ options, config, lib, pkgs, ...}: +{ outputs, options, config, lib, pkgs, ...}: with lib; let cfg = config.modules.desktop.bspwm; @@ -14,15 +14,19 @@ in windowManager.bspwm.enable = true; }; users.users.sako.packages = with pkgs; [ - kitty + polybar + rofi ]; home-manager.users.sako = { pkgs , ...}: { xdg.configFile = { - kitty = { - source = ../../../config/kitty; + bspwm = { + source = ../../../config/bspwm; }; - }; + sxhkd = { + source = ../../../config/sxhkd; + }; + }; }; }; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix new file mode 100644 index 00000000..344c6b12 --- /dev/null +++ b/modules/shell/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./nix + ]; +} diff --git a/modules/shell/nix/default.nix b/modules/shell/nix/default.nix new file mode 100644 index 00000000..75d9724f --- /dev/null +++ b/modules/shell/nix/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./search.nix + ]; +} diff --git a/modules/shell/nix/search.nix b/modules/shell/nix/search.nix new file mode 100644 index 00000000..f01d8863 --- /dev/null +++ b/modules/shell/nix/search.nix @@ -0,0 +1,18 @@ +{ options, config, lib, pkgs, ...}: +with lib; +let cfg = config.modules.shell.nix.search; +in +{ + options.modules.shell.nix.search = { + enable = mkEnableOption false; + }; + + config = mkIf cfg.enable { + nix = { + registry = { + nixpkgs.flake = nixpkgs; + nixos-hardware.flake = nixos-hw; + }; + }; + }; +} diff --git a/overlays/default.nix b/overlays/default.nix index 0967ef42..64ab9e9c 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1 +1,29 @@ -{} +{ inputs, ...}: +{ + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../packages { pkgs = final; }; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + polybar = prev.polybar.override { + pulseSupport = true; + }; + qutebrowser = prev.qutebrowser.override { + enableWideVine = true; + }; + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +}