diff --git a/alacritty.nix b/alacritty.nix deleted file mode 100644 index 183a335..0000000 --- a/alacritty.nix +++ /dev/null @@ -1,5 +0,0 @@ -{enable}: { - inherit enable; - settings.font.size = 14.0; - settings.window.opacity = 0.8; -} diff --git a/flake.lock b/flake.lock index 8dfe48e..bcbabd2 100644 --- a/flake.lock +++ b/flake.lock @@ -110,6 +110,38 @@ "type": "github" } }, + "nixpkgs-master": { + "locked": { + "lastModified": 1690803489, + "narHash": "sha256-TqdStgF+EA+kJ8PzVjOxa8HdM684CmZZz2ohlKq9j4A=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0d117d7ad5d590991d23ccc7bd88c4e627cccf17", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1690640159, + "narHash": "sha256-5DZUYnkeMOsVb/eqPYb9zns5YsnQXRJRC8Xx/nPMcno=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e6ab46982debeab9831236869539a507f670a129", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1689956312, @@ -162,6 +194,8 @@ "home-manager": "home-manager", "hyprland": "hyprland", "nixpkgs": "nixpkgs_2", + "nixpkgs-master": "nixpkgs-master", + "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur", "zig": "zig" } diff --git a/flake.nix b/flake.nix index 04d6d9f..1419fb7 100644 --- a/flake.nix +++ b/flake.nix @@ -2,25 +2,29 @@ description = "Home Manager configuration of kristian"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = github:nixos/nixpkgs/nixos-23.05; + nixpkgs-unstable.url = github:nixos/nixpkgs/nixos-unstable; + nixpkgs-master.url = github:nixos/nixpkgs/master; home-manager = { - url = "github:nix-community/home-manager/release-23.05"; + url = github:nix-community/home-manager/release-23.05; inputs.nixpkgs.follows = "nixpkgs"; }; # Hyprland Window Manager - hyprland.url = "github:hyprwm/Hyprland"; + hyprland.url = github:hyprwm/Hyprland; # Nix User Repository - nur.url = "github:nix-community/NUR"; + nur.url = github:nix-community/NUR; # Zig - zig.url = "github:mitchellh/zig-overlay"; + zig.url = github:mitchellh/zig-overlay; }; outputs = { self, nixpkgs, + nixpkgs-unstable, + nixpkgs-master, home-manager, hyprland, nur, @@ -30,23 +34,39 @@ pkgs = nixpkgs.legacyPackages.${system}; in { formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + homeConfigurations = { kristian = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ - ./home.nix - - { - nixpkgs.overlays = [ - hyprland.overlays.default # Adds waybar-hyprland - zig.overlays.default - ]; - } + ./home hyprland.homeManagerModules.default nur.nixosModules.nur + + { + nixpkgs.overlays = [ + hyprland.overlays.default # Adds waybar-hyprland + zig.overlays.default # Adds zig + ( # https://github.com/nix-community/home-manager/issues/1538#issuecomment-706627100 + final: prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config = {allowUnfreePredicate = _: true;}; + }; + #master = import inputs.nixpkgs-master { + # system = final.system; + # config = {allowUnfreePredicate = (_: true);}; + #}; + } + ) + ( # Overrides davinci-resolve with the unstable version because of https://github.com/NixOS/nixpkgs/pull/246074 + final: prev: {davinci-resolve = final.unstable.davinci-resolve;} + ) + ]; + } ]; }; }; diff --git a/home.nix b/home.nix deleted file mode 100644 index 18fdf99..0000000 --- a/home.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ - config, - pkgs, - lib, - options, - specialArgs, - modulesPath, -}: { - nixpkgs.config.allowUnfreePredicate = _: true; - - home.stateVersion = "23.05"; - home.username = "kristian"; - home.homeDirectory = "/home/kristian"; - - # For cursor not showing in hyprland with nvidia - home.sessionVariables.WLR_NO_HARDWARE_CURSORS = "1"; - - # Symlinks - home.file = { - ".wallpaper".source = ./wallpaper; # Wallpaper - #"Media".source = config.lib.file.mkOutOfStoreSymlink "/mnt/Media"; - #"Documents".source = config.lib.file.mkOutOfStoreSymlink "/mnt/Documents"; - }; - - # TODO: Change for Laptop - targets.genericLinux.enable = false; # Enable on non-nixos ditros - - # Keyboard Layout - home.keyboard.layout = "at"; # NOTE: Set by Hyprland config - - # Programs (additional programs) - home.packages = import ./packages.nix {inherit pkgs;}; - - ## Services - services.copyq.enable = true; - services.playerctld.enable = true; # for mpris waybar module - - # Programs - programs = { - home-manager.enable = true; # Allow home-manager to manage itself - wofi.enable = true; - mpv.enable = true; - obs-studio.enable = true; - zathura.enable = true; - yt-dlp.enable = true; - lf.enable = true; - vscode.enable = true; - bashmount.enable = true; - - bash = import ./bash.nix {enable = true;}; - alacritty = import ./alacritty.nix {enable = true;}; - neovim = import ./nvim { - enable = true; - pkgs = pkgs; - }; - firefox = import ./firefox.nix { - enable = true; - nur = config.nur; - }; - waybar = import ./waybar.nix { - enable = true; - pkgs = pkgs; - }; - git = import ./git.nix {enable = true;}; - thunderbird = import ./thunderbird.nix {enable = true;}; - }; - - xdg.mimeApps = { - enable = true; - defaultApplications = {"video/*" = ["mpv.desktop"];}; - }; - - systemd.user.mounts = let - home = "home-kristian"; - in { - "${home}-Documents" = { - Unit = { - Description = "Mount Documents"; - After = ["graphical.target "]; - Wants = ["graphical.target"]; - }; - Install = {WantedBy = ["default.target"];}; - Mount = { - What = "kristian@krsnik.at:/mnt/TITAN/Documents"; - Where = "/home/kristian/Documents"; - Type = "fuse.sshfs"; - Options = "_netdev,reconnect,ServerAliveInterval=30,ServerAliveCountMax=5,x-systemd.automount"; - TimeoutSec = 60; - }; - }; - "${home}-Media" = { - Unit = { - Description = "Mount Media"; - After = ["graphical.target "]; - Wants = ["graphical.target"]; - }; - Install = {WantedBy = ["default.target"];}; - Mount = { - What = "kristian@krsnik.at:/mnt/TITAN/Media"; - Where = "/home/kristian/Media"; - Type = "fuse.sshfs"; - Options = "_netdev,reconnect,ServerAliveInterval=30,ServerAliveCountMax=5,x-systemd.automount"; - TimeoutSec = 60; - }; - }; - }; - - wayland.windowManager.hyprland = import ./hyprland.nix {enable = true;}; -} diff --git a/bash.nix b/home/bash.nix similarity index 100% rename from bash.nix rename to home/bash.nix diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..2b61702 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,69 @@ +{ + config, + pkgs, + lib, + options, + specialArgs, + modulesPath, +}: { + nixpkgs.config.allowUnfreePredicate = _: true; + + home.stateVersion = "23.05"; + home.username = "kristian"; + home.homeDirectory = "/home/kristian"; + + home.sessionVariables = { + # Electron programms won't render correctly under wayland without this + NIXOS_OZONE_WL = 1; + }; + + # Symlinks + home.file = { + ".wallpaper".source = ./wallpaper; + }; + + # TODO: Change for Laptop + targets.genericLinux.enable = false; # Enable on non-nixos ditros + + # Keyboard Layout + home.keyboard.layout = "at"; # NOTE: Set by Hyprland config + + # Programs (additional programs) + home.packages = import ./packages.nix {inherit pkgs;}; + + # Services + services = { + copyq.enable = true; + }; + + # Programs + programs = { + home-manager.enable = true; # Allow home-manager to manage itself + mpv.enable = true; + obs-studio.enable = true; + yt-dlp.enable = true; + + bash = import ./bash.nix {enable = true;}; + vscode = import ./vscode.nix {enable = true;}; + git = import ./git.nix {enable = true;}; + thunderbird = import ./thunderbird.nix {enable = true;}; + + neovim = import ./nvim { + enable = true; + inherit pkgs; + }; + + firefox = import ./firefox.nix { + enable = true; + nur = config.nur; + }; + }; + + xdg.mimeApps = { + enable = true; + defaultApplications = {"video/*" = ["mpv.desktop"];}; + }; + + # Gnome settings + dconf.settings = import ./gnome.nix {inherit lib;}; +} diff --git a/firefox.nix b/home/firefox.nix similarity index 100% rename from firefox.nix rename to home/firefox.nix diff --git a/git.nix b/home/git.nix similarity index 100% rename from git.nix rename to home/git.nix diff --git a/home/gnome.nix b/home/gnome.nix new file mode 100644 index 0000000..8d0f600 --- /dev/null +++ b/home/gnome.nix @@ -0,0 +1,36 @@ +{lib}: { + # Use `dconf watch /` to track stateful changes you are doing, then set them here. + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + "org/gnome/desktop/background" = { + picture-uri = "file:///home/kristian/.wallpaper"; + picture-uri-dark = "file:///home/kristian/.wallpaper"; + }; + "org/gnome/desktop/wm/keybindings" = { + switch-to-workspace-left = ["1"]; + switch-to-workspace-right = ["2"]; + move-to-workspace-left = ["1"]; + move-to-workspace-right = ["2"]; + }; + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = "a"; + command = "kgx"; + name = "Console"; + }; + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { + binding = "f"; + command = "nautilus"; + name = "File Manager"; + }; + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" + ]; + }; + "org/gnome/mutter" = { + edge-tiling = true; + dynamic-workspaces = true; + }; +} diff --git a/nvim/cmp.lua b/home/nvim/cmp.lua similarity index 100% rename from nvim/cmp.lua rename to home/nvim/cmp.lua diff --git a/nvim/colors.lua b/home/nvim/colors.lua similarity index 100% rename from nvim/colors.lua rename to home/nvim/colors.lua diff --git a/nvim/default.nix b/home/nvim/default.nix similarity index 100% rename from nvim/default.nix rename to home/nvim/default.nix diff --git a/nvim/fugitive.lua b/home/nvim/fugitive.lua similarity index 100% rename from nvim/fugitive.lua rename to home/nvim/fugitive.lua diff --git a/nvim/keybinds.lua b/home/nvim/keybinds.lua similarity index 100% rename from nvim/keybinds.lua rename to home/nvim/keybinds.lua diff --git a/nvim/lspconfig.lua b/home/nvim/lspconfig.lua similarity index 100% rename from nvim/lspconfig.lua rename to home/nvim/lspconfig.lua diff --git a/nvim/telescope.lua b/home/nvim/telescope.lua similarity index 100% rename from nvim/telescope.lua rename to home/nvim/telescope.lua diff --git a/nvim/treesitter.lua b/home/nvim/treesitter.lua similarity index 100% rename from nvim/treesitter.lua rename to home/nvim/treesitter.lua diff --git a/nvim/undotree.lua b/home/nvim/undotree.lua similarity index 100% rename from nvim/undotree.lua rename to home/nvim/undotree.lua diff --git a/home/packages.nix b/home/packages.nix new file mode 100644 index 0000000..f57d4d1 --- /dev/null +++ b/home/packages.nix @@ -0,0 +1,27 @@ +{pkgs}: +with pkgs; [ + # Basic utils + unzip + magic-wormhole + + # Important graphical applications + keepassxc + logseq + xournalpp + onlyoffice-bin + + # Communication + discord + telegram-desktop + signal-desktop + element-desktop + + # Video Editor + davinci-resolve + + # LaTeX Editor + setzer + + # Misc + nerdfonts # Font with glyphs for status bar +] diff --git a/thunderbird.nix b/home/thunderbird.nix similarity index 100% rename from thunderbird.nix rename to home/thunderbird.nix diff --git a/home/vscode.nix b/home/vscode.nix new file mode 100644 index 0000000..42b5462 --- /dev/null +++ b/home/vscode.nix @@ -0,0 +1,11 @@ +{enable}: { + inherit enable; + enableUpdateCheck = false; + keybindings = [ + { + key = "alt+a"; + command = "editor.action.commentLine"; + when = "editorTextFocus && !editorReadonly"; + } + ]; +} diff --git a/home/wallpaper b/home/wallpaper new file mode 100644 index 0000000..5fbc6bc Binary files /dev/null and b/home/wallpaper differ diff --git a/hyprland.nix b/hyprland.nix deleted file mode 100644 index 5c64ac2..0000000 --- a/hyprland.nix +++ /dev/null @@ -1,90 +0,0 @@ -{enable}: { - inherit enable; - xwayland.enable = true; - extraConfig = '' - # Waybar - exec-once = waybar - - # Notifications Daemon - exec-once = dunst & - - # Wallpaper - exec-once = swww init - exec-once = swww img ~/.wallpaper --transition-step 255 - - # Clipboard - exec-once = copyq --start-server - - # Window Rules - windowrulev2 = float,title:(CopyQ)$ - windowrulev2 = float,title:^(Volume Control)$ - - # Keybinds - $Mod = Alt - $altMod = SUPER - - bind = $Mod, D, exec, wofi --show drun - bind = $Mod, Return, exec, alacritty - bind = $Mod, V, exec, copyq - bind = $Mod, S, exec, grim -g "$(slurp)" - bind = $Mod SHIFT, C, exec, copyq show - - bind = $Mod, C, killactive, - bind = $Mod CONTROL SHIFT, K, exit, - bind = $Mod, M, togglefloating - bind = $Mod, F, fullscreen, 1 # maximize - bind = $Mod SHIFT, F, fullscreen, 0 # fullscreen - bind = $Mod, P, pseudo - - # Move focus with mainMod + arrow keys - bind = $Mod, h, movefocus, l - bind = $Mod, j, movefocus, d - bind = $Mod, k, movefocus, u - bind = $Mod, l, movefocus, r - - bind = $Mod SHIFT, h, swapwindow, l - bind = $Mod SHIFT, j, swapwindow, d - bind = $Mod SHIFT, k, swapwindow, u - bind = $Mod SHIFT, l, swapwindow, r - - bind = $Mod , Tab, cyclenext, prev - bind = $Mod SHIFT, Tab, cyclenext, - - # Layouting - bind = $Mod , Space, togglegroup, - bind = $altMod , Tab , changegroupactive, forward - bind = $altMod SHIFT, Tab , changegroupactive, back - - bind = $altMod, h, moveintogroup, l - bind = $altMod, j, moveintogroup, d - bind = $altMod, k, moveintogroup, u - bind = $altMod, l, moveintogroup, r - - bind = $altMod SHIFT, h, moveoutofgroup, l - bind = $altMod SHIFT, j, moveoutofgroup, d - bind = $altMod SHIFT, k, moveoutofgroup, u - bind = $altMod SHIFT, l, moveoutofgroup, r - - # Switch workspaces - bind = $Mod, 1, workspace, -1 - bind = $Mod, 2, workspace, +1 - - # Move active window to a workspace - bind = $Mod SHIFT, 1, movetoworkspace, -1 - bind = $Mod SHIFT, 2, movetoworkspace, +1 - - # Scroll through existing workspaces - bind = $Mod, mouse_up, workspace, -1 - bind = $Mod, mouse_down, workspace, +1 - - # Move/resize windows - bindm = $Mod, mouse:272, movewindow - bindm = $Mod, mouse:273, resizewindow - - # TODO: renameworkspace with dmenu or rofi prompt - - input { - kb_layout = at - } - ''; -} diff --git a/packages.nix b/packages.nix deleted file mode 100644 index c4bae28..0000000 --- a/packages.nix +++ /dev/null @@ -1,48 +0,0 @@ -{pkgs}: -with pkgs; [ - # Basic utils - unzip - magic-wormhole - wl-clipboard # vim clipboard access - - # Audio - pulseaudio - pulsemixer - pavucontrol - - # Important graphical applications - keepassxc - logseq - xournalpp - onlyoffice-bin - - # Communication - discord - telegram-desktop - signal-desktop - element-desktop - - # For Hyprland - libsForQt5.polkit-kde-agent # For permission pop-ups - libsForQt5.qt5.qtwayland - qt6.qtwayland - dunst # Notifications - swww # Wallpaper - grim - slurp # Screenshots - - # Video Editor - # davinci-resolve # Currently borken. Fixed in https://github.com/NixOS/nixpkgs/pull/242751 - - # LaTeX Editor - setzer - - gnome.nautilus - - steam - - # Misc - nerdfonts # Font with glyphs for status bar - - zigpkgs.master # latest nightly release of zig -] diff --git a/wallpaper b/wallpaper deleted file mode 100644 index fdca91c..0000000 Binary files a/wallpaper and /dev/null differ diff --git a/waybar.nix b/waybar.nix deleted file mode 100644 index 915fac4..0000000 --- a/waybar.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ - pkgs, - enable, -}: { - inherit enable; - package = pkgs.waybar-hyprland; - settings = { - mainBar = { - layer = "top"; - height = 30; - - modules-left = ["wlr/workspaces"]; - modules-center = ["clock"]; - modules-right = ["pulseaudio" "memory" "cpu" "tray"]; - - "hyprland/workspaces" = { - format = "{icon}"; - on-click = "activate"; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - #format-icons = { - # "1" = ""; - # "2" = ""; - # "3" = ""; - # "4" = ""; - # "5" = ""; - # urgent = ""; - # active = ""; - # default = ""; - #}; - sort-by-number = true; - }; - - "wlr/window" = { - max-length = 50; - }; - - mpris = { - format = "DEFAULT: {player_icon} {dynamic}"; - format-paused = "DEFAULT: {status_icon} {dynamic}"; - player-icons = { - default = "▶"; - mpv = "🎵"; - }; - status-icons = { - paused = "⏸"; - }; - }; - - pulseaudio = { - format = "{volume}% {icon}"; - format-bluetooth = " {volume}% {icon}"; - format-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = ["" ""]; - }; - scroll-step = 1; - on-click = "pavucontrol"; - ignored-sinks = ["Easy Effects Sink"]; - }; - - cpu = { - interval = 10; - format = " {load}% {icon}"; - format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]; - }; - - memory = { - interval = 30; - format = " {used:0.1f}G / {total:0.1f}G"; - }; - - clock = { - # TODO: Fix that calendar width is too small - format = "{:%H:%M}  "; - format-alt = "{:%A, %B %d, %Y (%R)}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "year"; - mode-mon-col = 3; - weeks-pos = "right"; - on-scroll = 1; - on-click-right = "mode"; - format = { - months = "{}"; - days = "{}"; - weeks = "W{}"; - weekdays = "{}"; - today = "{}"; - }; - }; - actions = { - on-click-right = "mode"; - on-click-forward = "tz_up"; - on-click-backward = "tz_down"; - on-scroll-up = "shift_up"; - on-scroll-down = "shift_down"; - }; - }; - - tray = { - "icon-size" = 21; - "spacing" = 10; - }; - }; - }; -}