diff --git a/audio.nix b/audio.nix new file mode 100644 index 0000000..0e60d5a --- /dev/null +++ b/audio.nix @@ -0,0 +1,28 @@ +{ + pkgs, + ... +}: + +{ + + environment.systemPackages = with pkgs; [ + wireplumber + playerctl # Interaction with audioplayers and browsers + pavucontrol # GUI + ]; + + hardware.pulseaudio.enable = false; # Use Pipewire, the modern sound subsystem + + security.rtkit.enable = true; # Enable RealtimeKit for audio purposes + + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + # Uncomment the following line if you want to use JACK applications + # jack.enable = true; + }; +} diff --git a/configuration.nix b/configuration.nix index 7390bab..515d9cd 100644 --- a/configuration.nix +++ b/configuration.nix @@ -13,6 +13,7 @@ ./hardware-configuration.nix ./terminal ./hyprland + ./audio.nix ]; # Bootloader. @@ -64,8 +65,14 @@ # Allow unfree packages nixpkgs.config.allowUnfree = true; - environment.variables = { - EDITOR = "nvim"; + environment = { + variables = { + EDITOR = "nvim"; + }; + sessionVariables = { + # Tells Electron apps to use Wayland + NIXOS_OZONE_WL = "1"; + }; }; # List packages installed in system profile. To search, run: @@ -76,9 +83,6 @@ git kitty swaynotificationcenter - pipewire - wireplumber - playerctl # Interaction with audio players and browsers xdg-utils xdg-desktop-portal-gtk xdg-desktop-portal-hyprland @@ -135,9 +139,6 @@ enable = true; }; - # Required for nvim with flakes - # nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - steam = { enable = true; remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play @@ -151,7 +152,11 @@ # Enable the OpenSSH daemon. # services.openssh.enable = true; - security.rtkit.enable = true; + security = { + # Adds Swaylock to /etc/pam.d + pam.services.swaylock = { }; + rtkit.enable = true; + }; services = { displayManager.sddm = { @@ -167,15 +172,6 @@ pcscd.enable = true; - pipewire = { - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - }; - tailscale = { enable = true; }; @@ -192,11 +188,17 @@ }; }; -stylix = { + stylix = { enable = true; image = ./catppuccin.png; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; polarity = "dark"; + opacity.terminal = 0.8; + override = { + base02 = "b0b0b0"; # Comments in shell + base03 = "b0b0b0"; # Comments in nvim + base04 = "b0b0b0"; # Secondary text in shell + }; }; virtualisation.docker = { diff --git a/flake.nix b/flake.nix index 7ce5387..ff46389 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,12 @@ }; outputs = - inputs@{ nixpkgs, home-manager, stylix, ... }: + inputs@{ + nixpkgs, + home-manager, + stylix, + ... + }: let system = "x86_64-linux"; in @@ -34,7 +39,7 @@ home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.users.martin = import ./home.nix; } - stylix.nixosModules.stylix + stylix.nixosModules.stylix ]; }; }; diff --git a/home.nix b/home.nix index ba00a35..4d88572 100644 --- a/home.nix +++ b/home.nix @@ -11,6 +11,14 @@ username = "martin"; homeDirectory = "/home/martin"; + file = { + ".config/wlogout/hibernate.svg".source = ./home/wlogout/hibernate.svg; + ".config/wlogout/lock.svg".source = ./home/wlogout/lock.svg; + ".config/wlogout/logout.svg".source = ./home/wlogout/logout.svg; + ".config/wlogout/reboot.svg".source = ./home/wlogout/reboot.svg; + ".config/wlogout/shutdown.svg".source = ./home/wlogout/shutdown.svg; + ".config/wlogout/suspend.svg".source = ./home/wlogout/suspend.svg; + }; # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. @@ -34,11 +42,6 @@ clipboard.providers.wl-copy.enable = true; - colorschemes.catppuccin = { - enable = true; - settings.flavour = "mocha"; - }; - opts = { number = true; # Show line numbers relativenumber = true; # Show relative line numbers @@ -84,6 +87,56 @@ web-devicons.enable = true; }; }; + starship = { + enable = true; + settings = (with builtins; fromTOML (readFile ./starship.toml)) // { }; + }; + + # Lock desktop + swaylock.enable = true; + # Log out and shutdown menu + wlogout = { + enable = true; + layout = [ + { + label = "lock"; + action = "sh -c '(sleep 0.5s; swaylock)' & disown"; + text = "Lock"; + keybind = "l"; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + } + { + label = "logout"; + action = "loginctl terminate-user $USER"; + text = "Logout"; + keybind = "e"; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "u"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + } + ]; + style = ./home/wlogout/style.css; + }; }; services = { diff --git a/home/wlogout/hibernate.svg b/home/wlogout/hibernate.svg new file mode 100644 index 0000000..5626c72 --- /dev/null +++ b/home/wlogout/hibernate.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/home/wlogout/lock.svg b/home/wlogout/lock.svg new file mode 100644 index 0000000..4b629fd --- /dev/null +++ b/home/wlogout/lock.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/home/wlogout/logout.svg b/home/wlogout/logout.svg new file mode 100644 index 0000000..3e0cc80 --- /dev/null +++ b/home/wlogout/logout.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/home/wlogout/reboot.svg b/home/wlogout/reboot.svg new file mode 100644 index 0000000..c05f000 --- /dev/null +++ b/home/wlogout/reboot.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/home/wlogout/shutdown.svg b/home/wlogout/shutdown.svg new file mode 100644 index 0000000..6693b35 --- /dev/null +++ b/home/wlogout/shutdown.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/home/wlogout/style.css b/home/wlogout/style.css new file mode 100644 index 0000000..e3b65e7 --- /dev/null +++ b/home/wlogout/style.css @@ -0,0 +1,51 @@ +* { + background-image: none; + box-shadow: none; +} + +window { + background-color: rgba(30, 30, 46, 0.90); +} + +button { + border-radius: 0; + border-color: #f5c2e7; + text-decoration-color: #cdd6f4; + color: #cdd6f4; + background-color: #181825; + border-style: solid; + border-width: 1px; + background-repeat: no-repeat; + background-position: center; + background-size: 25%; +} + +button:focus, button:active, button:hover { + /* 20% Overlay 2, 80% mantle */ + background-color: rgb(48, 50, 66); + outline-style: none; +} + +#lock { + background-image: url("./lock.svg"); +} + +#logout { + background-image: url("./logout.svg"); +} + +#suspend { + background-image: url("./suspend.svg"); +} + +#hibernate { + background-image: url("./hibernate.svg"); +} + +#shutdown { + background-image: url("./shutdown.svg"); +} + +#reboot { + background-image: url("./reboot.svg"); +} diff --git a/home/wlogout/suspend.svg b/home/wlogout/suspend.svg new file mode 100644 index 0000000..08214b4 --- /dev/null +++ b/home/wlogout/suspend.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + diff --git a/hyprland/default.nix b/hyprland/default.nix index 42c5333..b7dd35f 100644 --- a/hyprland/default.nix +++ b/hyprland/default.nix @@ -1,7 +1,8 @@ -{...}: +{ ... }: { imports = [ ./waybar.nix + ./wallpaper.nix ]; } diff --git a/hyprland/wallpaper.nix b/hyprland/wallpaper.nix new file mode 100644 index 0000000..8577301 --- /dev/null +++ b/hyprland/wallpaper.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + swww + waypaper + ]; +} diff --git a/hyprland/waybar.nix b/hyprland/waybar.nix index 3628922..9032ada 100644 --- a/hyprland/waybar.nix +++ b/hyprland/waybar.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ @@ -10,4 +10,3 @@ font-awesome ]; } - diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..6b31c4c --- /dev/null +++ b/starship.toml @@ -0,0 +1,174 @@ +"$schema" = 'https://starship.rs/config-schema.json' + +palette = "catppuccin_mocha" + +format = """ +[](mantle)\ +$os\ +$username\ +[](bg:lavender fg:mantle)\ +$directory\ +[](fg:lavender bg:blue)\ +$git_branch\ +$git_status\ +[](fg:blue bg:#86BBD8)\ +$c\ +$elixir\ +$elm\ +$golang\ +$gradle\ +$haskell\ +$java\ +$julia\ +$nodejs\ +$nim\ +$rust\ +$scala\ +[](fg:#86BBD8 bg:#06969A)\ +$docker_context\ +[](fg:#06969A bg:#33658A)\ +$time\ +[ ](fg:#33658A)\ +""" + +# Disable the blank line at the start of the prompt +# add_newline = false + +[palettes.catppuccin_mocha] +rosewater = "#f5e0dc" +flamingo = "#f2cdcd" +pink = "#f5c2e7" +mauve = "#cba6f7" +red = "#f38ba8" +maroon = "#eba0ac" +peach = "#fab387" +yellow = "#f9e2af" +green = "#a6e3a1" +teal = "#94e2d5" +sky = "#89dceb" +sapphire = "#74c7ec" +blue = "#89b4fa" +lavender = "#b4befe" +text = "#cdd6f4" +subtext1 = "#bac2de" +subtext0 = "#a6adc8" +overlay2 = "#9399b2" +overlay1 = "#7f849c" +overlay0 = "#6c7086" +surface2 = "#585b70" +surface1 = "#45475a" +surface0 = "#313244" +base = "#1e1e2e" +mantle = "#181825" +crust = "#11111b" + +# You can also replace your username with a neat symbol like  or disable this +# and use the os module below +[username] +show_always = false +style_user = "bg:crust" +style_root = "bg:mantle" +format = "[$user]($style) in " +disabled = false + +[os] +style = "bg:mantle" +disabled = false + +[directory] +style = "bg:lavender fg:base" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" + +# Here is how you can shorten some long paths by text replacement +# similar to mapped_locations in Oh My Posh: +[directory.substitutions] +"Documents" = "󰈙 " +"Downloads" = " " +"Music" = " " +"Pictures" = " " +# Keep in mind that the order matters. For example: +# "Important Documents" = " 󰈙 " +# will not be replaced, because "Documents" was already substituted before. +# So either put "Important Documents" before "Documents" or use the substituted version: +# "Important 󰈙 " = " 󰈙 " + +[c] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[docker_context] +symbol = " " +style = "bg:#06969A" +format = '[ $symbol $context ]($style)' + +[elixir] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[elm] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[git_branch] +symbol = " " +style = "bg:blue fg:base" +format = '[ $symbol $branch ]($style)' + +[git_status] +style = "bg:blue fg:base" +format = '[$all_status$ahead_behind ]($style)' + +[golang] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[gradle] +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[haskell] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[java] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[julia] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[nodejs] +symbol = "" +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[nim] +symbol = "󰆥 " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[rust] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[scala] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[time] +disabled = false +time_format = "%R" # Hour:Minute Format +style = "bg:#33658A" +format = '[ $time ]($style)' diff --git a/starter.nix b/starter.nix new file mode 100644 index 0000000..adc92a0 --- /dev/null +++ b/starter.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + imports = [ ]; +} diff --git a/terminal/shell.nix b/terminal/shell.nix index 1505738..13b4c70 100644 --- a/terminal/shell.nix +++ b/terminal/shell.nix @@ -1,10 +1,6 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - starship - ]; - programs = { bash = { # Starts the OS using Bash, then starts fish if it's not running @@ -17,43 +13,12 @@ ''; }; - fish.enable = true; - - starship = { + fish = { enable = true; - settings = { - palette = "catppuccin-mocha"; - palettes = { - catppuccin-mocha = { - rosewater = "#f5e0dc"; - flamingo = "#f2cdcd"; - pink = "#f5c2e7"; - mauve = "#f5c2e7"; - red = "#f38ba8"; - maroon = "#eba0ac"; - peach = "#fab387"; - yellow = "#f9e2af"; - green = "#a6e3a1"; - teal = "#94e2d5"; - sky = "#89dceb"; - sapphire = "#89dceb"; - blue = "#89dceb"; - lavender = "#b4befe"; - text = "#cdd6f4"; - subtext1 = "#cdd6f4"; - subtext0 = "#a6adc8"; - overlay2 = "#9399b2"; - overlay1 = "#7f849c"; - overlay0 = "#6c7086"; - surface2 = "#585b70"; - surface1 = "#45475a"; - surface0 = "#313244"; - base = "#1e1e2e"; - mantle = "#181825"; - crust = "#11111b"; - }; - }; - }; + # Start starship when creating a new shell + interactiveShellInit = '' + starship init fish | source + ''; }; }; }