From 67c39715cee3c68cfb7a552a72aa9f4cff11a3df Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 11 May 2024 20:55:27 +0100 Subject: [PATCH] home-manager wallpaper-changer --- home/sam/{global => common/core}/default.nix | 27 ++---- home/sam/common/core/git.nix | 15 ++++ .../optional}/desktop/hyprland/default.nix | 2 + .../swww-wallpaper-changer/default.nix | 15 ++++ .../swww-wallpaper-changer.sh | 0 home/sam/common/optional/desktop/waybar.nix | 16 ++++ home/sam/nixdev.nix | 5 +- hosts/common/optional/displayManager/sddm.nix | 14 ++++ hosts/common/optional/hyprland.nix | 8 ++ hosts/common/optional/pipewire.nix | 20 +++++ hosts/nixdev/default.nix | 84 ++++++------------- modules/home-manager/sddm.nix | 17 ---- pkgs/wallpaper-changer/default.nix | 11 --- 13 files changed, 124 insertions(+), 110 deletions(-) rename home/sam/{global => common/core}/default.nix (77%) create mode 100644 home/sam/common/core/git.nix rename home/sam/{features => common/optional}/desktop/hyprland/default.nix (98%) create mode 100644 home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix rename pkgs/wallpaper-changer/wallpaper-changer.sh => home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/swww-wallpaper-changer.sh (100%) create mode 100644 home/sam/common/optional/desktop/waybar.nix create mode 100644 hosts/common/optional/displayManager/sddm.nix create mode 100644 hosts/common/optional/hyprland.nix create mode 100644 hosts/common/optional/pipewire.nix delete mode 100644 modules/home-manager/sddm.nix delete mode 100644 pkgs/wallpaper-changer/default.nix diff --git a/home/sam/global/default.nix b/home/sam/common/core/default.nix similarity index 77% rename from home/sam/global/default.nix rename to home/sam/common/core/default.nix index e758dbc..7bc6abd 100644 --- a/home/sam/global/default.nix +++ b/home/sam/common/core/default.nix @@ -4,6 +4,11 @@ home.username = "sam"; home.homeDirectory = "/home/sam"; home.stateVersion = "23.11"; + + imports = [ + ./git.nix + ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? + home.packages = [ pkgs.firefox pkgs.neovim @@ -12,18 +17,6 @@ pkgs.xfce.thunar ]; - # You can import other home-manager modules here - imports = [ - # If you want to use modules your own flake exports (from modules/home-manager): - # outputs.homeManagerModules.example - - # Or modules exported from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModules.default - - # You can also split up your configuration and import pieces of it here: - # ./nvim.nix - ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? - programs.zsh = { enable = true; enableCompletion = true; @@ -74,15 +67,6 @@ qt.style.name = "adwaita-dark"; qt.style.package = pkgs.adwaita-qt; - programs.git = { - enable=true; - extraConfig= { - pull.rebase = false; - }; - userEmail="samual.shop@proton.me"; - userName="sam"; - }; - home.sessionVariables = { EDITOR="nvim"; MUSIC="$HOME/mus/music_data/"; @@ -94,3 +78,4 @@ programs.home-manager.enable = true; } + diff --git a/home/sam/common/core/git.nix b/home/sam/common/core/git.nix new file mode 100644 index 0000000..a6e6ebf --- /dev/null +++ b/home/sam/common/core/git.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: +{ + programs.git = { + enable = true; + package = pkgs.gitAndTools.gitFull; + userName = "Sam"; + userEmail = "samual.shop@proton.me"; + aliases = { }; + extraConfig = { + pull.rebase = false; + init.defaultBranch = "master"; + }; + ignores = [ ".direnv" "result" ]; + }; +} diff --git a/home/sam/features/desktop/hyprland/default.nix b/home/sam/common/optional/desktop/hyprland/default.nix similarity index 98% rename from home/sam/features/desktop/hyprland/default.nix rename to home/sam/common/optional/desktop/hyprland/default.nix index 78c9776..23260fe 100644 --- a/home/sam/features/desktop/hyprland/default.nix +++ b/home/sam/common/optional/desktop/hyprland/default.nix @@ -4,7 +4,9 @@ pkgs, ... }: { + imports = [ + ../wallpaper-changer/swww-wallpaper-changer ]; wayland.windowManager.hyprland = { diff --git a/home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix b/home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix new file mode 100644 index 0000000..2cb0e0c --- /dev/null +++ b/home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +let + scripts = { + swww-wallpaper-changer = pkgs.writeShellApplication { + name = "swww-wallpaper-changer"; + text = builtins.readFile ./swww-wallpaper-changer.sh; + }; + }; +in +{ + home.packages = builtins.attrValues { + inherit (scripts) + swww-wallpaper-changer; + }; +} diff --git a/pkgs/wallpaper-changer/wallpaper-changer.sh b/home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/swww-wallpaper-changer.sh similarity index 100% rename from pkgs/wallpaper-changer/wallpaper-changer.sh rename to home/sam/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/swww-wallpaper-changer.sh diff --git a/home/sam/common/optional/desktop/waybar.nix b/home/sam/common/optional/desktop/waybar.nix new file mode 100644 index 0000000..22b2100 --- /dev/null +++ b/home/sam/common/optional/desktop/waybar.nix @@ -0,0 +1,16 @@ +{ + lib, + config, + pkgs, + ... +}: { + # Let it try to start a few more times + systemd.user.services.waybar = { + Unit.StartLimitBurst = 30; + }; + programs.waybar = { + enable = true; + #package = ""; + systemd.enable = true; + }; +} diff --git a/home/sam/nixdev.nix b/home/sam/nixdev.nix index 1c8e5a7..a4f522d 100644 --- a/home/sam/nixdev.nix +++ b/home/sam/nixdev.nix @@ -5,8 +5,9 @@ ... }: { imports = [ - ./global - ./features/desktop/hyprland + ./common/core + ./common/optional/desktop/hyprland + ./common/optional/desktop/waybar.nix ]; # ------ diff --git a/hosts/common/optional/displayManager/sddm.nix b/hosts/common/optional/displayManager/sddm.nix new file mode 100644 index 0000000..6e7eec5 --- /dev/null +++ b/hosts/common/optional/displayManager/sddm.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, ... }: +{ + environment.systemPackages = with pkgs; [ + sddm-theme + libsForQt5.qt5.qtgraphicaleffects #required for sugar candy + ]; + services.displayManager.sddm = { + enable = true; + package = lib.mkForce pkgs.libsForQt5.sddm; + theme = "sugar-candy"; + }; + + services.displayManager.sddm.wayland.enable = true; +} diff --git a/hosts/common/optional/hyprland.nix b/hosts/common/optional/hyprland.nix new file mode 100644 index 0000000..0b5aaa5 --- /dev/null +++ b/hosts/common/optional/hyprland.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + programs.hyprland = { + enable = true; + xwayland.enable = true; + portalPackage = pkgs.xdg-desktop-portal-hyprland; + }; +} diff --git a/hosts/common/optional/pipewire.nix b/hosts/common/optional/pipewire.nix new file mode 100644 index 0000000..fb0fbd8 --- /dev/null +++ b/hosts/common/optional/pipewire.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; +# alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + jack.enable = true; + + }; + +environment.systemPackages = [ + pkgs.pamixer + pkgs.pavucontrol + ]; +} diff --git a/hosts/nixdev/default.nix b/hosts/nixdev/default.nix index bfa0c58..3ddc1ba 100644 --- a/hosts/nixdev/default.nix +++ b/hosts/nixdev/default.nix @@ -4,41 +4,22 @@ imports = [ ./hardware-configuration.nix + ../common/optional/pipewire.nix + ../common/optional/hyprland.nix + ../common/optional/displayManager/sddm.nix ]; - nixpkgs = { - # You can add overlays here overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages - - # You can also add overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) ]; - # Configure your nixpkgs instance config = { - # Disable if you don't want unfree packages allowUnfree = true; }; }; -# home-manager = { -# extraSpecialArgs = { inherit inputs; }; -# users = { -# sam = import ./home.nix; -# }; -# }; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; boot.loader.grub.enable = true; @@ -59,8 +40,8 @@ services.printing.enable = true; - sound.enable = true; - hardware.pulseaudio.enable = true; +# sound.enable = true; +# hardware.pulseaudio.enable = true; services.libinput.enable = true; @@ -72,27 +53,27 @@ users.users.sam.shell = pkgs.zsh; environment.systemPackages = with pkgs; [ - curl - vim - home-manager - tmux - waybar - git - mako - libnotify - wl-clipboard - swww - rofi-wayland - networkmanagerapplet - htop - sddm-theme - sddm - sshfs-fuse - wdisplays +# curl +# vim +# home-manager +# tmux +# waybar +# git +# mako +# libnotify +# wl-clipboard +# swww +# rofi-wayland +# networkmanagerapplet +# htop +# sddm-theme +# sddm +# sshfs-fuse +# wdisplays wallpaper_changer - #(callPackage ../../nixos_modules/themes/sddm-sugar-candy.nix{}).sddm-sugar-candy-theme - libsForQt5.qt5.qtgraphicaleffects #required for sugar candy - #(import ../../nixos_modules/scripts/wallpaper_changer.nix { inherit pkgs; }) +# #(callPackage ../../nixos_modules/themes/sddm-sugar-candy.nix{}).sddm-sugar-candy-theme +# libsForQt5.qt5.qtgraphicaleffects #required for sugar candy +# #(import ../../nixos_modules/scripts/wallpaper_changer.nix { inherit pkgs; }) ]; programs.gnupg.agent = { @@ -101,10 +82,6 @@ }; programs.zsh.enable = true; - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; hardware = { opengl.enable = true; @@ -112,17 +89,6 @@ }; services.openssh.enable = true; -# services.displayManager.sddm = { -# enable = true; -# theme = "sugar-candy"; -# }; - services.displayManager.sddm = { - enable = true; - package = lib.mkForce pkgs.libsForQt5.sddm; - theme = "sugar-candy"; - }; - - services.displayManager.sddm.wayland.enable = true; system.stateVersion = "23.11"; diff --git a/modules/home-manager/sddm.nix b/modules/home-manager/sddm.nix deleted file mode 100644 index f49d59b..0000000 --- a/modules/home-manager/sddm.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, config, ...}: -let - cfg = config.sddm; -in { - options = { - sddm.enable = lib.mkEnableOption "Enable Module"; - dataDir = mkOption { - type = types.path; - description = "sddm theme path"; - default = "/usr/share/sddm/themes/${theme}"; - }; - }; - - config = lib.mkIf cfg.enable { - #config contents - } -} diff --git a/pkgs/wallpaper-changer/default.nix b/pkgs/wallpaper-changer/default.nix deleted file mode 100644 index 895eb8c..0000000 --- a/pkgs/wallpaper-changer/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -# Uses swww to cycle through wallpapers in a random order. -# xpo [local port] [remote host] [remote port] -{ - lib, - writeShellApplication, - swww, -}: -(writeShellApplication { - name = "wallpaper-changer"; - text = builtins.readFile ./wallpaper-changer.sh; -})