diff --git a/hive.nix b/hive.nix index 1cfac3d..e3c05be 100644 --- a/hive.nix +++ b/hive.nix @@ -1,16 +1,22 @@ -{ +let + mods = import ./modules; + users = import ./users; +in { meta.nixpkgs = ; + meta.specialArgs = { + inherit mods users; + }; defaults = { pkgs, ... }: { imports = [ (import ) - ./modules ]; boot.tmp.useTmpfs = true; }; kat-probook = { name, nodes, ... }: { imports = [ ./machines/kat-probook/configuration.nix - ./users/home_manager.nix + users.root + users.catvayor ]; deployment.allowLocalDeployment = true; networking.hostName = name; diff --git a/machines/kat-probook/configuration.nix b/machines/kat-probook/configuration.nix index 1cf930e..2d649bb 100644 --- a/machines/kat-probook/configuration.nix +++ b/machines/kat-probook/configuration.nix @@ -27,25 +27,6 @@ # security.polkit.enable = true; # programs.light.enable = true; - nixpkgs.config.pulseaudio = true; - programs.wshowkeys.enable = true; - programs.sway.enable = true; - services.dbus.packages = with pkgs; [ dconf ]; - xdg.portal = { - enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ]; - }; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - services.gvfs.enable = true; - programs.thunar.enable = true; - programs.thunar.plugins = with pkgs.xfce; [ - thunar-volman - thunar-archive-plugin - thunar-media-tags-plugin - ]; nixpkgs.config.allowUnfree = true; @@ -72,16 +53,6 @@ # Define a user account. Don't forget to set a password with ‘passwd’. programs.zsh.enable = true; - users.users.catvayor = { - shell = pkgs.zsh; - isNormalUser = true; - extraGroups = [ "wheel" "usb" "networkmanager" "video" "audio" ]; - packages = with pkgs; [ - firefox - tree - ]; - }; - users.users.root.shell = pkgs.zsh; environment.systemPackages = with pkgs; [ wget @@ -91,6 +62,7 @@ btop ranger colmena + tree ]; fonts.packages = with pkgs; [ fira-code-nerdfont @@ -105,20 +77,6 @@ enableSSHSupport = true; }; - # programs.neovim = { - # enable = true; - # vimAlias = true; - # viAlias = true; - # defaultEditor = true; - # configure = { - # customRC = builtins.readFile ./nvim/cfg.vim; - # }; - # }; - home-manager.users.root = { - home.stateVersion = "23.11"; - imports = [ "${mods}/neovim" "${mods}/zsh.nix" ]; - }; - services.syncthing = { enable = true; systemService = true; diff --git a/modules/default.nix b/modules/default.nix index 568f859..d7ab66a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,3 +1,5 @@ -{ ... }: { - config._module.args = { mods = ./.; }; +{ + desktop-sway = import ./desktop/sway.nix; + neovim = ./neovim; + zsh = ./zsh.nix; } diff --git a/users/home_manager.nix b/modules/desktop/sway.nix similarity index 84% rename from users/home_manager.nix rename to modules/desktop/sway.nix index 1b838dc..dd5cf9b 100644 --- a/users/home_manager.nix +++ b/modules/desktop/sway.nix @@ -1,13 +1,19 @@ -{ config, pkgs, lib, mods, ... }: { - imports = [ - (import ) - ]; - home-manager.users.catvayor = { - home.stateVersion = "23.11"; - - imports = [ "${mods}/neovim" "${mods}/zsh.nix" ]; - + global = { config, pkgs, lib, mods, ... }: + { + programs.wshowkeys.enable = true; + programs.sway.enable = true; + services.dbus.packages = with pkgs; [ dconf ]; + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + }; + }; + home = { config, pkgs, lib, mods, ... }: + { xdg.configFile."sway/config".onChange = lib.mkForce ""; home.sessionVariables = { @@ -21,46 +27,13 @@ XDG_CURRENT_DESKTOP = "sway"; }; - home.packages = with pkgs; [ - wl-clipboard - firefox - pavucontrol - libnotify - zathura - - discord - signal-desktop - mattermost-desktop - keepassxc - ]; - - programs.thunderbird.enable = true; - programs.thunderbird.profiles = {}; programs.waybar.enable = true; - home.file.".config/waybar" = { source = "${mods}/waybar"; recursive = true; }; - programs.alacritty = { enable = true; settings = lib.importTOML "${mods}/alacritty.toml"; }; - services.mako = { - enable = true; - width = 400; - height = 200; - maxVisible = 5; - backgroundColor = "#8C3586"; - textColor = "#F4F40E"; - borderColor = "#F4F40E"; - defaultTimeout = 5000; - }; - - gtk = { - enable = true; - theme = { package = pkgs.arc-theme; name = "Arc-Dark"; }; - iconTheme = { package = pkgs.arc-icon-theme; name = "Arc"; }; - cursorTheme = { package = pkgs.breeze-hacked-cursor-theme; name = "Breeze_Hacked"; }; - }; - home.pointerCursor = { package = pkgs.breeze-hacked-cursor-theme; name = "Breeze_Hacked"; }; - xdg.enable = true; + home.file.".config/waybar" = { source = ./waybar; recursive = true; }; services.swayidle = - let lockwall = pkgs.runCommand "lock_wall.jpg" {} ''${pkgs.ffmpeg}/bin/ffmpeg -i ${"${mods}/wall.jpg"} -filter_complex 'gblur=sigma=3' $out -y''; + let lockwall = pkgs.runCommand "lock_wall.jpg" {} '' + ${pkgs.ffmpeg}/bin/ffmpeg -i ${./wall.jpg} -filter_complex 'gblur=sigma=3' $out -y + ''; in { enable = true; timeouts = [ @@ -75,6 +48,7 @@ { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock -f -i ${lockwall}"; } ]; }; + wayland.windowManager.sway = { enable = true; xwayland = true; @@ -87,7 +61,7 @@ let menuCmd = "${pkgs.wofi}/bin/wofi --show drun -i | xargs swaymsg exec --"; exitMd = ''Exit Mode:| (l)Log out | (r)Reboot | (p)Poweroff''; weechatCmd = pkgs.writeShellScript "weechat.sh" '' - nix-shell -p python3 python311Packages.dbus-python python311Packages.notify2 --run 'python ${"${mods}/weenotify.py"} -s' > /dev/null & + nix-shell -p python3 python311Packages.dbus-python python311Packages.notify2 --run 'python ${./weenotify.py} -s' > /dev/null & while true; do ssh -R 5431:localhost:5431 weecat@watcher.kat -t screen -xaA -S weechat sleep 1 @@ -123,7 +97,7 @@ command = "waybar"; mode = "hide"; }]; - output."*".bg = "${"${mods}/wall.jpg"} fill"; + output."*".bg = "${./wall.jpg} fill"; seat."*"."hide_cursor" = "5000"; focus.wrapping = "yes"; window.titlebar = false; diff --git a/modules/wall.jpg b/modules/desktop/wall.jpg similarity index 100% rename from modules/wall.jpg rename to modules/desktop/wall.jpg diff --git a/modules/waybar/config b/modules/desktop/waybar/config similarity index 100% rename from modules/waybar/config rename to modules/desktop/waybar/config diff --git a/modules/waybar/style.css b/modules/desktop/waybar/style.css similarity index 100% rename from modules/waybar/style.css rename to modules/desktop/waybar/style.css diff --git a/modules/weenotify.py b/modules/desktop/weenotify.py similarity index 100% rename from modules/weenotify.py rename to modules/desktop/weenotify.py diff --git a/modules/alacritty.toml b/users/cat-alacritty.toml similarity index 100% rename from modules/alacritty.toml rename to users/cat-alacritty.toml diff --git a/users/catvayor.nix b/users/catvayor.nix new file mode 100644 index 0000000..84837e3 --- /dev/null +++ b/users/catvayor.nix @@ -0,0 +1,63 @@ +{ config, pkgs, lib, mods, ... }: +{ + imports = [ mods.desktop-sway.global ]; + users.users.catvayor = { + shell = pkgs.zsh; + isNormalUser = true; + extraGroups = [ "wheel" "usb" "networkmanager" "video" "audio" ]; + packages = with pkgs; [ + tree + ]; + }; + + nixpkgs.config.pulseaudio = true; + services.gvfs.enable = true; + programs.thunar.enable = true; + programs.thunar.plugins = with pkgs.xfce; [ + thunar-volman + thunar-archive-plugin + thunar-media-tags-plugin + ]; + + home-manager.users.catvayor = { + home.stateVersion = "23.11"; + + imports = [ mods.neovim mods.zsh mods.desktop-sway.home ]; + + home.packages = with pkgs; [ + wl-clipboard + firefox + pavucontrol + libnotify + zathura + + discord + signal-desktop + mattermost-desktop + keepassxc + ]; + + programs.alacritty = { enable = true; settings = lib.importTOML ./cat-alacritty.toml; }; + programs.thunderbird.enable = true; + programs.thunderbird.profiles = {}; + services.mako = { + enable = true; + width = 400; + height = 200; + maxVisible = 5; + backgroundColor = "#8C3586"; + textColor = "#F4F40E"; + borderColor = "#F4F40E"; + defaultTimeout = 5000; + }; + + gtk = { + enable = true; + theme = { package = pkgs.arc-theme; name = "Arc-Dark"; }; + iconTheme = { package = pkgs.arc-icon-theme; name = "Arc"; }; + cursorTheme = { package = pkgs.breeze-hacked-cursor-theme; name = "Breeze_Hacked"; }; + }; + home.pointerCursor = { package = pkgs.breeze-hacked-cursor-theme; name = "Breeze_Hacked"; }; + xdg.enable = true; + }; +} diff --git a/users/default.nix b/users/default.nix new file mode 100644 index 0000000..4e562cb --- /dev/null +++ b/users/default.nix @@ -0,0 +1,4 @@ +{ + catvayor = ./catvayor.nix; + root = ./root.nix; +} diff --git a/users/root.nix b/users/root.nix new file mode 100644 index 0000000..29960bf --- /dev/null +++ b/users/root.nix @@ -0,0 +1,8 @@ +{ config, lib, pkgs, mods, ... }: +{ + users.users.root.shell = pkgs.zsh; + home-manager.users.root = { + home.stateVersion = "23.11"; + imports = [ mods.neovim mods.zsh ]; + }; +}