commit 5c0ad5d6347caf6041abe8ebf5dbbd51f32e6d28 Author: m3tam3re Date: Sun Oct 20 00:30:58 2024 +0200 here we go diff --git a/.webui_secret_key b/.webui_secret_key new file mode 100644 index 0000000..e75db1e --- /dev/null +++ b/.webui_secret_key @@ -0,0 +1 @@ +nsbiTxOUmVxZGmgl \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dd43f27 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "dotfiles": { + "flake": false, + "locked": { + "lastModified": 1728910889, + "narHash": "sha256-B/fb+7SKVxK9j851SgR4Nljd6EtE1DzqwLh6yOvkQOY=", + "ref": "refs/heads/master", + "rev": "360c75b2cbce800ebaf9445266e2fe345bf582bf", + "revCount": 53, + "type": "git", + "url": "https://code.m3tam3re.com/m3tam3re/dotfiles.git" + }, + "original": { + "type": "git", + "url": "https://code.m3tam3re.com/m3tam3re/dotfiles.git" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726817922, + "narHash": "sha256-gO91NgBTTbVHBlvnn6g6XFeXzJquBH5MrVhYMFTnB0Q=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f48b181f0161db6246a1bd1b05d70a7b3a87ab41", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726463316, + "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1726447378, + "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dotfiles": "dotfiles", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6bec904 --- /dev/null +++ b/flake.nix @@ -0,0 +1,68 @@ +{ + description = '' + For questions just DM me on X: https://twitter.com/@m3tam3re + There is also some NIXOS content on my YT channel: https://www.youtube.com/@m3tam3re + + One of the best ways to learn NIXOS is to read other peoples configurations. I have personally learned a lot from Gabriel Fontes configs: + https://github.com/Misterio77/nix-starter-configs + https://github.com/Misterio77/nix-config + + Please also check out the starter configs mentioned above. + ''; + + inputs = { + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; + + dotfiles = { + url = "git+https://code.m3tam3re.com/m3tam3re/dotfiles.git"; + flake = false; + }; + }; + + outputs = { + self, + dotfiles, + home-manager, + nixpkgs, + ... + } @ inputs: let + inherit (self) outputs; + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in { + packages = + forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + overlays = import ./overlays {inherit inputs;}; + homeManagerModules = import ./modules/home-manager; + nixosConfigurations = { + m3-kratos = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + hostname = "m3-kratos"; + }; + modules = [./hosts/m3-kratos]; + }; + }; + homeConfigurations = { + "m3tam3re@m3-kratos" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs = { + inherit inputs outputs; + hostname = "m3-kratos"; + }; + modules = [./home/m3tam3re/m3tam3re.nix]; + }; + }; + }; +} diff --git a/home/common/default.nix b/home/common/default.nix new file mode 100644 index 0000000..cdb6f25 --- /dev/null +++ b/home/common/default.nix @@ -0,0 +1,45 @@ +{ + lib, + outputs, + pkgs, + ... +}: { + imports = [ + (import + ../../modules/home-manager/zellij-ps.nix) + ]; #imports = builtins.attrValues outputs.homeManagerModules; + 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.stable-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; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + nix = { + package = lib.mkDefault pkgs.nix; + settings = { + experimental-features = ["nix-command" "flakes"]; + warn-dirty = false; + }; + }; +} diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix new file mode 100644 index 0000000..6c7d6c2 --- /dev/null +++ b/home/features/cli/default.nix @@ -0,0 +1,81 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./fish.nix + ./fzf.nix + ./neofetch.nix + ./secrets.nix + ./starship.nix + ./zellij.nix + ]; + + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withNodeJs = true; + withPython3 = true; + }; + + programs.bat = {enable = true;}; + + programs.eza = { + enable = true; + enableFishIntegration = true; + enableBashIntegration = true; + extraOptions = ["-l" "--icons" "--git" "-a"]; + }; + + programs.lf = { + enable = true; + settings = { + preview = true; + drawbox = true; + hidden = true; + icons = true; + theme = "Dracula"; + previewer = "bat"; + }; + }; + + home.packages = with pkgs; [ + alejandra + bc + comma + coreutils + devenv + direnv + fabric-ai + fd + gcc + go + htop + httpie + jq + just + lf + lazygit + nix-index + procs + progress + ripgrep + tldr + trash-cli + unimatrix + unzip + wttrbar + yazi + zellij-ps + zip + ]; +} diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix new file mode 100644 index 0000000..8e11f99 --- /dev/null +++ b/home/features/cli/fish.nix @@ -0,0 +1,74 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.cli.fish; +in { + options.features.cli.fish.enable = mkEnableOption "enable fish shell"; + + config = mkIf cfg.enable { + programs.fish = { + enable = true; + loginShellInit = '' + set -x NIX_PATH nixpkgs=channel:nixos-unstable + set -x NIX_LOG info + set -x WEBKIT_DISABLE_COMPOSITING_MODE 1 + set -x TERMINAL kitty + set -x EDITOR nvim + set -x VISUAL zed + set -x XDG_DATA_HOME $HOME/.local/share + set -x FZF_CTRL_R_OPTS " + --preview='bat --color=always -n {}' + --preview-window up:3:hidden:wrap + --bind 'ctrl-/:toggle-preview' + --bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort' + --color header:bold + --header 'Press CTRL-Y to copy command into clipboard'" + set -x FZF_DEFAULT_COMMAND fd --type f --exclude .git --follow --hidden + set -x FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND" + set -x FLAKE $HOME/m3-kratos + + if test (tty) = "/dev/tty1" + exec Hyprland &> /dev/null + end + ''; + shellAbbrs = { + ".." = "cd .."; + "..." = "cd ../.."; + b = "yazi"; + ls = "eza"; + l = "eza -l --icons --git -a"; + lt = "eza --tree --level=2 --long --icons --git"; + grep = "rg"; + ps = "procs"; + just = "just --unstable"; + fs = "du -ah . | sort -hr | head -n 10"; + + n = "nix"; + nd = "nix develop -c $SHELL"; + ns = "nix shell"; + nsn = "nix shell nixpkgs#"; + nb = "nix build"; + nbn = "nix build nixpkgs#"; + nf = "nix flake"; + + nr = "sudo nixos-rebuild --flake ."; + nrs = "sudo nixos-rebuild switch --flake .#(uname -n)"; + snr = "sudo nixos-rebuild --flake ."; + snrs = "sudo nixos-rebuild --flake . switch"; + hm = "home-manager --flake ."; + hms = "home-manager --flake . switch"; + hmr = "cd ~/projects/nix-configurations; nix flake lock --update-input dotfiles; home-manager --flake .#(whoami)@(hostname) switch"; + + tsu = "sudo tailscale up"; + tsd = "sudo tailscale down"; + + vi = "nvim"; + vim = "nvim"; + }; + }; + }; +} diff --git a/home/features/cli/fzf.nix b/home/features/cli/fzf.nix new file mode 100644 index 0000000..7f8ea2f --- /dev/null +++ b/home/features/cli/fzf.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.features.cli.fzf; +in { + options.features.cli.fzf.enable = mkEnableOption "enable fuzzy finder"; + + config = mkIf cfg.enable { + programs.fzf = { + enable = true; + enableFishIntegration = true; + colors = { + "fg" = "#f8f8f2"; + "bg" = "#282a36"; + "hl" = "#bd93f9"; + "fg+" = "#f8f8f2"; + "bg+" = "#44475a"; + "hl+" = "#bd93f9"; + "info" = "#ffb86c"; + "prompt" = "#50fa7b"; + "pointer" = "#ff79c6"; + "marker" = "#ff79c6"; + "spinner" = "#ffb86c"; + "header" = "#6272a4"; + }; + defaultOptions = [ + "--preview='bat --color=always -n {}'" + "--bind 'ctrl-/:toggle-preview'" + ]; + defaultCommand = "fd --type f --exclude .git --follow --hidden"; + changeDirWidgetCommand = "fd --type d --exclude .git --follow --hidden"; + }; + }; +} diff --git a/home/features/cli/neofetch.nix b/home/features/cli/neofetch.nix new file mode 100644 index 0000000..e4123da --- /dev/null +++ b/home/features/cli/neofetch.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.cli.neofetch; +in { + options.features.cli.neofetch.enable = mkEnableOption "enable neofetch"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [neofetch]; + }; +} diff --git a/home/features/cli/secrets.nix b/home/features/cli/secrets.nix new file mode 100644 index 0000000..df4ca6f --- /dev/null +++ b/home/features/cli/secrets.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.cli.secrets; +in { + options.features.cli.secrets.enable = mkEnableOption "enable secrets"; + + config = mkIf cfg.enable { + programs.password-store = { + enable = true; + package = + pkgs.pass-wayland.withExtensions + (exts: [exts.pass-otp exts.pass-import]); + }; + home.packages = with pkgs; [pinentry]; + }; +} diff --git a/home/features/cli/starship.nix b/home/features/cli/starship.nix new file mode 100644 index 0000000..23366f4 --- /dev/null +++ b/home/features/cli/starship.nix @@ -0,0 +1,17 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.features.cli.starship; +in { + options.features.cli.starship.enable = mkEnableOption "enable starship prompt"; + + config = mkIf cfg.enable { + programs.starship = { + enable = true; + enableFishIntegration = true; + }; + }; +} diff --git a/home/features/cli/zellij.nix b/home/features/cli/zellij.nix new file mode 100644 index 0000000..903ee04 --- /dev/null +++ b/home/features/cli/zellij.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.features.cli.zellij; +in { + options.features.cli.zellij.enable = mkEnableOption "enable tmux"; + + config = mkIf cfg.enable { + programs.zellij = { + enable = true; + }; + }; +} diff --git a/home/features/coding/default.nix b/home/features/coding/default.nix new file mode 100644 index 0000000..fa6af8d --- /dev/null +++ b/home/features/coding/default.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + nixd + alejandra + ]; +} diff --git a/home/features/desktop/coding.nix b/home/features/desktop/coding.nix new file mode 100644 index 0000000..b9dd67e --- /dev/null +++ b/home/features/desktop/coding.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = with pkgs; [bruno zed-editor]; +} diff --git a/home/features/desktop/default.nix b/home/features/desktop/default.nix new file mode 100644 index 0000000..ffd361d --- /dev/null +++ b/home/features/desktop/default.nix @@ -0,0 +1,127 @@ +{pkgs, ...}: { + imports = [ + ./coding.nix + ./fonts.nix + ./gaming.nix + ./hyprland.nix + ./media.nix + ./office.nix + ./rofi.nix + ./theme.nix + ./wayland.nix + ./wofi.nix + ]; + + xdg = { + enable = true; + configFile."mimeapps.list".force = true; + mimeApps = { + enable = true; + associations.added = { + "application/zip" = ["org.gnome.FileRoller.desktop"]; + "application/csv" = ["calc.desktop"]; + "application/pdf" = ["okularApplication_pdf.desktop"]; + }; + defaultApplications = { + "application/zip" = ["org.gnome.FileRoller.desktop"]; + "application/csv" = ["calc.desktop"]; + "application/pdf" = ["okularApplication_pdf.desktop"]; + "application/md" = ["nvim.desktop"]; + "application/text" = ["nvim.desktop"]; + "x-scheme-handler/http" = ["io.github.zen_browser.zen"]; + "x-scheme-handler/https" = ["io.github.zen_browser.zen"]; + }; + }; + userDirs = { + enable = true; + createDirectories = true; + }; + }; + + home.sessionVariables = { + WEBKIT_DISABLE_COMPOSITING_MODE = "1"; + NIXOS_OZONE_WL = "1"; + TERMINAL = "kitty"; + QT_QPA_PLATFORM = "wayland"; + }; + home.sessionPath = ["\${XDG_BIN_HOME}" "\${HOME}/.cargo/bin" "$HOME/.npm-global/bin"]; + + fonts.fontconfig.enable = true; + + services.mako = { + enable = true; + backgroundColor = "#282a36"; + textColor = "#80FFEA"; + borderColor = "#9742b5"; + width = 400; + height = 150; + padding = "10,20"; + borderRadius = 8; + borderSize = 1; + margin = "20,20"; + }; + + programs.kitty = { + enable = true; + shellIntegration = { + enableFishIntegration = true; + enableBashIntegration = true; + }; + font = {name = "Fira Code";}; + themeFile = "Dracula"; + settings = {copy_on_select = "yes";}; + }; + + home.pointerCursor = { + gtk.enable = true; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + size = 20; + }; + + home.packages = with pkgs; [ + appimage-run + anytype + # blueberry + brave + # brightnessctl + # clipman + distrobox + # eww + # firefox-devedition + file-roller + seahorse + sushi + # glib + # google-chrome + # gsettings-desktop-schemas + # graphviz + hyprpaper + # ksnip + nwg-look + # pamixer + # pavucontrol + # libsForQt5.qtstyleplugins + # stable.nyxt + # pcmanfm + protonmail-desktop + # qt5ct + # qt6.qtwayland + #rustdesk + # socat + # unrar + # unzip + # usbutils + # v4l-utils + remmina + slack + telegram-desktop + ungoogled-chromium + # wl-clipboard + # wlogout + # wtype + # xdg-utils + # ydotool + # zip + ]; +} diff --git a/home/features/desktop/fonts.nix b/home/features/desktop/fonts.nix new file mode 100644 index 0000000..5953cf0 --- /dev/null +++ b/home/features/desktop/fonts.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.desktop.fonts; +in { + options.features.desktop.fonts.enable = + mkEnableOption "install additional fonts for desktop apps"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + fira-code + fira-code-symbols + fira-code-nerdfont + font-manager + font-awesome_5 + noto-fonts + ]; + }; +} diff --git a/home/features/desktop/gaming.nix b/home/features/desktop/gaming.nix new file mode 100644 index 0000000..65eb01a --- /dev/null +++ b/home/features/desktop/gaming.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.desktop.gaming; +in { + options.features.desktop.gaming.enable = + mkEnableOption "install gaming related stuff"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + goverlay + mangohud + protonup-ng + ]; + }; +} diff --git a/home/features/desktop/hyprland.nix b/home/features/desktop/hyprland.nix new file mode 100644 index 0000000..95c371d --- /dev/null +++ b/home/features/desktop/hyprland.nix @@ -0,0 +1,181 @@ +{ + wayland.windowManager.hyprland = { + settings = { + xwayland = { + force_zero_scaling = true; + }; + + exec-once = [ + "waybar" + "hyprpaper" + "hypridle" + "wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\"" + ]; + + env = [ + "XCURSOR_SIZE,32" + "WLR_NO_HARDWARE_CURSORS,1" + "GTK_THEME,Dracula" + ]; + + input = { + kb_layout = "de,us"; + kb_variant = ""; + kb_model = ""; + kb_rules = ""; + kb_options = "ctrl:nocaps"; + follow_mouse = 1; + }; + + general = { + gaps_in = 5; + gaps_out = 5; + border_size = 1; + "col.active_border" = "rgba(9742b5ee) rgba(9742b5ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + layout = "dwindle"; + }; + + decoration = { + "col.shadow" = "rgba(1E202966)"; + drop_shadow = true; + shadow_range = 60; + shadow_offset = "1 2"; + shadow_render_power = 3; + shadow_scale = 0.97; + rounding = 8; + blur = { + enabled = true; + size = 3; + passes = 3; + }; + active_opacity = 0.9; + inactive_opacity = 0.5; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master = { + new_status = "master"; + }; + + gestures = { + workspace_swipe = false; + }; + + device = [ + { + name = "epic-mouse-v1"; + sensitivity = -0.5; + } + { + name = "zsa-technology-labs-moonlander-mark-i"; + kb_layout = "us"; + } + { + name = "keychron-keychron-k7"; + kb_layout = "us"; + } + ]; + windowrule = [ + "float, file_progress" + "float, confirm" + "float, dialog" + "float, download" + "float, notification" + "float, error" + "float, splash" + "float, confirmreset" + "float, title:Open File" + "float, title:branchdialog" + "float, Lxappearance" + "float, Wofi" + "float, dunst" + "animation none,Wofi" + "float,viewnior" + "float,feh" + "float, pavucontrol-qt" + "float, pavucontrol" + "float, file-roller" + "fullscreen, wlogout" + "float, title:wlogout" + "fullscreen, title:wlogout" + "idleinhibit focus, mpv" + "idleinhibit fullscreen, firefox" + "float, title:^(Media viewer)$" + "float, title:^(Volume Control)$" + "float, title:^(Picture-in-Picture)$" + "size 800 600, title:^(Volume Control)$" + "move 75 44%, title:^(Volume Control)$" + ]; + + "$mainMod" = "SUPER"; + + bind = [ + "$mainMod, return, exec, kitty -e zellij-ps" + "$mainMod, t, exec, kitty -e fish -c 'neofetch; exec fish'" + "$mainMod SHIFT, e, exec, kitty -e zellij_nvim" + "$mainMod, o, exec, hyprctl setprop activewindow opaque toggle" + "$mainMod, b, exec, thunar" + "$mainMod, Escape, exec, wlogout -p layer-shell" + "$mainMod, Space, togglefloating" + "$mainMod, q, killactive" + "$mainMod, M, exit" + "$mainMod, F, fullscreen" + "$mainMod, V, togglefloating" + "$mainMod, D, exec, rofi -show" + "$mainMod SHIFT, S, exec, bemoji" + "$mainMod, P, exec, rofi-pass" + "$mainMod SHIFT, P, pseudo" + "$mainMod, J, togglesplit" + "$mainMod, h, movefocus, l" + "$mainMod, l, movefocus, r" + "$mainMod, k, movefocus, u" + "$mainMod, j, movefocus, d" + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + "$mainMod SHIFT, 0, movetoworkspace, 10" + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/home/features/desktop/media.nix b/home/features/desktop/media.nix new file mode 100644 index 0000000..17608f8 --- /dev/null +++ b/home/features/desktop/media.nix @@ -0,0 +1,51 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.desktop.media; +in { + options.features.desktop.media.enable = + mkEnableOption "enable media features"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + # handbrake + # kdePackages.kdenlive + # makemkv + # mediainfo + amf + blueberry + ffmpeg_6-full + gst_all_1.gstreamer + gst_all_1.gst-vaapi + kdePackages.kdenlive + mpv + pamixer + pavucontrol + qpwgraph + v4l-utils + # plexamp + # spotify + # uxplay + # vlc + # webcord + # yt-dlp + # unimatrix + ]; + + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + input-overlay + obs-gstreamer + obs-vertical-canvas + obs-vaapi + obs-vkcapture + wlrobs + ]; + }; + }; +} diff --git a/home/features/desktop/office.nix b/home/features/desktop/office.nix new file mode 100644 index 0000000..0eddd32 --- /dev/null +++ b/home/features/desktop/office.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.desktop.office; +in { + options.features.desktop.office.enable = + mkEnableOption "install office and paperwork stuff"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + libreoffice-fresh + ]; + }; +} diff --git a/home/features/desktop/rofi.nix b/home/features/desktop/rofi.nix new file mode 100644 index 0000000..eaf8154 --- /dev/null +++ b/home/features/desktop/rofi.nix @@ -0,0 +1,38 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.features.desktop.rofi; +in { + options.features.desktop.rofi.enable = mkEnableOption "enable rofi"; + + config = mkIf cfg.enable { + programs.rofi = with pkgs; { + enable = true; + package = rofi.override { + plugins = [ + rofi-calc + rofi-emoji + rofi-file-browser + ]; + }; + pass = { + enable = true; + package = rofi-pass-wayland; + }; + terminal = "\${pkgs.kitty}/bin/kitty"; + font = "Fira Code"; + extraConfig = { + show-icons = true; + disable-history = false; + modi = "drun,calc,emoji,filebrowser"; + kb-primary-paste = "Control+V,Shift+Insert"; + kb-secondary-paste = "Control+v,Insert"; + }; + theme = "dracula"; + }; + }; +} diff --git a/home/features/desktop/theme.nix b/home/features/desktop/theme.nix new file mode 100644 index 0000000..6f1190c --- /dev/null +++ b/home/features/desktop/theme.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + qt = { + enable = true; + platformTheme.name = "gtk"; + }; + gtk = { + enable = true; + theme = { + name = "Dracula"; + package = pkgs.dracula-theme; + }; + iconTheme = { + name = "Dracula"; + package = pkgs.dracula-icon-theme; + }; + }; +} diff --git a/home/features/desktop/wayland.nix b/home/features/desktop/wayland.nix new file mode 100644 index 0000000..e15b511 --- /dev/null +++ b/home/features/desktop/wayland.nix @@ -0,0 +1,284 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.features.desktop.wayland; +in { + options.features.desktop.wayland.enable = mkEnableOption "wayland extra tools and config"; + + config = mkIf cfg.enable { + programs.waybar = { + enable = true; + style = '' + @define-color background-darker rgba(30, 31, 41, 230); + @define-color background #282a36; + @define-color selection #44475a; + @define-color foreground #f8f8f2; + @define-color comment #6272a4; + @define-color cyan #8be9fd; + @define-color green #50fa7b; + @define-color orange #ffb86c; + @define-color pink #ff79c6; + @define-color purple #bd93f9; + @define-color red #ff5555; + @define-color yellow #f1fa8c; + + * { + border: none; + border-radius: 0; + font-family: FiraCode Nerd Font; + font-weight: bold; + font-size: 14px; + min-height: 0; + } + + window#waybar { + background: rgba(21, 18, 27, 0); + color: #cdd6f4; + } + + tooltip { + background: #1e1e2e; + border-radius: 10px; + border-width: 2px; + border-style: solid; + border-color: #11111b; + } + + #workspaces button { + padding: 5px; + color: #313244; + margin-right: 5px; + } + + #workspaces button.active { + color: #11111b; + background: #a6e3a1; + border-radius: 10px; + } + + #workspaces button.focused { + color: #a6adc8; + background: #eba0ac; + border-radius: 10px; + } + + #workspaces button.urgent { + color: #11111b; + background: #a6e3a1; + border-radius: 10px; + } + + #workspaces button:hover { + background: #11111b; + color: #cdd6f4; + border-radius: 10px; + } + + #custom-language, + #custom-updates, + #custom-caffeine, + #custom-weather, + #window, + #clock, + #battery, + #pulseaudio, + #network, + #workspaces, + #tray, + #backlight { + background: #1e1e2e; + padding: 0px 10px; + margin: 3px 0px; + margin-top: 10px; + border: 1px solid #181825; + } + + #tray { + border-radius: 10px; + margin-right: 10px; + } + + #workspaces { + background: #1e1e2e; + border-radius: 10px; + margin-left: 10px; + padding-right: 0px; + padding-left: 5px; + } + + #custom-caffeine { + color: #89dceb; + border-radius: 10px 0px 0px 10px; + border-right: 0px; + margin-left: 10px; + } + + #custom-language { + color: #f38ba8; + border-left: 0px; + border-right: 0px; + } + + #custom-updates { + color: #f5c2e7; + border-left: 0px; + border-right: 0px; + } + + #window { + border-radius: 10px; + margin-left: 60px; + margin-right: 60px; + } + + #clock { + color: #fab387; + border-radius: 10px 0px 0px 10px; + margin-left: 0px; + border-right: 0px; + } + + #network { + color: #f9e2af; + border-left: 0px; + border-right: 0px; + } + + #pulseaudio { + color: #89b4fa; + border-left: 0px; + border-right: 0px; + } + + #pulseaudio.microphone { + color: #cba6f7; + border-left: 0px; + border-right: 0px; + } + + #battery { + color: #a6e3a1; + border-radius: 0 10px 10px 0; + margin-right: 10px; + border-left: 0px; + } + + #custom-weather { + border-radius: 0px 10px 10px 0px; + border-right: 0px; + margin-left: 0px; + } + ''; + settings = { + mainbar = { + layer = "top"; + position = "top"; + mod = "dock"; + exclusive = true; + passthrough = false; + gtk-layer-shell = true; + height = 0; + modules-left = ["clock" "custom/weather" "hyprland/workspaces"]; + modules-center = ["hyprland/window"]; + modules-right = [ + "tray" + "custom/language" + "battery" + "backlight" + "pulseaudio" + "pulseaudio#microphone" + ]; + + "hyprland/window" = { + format = "👉 {}"; + seperate-outputs = true; + }; + "hyprland/workspaces" = { + disable-scroll = true; + all-outputs = true; + on-click = "activate"; + format = " {name} {icon} "; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + "6" = ""; + "7" = ""; + }; + persistent_workspaces = { + "1" = []; + "2" = []; + "3" = []; + "4" = []; + }; + }; + "custom/weather" = { + format = "{}°C"; + tooltip = true; + interval = 3600; + exec = "wttrbar --location Pockau-Lengefeld"; + return-type = "json"; + }; + tray = { + icon-size = 13; + spacing = 10; + }; + clock = { + format = " {:%R  %d/%m}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + }; + pulseaudio = { + format = "{icon} {volume}%"; + tooltip = false; + format-muted = " Muted"; + on-click = "pamixer -t"; + on-scroll-up = "pamixer -i 5"; + on-scroll-down = "pamixer -d 5"; + scroll-step = 5; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + }; + "pulseaudio#microphone" = { + format = "{format_source}"; + format-source = " {volume}%"; + format-source-muted = " Muted"; + on-click = "pamixer --default-source -t"; + on-scroll-up = "pamixer --default-source -i 5"; + on-scroll-down = "pamixer --default-source -d 5"; + scroll-step = 5; + }; + }; + }; + }; + + home.packages = with pkgs; [ + grim + hyprlock + qt6.qtwayland + slurp + waypipe + wl-clipboard + wf-recorder + wl-mirror + wl-clipboard + wlogout + wtype + ydotool + ]; + }; +} diff --git a/home/features/desktop/wofi.nix b/home/features/desktop/wofi.nix new file mode 100644 index 0000000..c8da548 --- /dev/null +++ b/home/features/desktop/wofi.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + wofi + bemoji + ]; +} diff --git a/home/m3tam3re/dotfiles/default.nix b/home/m3tam3re/dotfiles/default.nix new file mode 100644 index 0000000..3f3e7c1 --- /dev/null +++ b/home/m3tam3re/dotfiles/default.nix @@ -0,0 +1,26 @@ +{ + pkgs, + inputs, + ... +}: { + home.file.".config/bat" = { + source = "${inputs.dotfiles}/bat"; + recursive = true; + }; + home.file.".config/nyxt" = { + source = "${inputs.dotfiles}/nyxt"; + recursive = true; + }; + # home.file.".config/hypr" = { + # source = "${inputs.dotfiles}/hypr"; + # recursive = true; + # }; + home.file.".config/nvim" = { + source = "${inputs.dotfiles}/nvim"; + recursive = true; + }; + home.file.".config/zellij" = { + source = "${inputs.dotfiles}/zellij"; + recursive = true; + }; +} diff --git a/home/m3tam3re/home.nix b/home/m3tam3re/home.nix new file mode 100644 index 0000000..6df5604 --- /dev/null +++ b/home/m3tam3re/home.nix @@ -0,0 +1,115 @@ +# This is a default home.nix generated by the follwing hone-manager command +# +# home-manager init ./ +{ + config, + lib, + pkgs, + ... +}: { + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = lib.mkDefault "your-name"; + home.homeDirectory = lib.mkDefault "/home/${config.home.username}"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/m3tam3re/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.git = { + enable = true; + userName = "m3tam3re"; + userEmail = "m@m3tam3re.com"; + aliases = {st = "status";}; + extraConfig = { + core.excludesfile = "~/.gitignore_global"; + init.defaultBranch = "master"; + }; + }; + programs.zellij-ps = { + enable = true; + projectFolders = [ + "${config.home.homeDirectory}/p/c" + "${config.home.homeDirectory}/p" + "${config.home.homeDirectory}/.config" + ]; + layout = '' + layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane size="70%" command="nvim" + pane split_direction="vertical" { + pane + pane command="unimatrix" + } + pane size=1 borderless=true { + plugin location="zellij:status-bar" + } + } + ''; + }; +} diff --git a/home/m3tam3re/m3-kratos.nix b/home/m3tam3re/m3-kratos.nix new file mode 100644 index 0000000..1f14094 --- /dev/null +++ b/home/m3tam3re/m3-kratos.nix @@ -0,0 +1,74 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.features.desktop.hyprland; +in { + imports = [ + ../common + ./dotfiles + ./home.nix + ../features/cli + ../features/coding + ../features/desktop + ./services/librechat.nix + ]; + + options.features.desktop.hyprland.enable = + mkEnableOption "enable Hyprland"; + + config = mkMerge [ + # Base configuration + { + features = { + cli = { + fish.enable = true; + fzf.enable = true; + neofetch.enable = true; + secrets.enable = true; + starship.enable = true; + }; + desktop = { + gaming.enable = true; + hyprland.enable = true; + media.enable = true; + office.enable = true; + rofi.enable = true; + fonts.enable = true; + wayland.enable = true; + }; + }; + } + + (mkIf cfg.enable { + wayland.windowManager.hyprland = { + enable = true; + settings = { + monitor = [ + "DP-1,2560x1440@144,0x0,1" + "DP-2,2560x1440@144,2560x0,1" + ]; + workspace = [ + "1, monitor:DP-1, default:true" + "2, monitor:DP-1" + "3, monitor:DP-1" + "4, monitor:DP-2" + "5, monitor:DP-1" + "6, monitor:DP-2" + "7, monitor:DP-2" + ]; + + windowrulev2 = [ + "workspace 1,class:dev.zed.Zed" + "workspace 2,class:(com.obsproject.Studio)" + "workspace 4,opacity 1.0, class:(chromium-browser)" + "workspace 4,opacity 1.0, class:(zen-alpha)" + ]; + }; + }; + }) + ]; +} diff --git a/home/m3tam3re/services/librechat.nix b/home/m3tam3re/services/librechat.nix new file mode 100644 index 0000000..ba544a3 --- /dev/null +++ b/home/m3tam3re/services/librechat.nix @@ -0,0 +1,18 @@ +{ + systemd.user.services.librechat = { + Unit = { + Description = "LibreChat Start"; + After = ["network-online.target"]; + Wants = ["network-online.target"]; + }; + Install = {WantedBy = ["default.target"];}; + Service = { + Type = "oneshot"; + RemainAfterExit = "yes"; + WorkingDirectory = "/home/m3tam3re/p/r/ai/LibreChat"; + ExecStart = "/run/current-system/sw/bin/podman-compose up -d"; + ExecStop = "/run/current-system/sw/bin/podman-compose down"; + Restart = "on-failure"; + }; + }; +} diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..7895a62 --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,64 @@ +# Common configuration for all hosts +{ + config, + pkgs, + lib, + inputs, + outputs, + ... +}: { + imports = [ + ./extraServices + ./users + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + useUserPackages = true; + extraSpecialArgs = {inherit inputs outputs;}; + }; + 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.stable-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; + }; + }; + + nix = { + settings = { + experimental-features = "nix-command flakes"; + trusted-users = [ + "root" + "m3tam3re" + ]; # Set users that are allowed to use the flake command + }; + gc = { + automatic = true; + options = "--delete-older-than 30d"; + }; + optimise.automatic = true; + registry = + (lib.mapAttrs (_: flake: {inherit flake;})) + ((lib.filterAttrs (_: lib.isType "flake")) inputs); + nixPath = ["/etc/nix/path"]; + }; + users.defaultUserShell = pkgs.fish; +} diff --git a/hosts/common/extraServices/default.nix b/hosts/common/extraServices/default.nix new file mode 100644 index 0000000..25c54e2 --- /dev/null +++ b/hosts/common/extraServices/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./flatpak.nix + ./podman.nix + ./ollama.nix + ./virtualisation.nix + ]; +} diff --git a/hosts/common/extraServices/flatpak.nix b/hosts/common/extraServices/flatpak.nix new file mode 100644 index 0000000..b7ac4c5 --- /dev/null +++ b/hosts/common/extraServices/flatpak.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.extraServices.flatpak; +in { + options.extraServices.flatpak.enable = mkEnableOption "enable podman"; + + config = mkIf cfg.enable { + services.flatpak.enable = true; + xdg.portal = { + # xdg desktop intergration (required for flatpak) + enable = true; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + }; + }; +} diff --git a/hosts/common/extraServices/ollama.nix b/hosts/common/extraServices/ollama.nix new file mode 100644 index 0000000..b8b8ac7 --- /dev/null +++ b/hosts/common/extraServices/ollama.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.extraServices.ollama; +in { + options.extraServices.ollama.enable = mkEnableOption "enable ollama"; + + config = mkIf cfg.enable { + services.ollama = { + enable = true; + acceleration = + if config.services.xserver.videoDrivers == ["amdgpu"] + then "rocm" + else if config.services.xserver.videoDrivers == ["nvidia"] + then "cuda" + else null; + host = "[::]"; + openFirewall = true; + }; + }; +} diff --git a/hosts/common/extraServices/podman.nix b/hosts/common/extraServices/podman.nix new file mode 100644 index 0000000..d3fc4f0 --- /dev/null +++ b/hosts/common/extraServices/podman.nix @@ -0,0 +1,32 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.extraServices.podman; +in { + options.extraServices.podman.enable = mkEnableOption "enable podman"; + + config = mkIf cfg.enable { + virtualisation = { + podman = { + enable = true; + dockerCompat = true; + autoPrune = { + enable = true; + dates = "weekly"; + flags = [ + "--filter=until=24h" + "--filter=label!=important" + ]; + }; + defaultNetwork.settings.dns_enabled = true; + }; + }; + environment.systemPackages = with pkgs; [ + podman-compose + ]; + }; +} diff --git a/hosts/common/extraServices/virtualisation.nix b/hosts/common/extraServices/virtualisation.nix new file mode 100644 index 0000000..15be7e9 --- /dev/null +++ b/hosts/common/extraServices/virtualisation.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.extraServices.virtualisation; +in { + options.extraServices.virtualisation.enable = mkEnableOption "enable virtualisation"; + + config = mkIf cfg.enable { + virtualisation = { + libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + ovmf = { + enable = true; + packages = [ + (pkgs.OVMF.override { + secureBoot = true; + tpmSupport = true; + }) + .fd + ]; + }; + }; + }; + }; + programs.virt-manager.enable = true; + environment.systemPackages = with pkgs; [ + OVMFFull + ]; + }; +} diff --git a/hosts/common/users/default.nix b/hosts/common/users/default.nix new file mode 100644 index 0000000..61a283f --- /dev/null +++ b/hosts/common/users/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./m3tam3re.nix]; +} diff --git a/hosts/common/users/m3tam3re.nix b/hosts/common/users/m3tam3re.nix new file mode 100644 index 0000000..2f3eeab --- /dev/null +++ b/hosts/common/users/m3tam3re.nix @@ -0,0 +1,31 @@ +{ + config, + pkgs, + inputs, + ... +}: { + users.users.m3tam3re = { + #initialHashedPassword = "$y$j9T$IoChbWGYRh.rKfmm0G86X0$bYgsWqDRkvX.EBzJTX.Z0RsTlwspADpvEF3QErNyCMC"; + password = "12345"; + isNormalUser = true; + description = "m3tam3re"; + extraGroups = [ + "wheel" + "networkmanager" + "libvirtd" + "flatpak" + "audio" + "video" + "plugdev" + "input" + "kvm" + "qemu-libvirtd" + ]; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3YEmpYbM+cpmyD10tzNRHEn526Z3LJOzYpWEKdJg8DaYyPbDn9iyVX30Nja2SrW4Wadws0Y8DW+Urs25/wVB6mKl7jgPJVkMi5hfobu3XAz8gwSdjDzRSWJrhjynuaXiTtRYED2INbvjLuxx3X8coNwMw58OuUuw5kNJp5aS2qFmHEYQErQsGT4MNqESe3jvTP27Z5pSneBj45LmGK+RcaSnJe7hG+KRtjuhjI7RdzMeDCX73SfUsal+rHeuEw/mmjYmiIItXhFTDn8ZvVwpBKv7xsJG90DkaX2vaTk0wgJdMnpVIuIRBa4EkmMWOQ3bMLGkLQeK/4FUkNcvQ/4+zcZsg4cY9Q7Fj55DD41hAUdF6SYODtn5qMPsTCnJz44glHt/oseKXMSd556NIw2HOvihbJW7Rwl4OEjGaO/dF4nUw4c9tHWmMn9dLslAVpUuZOb7ykgP0jk79ldT3Dv+2Hj0CdAWT2cJAdFX58KQ9jUPT3tBnObSF1lGMI7t77VU= m3tam3re@m3-nix" + ]; + packages = [inputs.home-manager.packages.${pkgs.system}.default]; + }; + home-manager.users.m3tam3re = + import ../../../home/m3tam3re/${config.networking.hostName}.nix; +} diff --git a/hosts/m3-kratos/configuration.nix b/hosts/m3-kratos/configuration.nix new file mode 100644 index 0000000..349fa88 --- /dev/null +++ b/hosts/m3-kratos/configuration.nix @@ -0,0 +1,118 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). +{pkgs, ...}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.supportedFilesystems = ["zfs"]; + boot.zfs.package = pkgs.zfs_unstable; + boot.zfs.forceImportAll = true; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.kernelModules = ["amdgpu"]; + + services.xserver.videoDrivers = ["amdgpu"]; + security.polkit.enable = true; + networking.hostName = "m3-kratos"; # Define your hostname. + networking.hostId = "458bd616"; + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = + true; # Easiest to use and most distros use this by default. + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # hardware.pulseaudio.enable = true; + # OR + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [neovim git]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.fstrim.enable = true; + + services.zfs.autoSnapshot.enable = true; + services.zfs.autoScrub.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.11"; # Did you read the comment? +} diff --git a/hosts/m3-kratos/default.nix b/hosts/m3-kratos/default.nix new file mode 100644 index 0000000..1b09c02 --- /dev/null +++ b/hosts/m3-kratos/default.nix @@ -0,0 +1,50 @@ +# A staring point is the basic NIXOS configuration generated by the ISO installer. +# On an existing NIXOS install you can use the following command in your flakes basedir: +# sudo nixos-generate-config --dir ./hosts/m3tam3re +# +# Please make sure to change the first couple of lines in your configuration.nix: +# { config, inputs, ouputs, lib, pkgs, ... }: +# +# { +# imports = [ # Include the results of the hardware scan. +# ./hardware-configuration.nix +# inputs.home-manager.nixosModules.home-manager +# ]; +# ... +# +# Moreover please update the packages option in your user configuration and add the home-manager options: +# users.users = { +# m3tam3re = { +# isNormalUser = true; +# initialPassword = "12345"; +# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. +# packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; +# }; +# }; +# +# home-manager = { +# useUserPackages = true; +# extraSpecialArgs = { inherit inputs outputs; }; +# users.m3tam3re = +# import ../../home/m3tam3re/${config.networking.hostName}.nix; +# }; +# +# Please also change your hostname accordingly: +#:w +# networking.hostName = "nixos"; # Define your hostname. +{ + imports = [ + ../common + ./configuration.nix + ./hardware.nix + ./programs.nix + ./services + ]; + + extraServices = { + flatpak.enable = true; + ollama.enable = true; + podman.enable = true; + virtualisation.enable = true; + }; +} diff --git a/hosts/m3-kratos/hardware-configuration.nix b/hosts/m3-kratos/hardware-configuration.nix new file mode 100644 index 0000000..0b7e05f --- /dev/null +++ b/hosts/m3-kratos/hardware-configuration.nix @@ -0,0 +1,73 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "rpool/root"; + fsType = "zfs"; + }; + + fileSystems."/nix" = { + device = "rpool/nix"; + fsType = "zfs"; + }; + + fileSystems."/home" = { + device = "rpool/home"; + fsType = "zfs"; + }; + + fileSystems."/var" = { + device = "rpool/var"; + fsType = "zfs"; + }; + + fileSystems."/tmp" = { + device = "rpool/tmp"; + fsType = "zfs"; + }; + + fileSystems."/var/log" = { + device = "rpool/var/log"; + fsType = "zfs"; + }; + + fileSystems."/var/tmp" = { + device = "rpool/var/tmp"; + fsType = "zfs"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/2FE7-15B4"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + + swapDevices = []; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.enp16s0u1u4u5.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp11s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/m3-kratos/hardware.nix b/hosts/m3-kratos/hardware.nix new file mode 100644 index 0000000..163c091 --- /dev/null +++ b/hosts/m3-kratos/hardware.nix @@ -0,0 +1,7 @@ +{ + hardware = { + bluetooth.enable = true; + keyboard.zsa.enable = true; + graphics.enable = true; + }; +} diff --git a/hosts/m3-kratos/programs.nix b/hosts/m3-kratos/programs.nix new file mode 100644 index 0000000..6ee08d6 --- /dev/null +++ b/hosts/m3-kratos/programs.nix @@ -0,0 +1,33 @@ +{pkgs, ...}: { + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs + # here, NOT in environment.systemPackages + ]; + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; + programs.fish.enable = true; + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [thunar-archive-plugin thunar-volman]; + }; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryPackage = pkgs.pinentry-gnome3; + settings = {default-cache-ttl = 10800;}; + }; + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "/home/m3tam3re/m3-kratos"; + }; +} diff --git a/hosts/m3-kratos/services/containers/default.nix b/hosts/m3-kratos/services/containers/default.nix new file mode 100644 index 0000000..f7e9be4 --- /dev/null +++ b/hosts/m3-kratos/services/containers/default.nix @@ -0,0 +1,4 @@ +{ + imports = [ + ]; +} diff --git a/hosts/m3-kratos/services/default.nix b/hosts/m3-kratos/services/default.nix new file mode 100644 index 0000000..e38a8c3 --- /dev/null +++ b/hosts/m3-kratos/services/default.nix @@ -0,0 +1,30 @@ +{ + imports = [ + ./containers + ./n8n.nix + ./sound.nix + ./udev.nix + ]; + services = { + hypridle.enable = true; + printing.enable = true; + gvfs.enable = true; + trezord.enable = true; + gnome.gnome-keyring.enable = true; + avahi = { + enable = true; + nssmdns4 = true; + publish = { + addresses = true; + workstation = true; + userServices = true; + }; + }; + }; + systemd.sleep.extraConfig = '' + AllowSuspend=no + AllowHibernation=no + AllowHybridSleep=no + AllowSuspendThenHibernate=no + ''; +} diff --git a/hosts/m3-kratos/services/n8n.nix b/hosts/m3-kratos/services/n8n.nix new file mode 100644 index 0000000..3751aaa --- /dev/null +++ b/hosts/m3-kratos/services/n8n.nix @@ -0,0 +1,11 @@ +{ + services.n8n = { + enable = true; + openFirewall = true; + }; + systemd.services.n8n = { + environment = { + N8N_SECURE_COOKIE = "false"; + }; + }; +} diff --git a/hosts/m3-kratos/services/sound.nix b/hosts/m3-kratos/services/sound.nix new file mode 100644 index 0000000..44e0d96 --- /dev/null +++ b/hosts/m3-kratos/services/sound.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + speechd + ]; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = false; + wireplumber.enable = true; + }; +} diff --git a/hosts/m3-kratos/services/udev.nix b/hosts/m3-kratos/services/udev.nix new file mode 100644 index 0000000..19ceb22 --- /dev/null +++ b/hosts/m3-kratos/services/udev.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + services.udev.extraRules = '' + SUBSYSTEM=="usb", MODE="0666 + ''; + environment.systemPackages = with pkgs; [ + zsa-udev-rules + ]; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..cee0ec6 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,3 @@ +{ + zellij-ps = import ./zellij-ps.nix; +} diff --git a/modules/home-manager/zellij-ps.nix b/modules/home-manager/zellij-ps.nix new file mode 100644 index 0000000..39b9e60 --- /dev/null +++ b/modules/home-manager/zellij-ps.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.programs.zellij-ps; +in { + options = { + programs.zellij-ps = { + enable = mkEnableOption "Zellij Project Selector"; + projectFolders = lib.mkOption { + type = lib.types.listOf lib.types.path; + description = "List of project folders for zellij-ps."; + default = ["${config.home.homeDirectory}/projects"]; + }; + layout = lib.mkOption { + type = lib.types.str; + description = "Layout for zellij"; + default = '' + layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane split_direction="vertical" { + pane + pane command="htop" + } + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } + ''; + }; + }; + }; + config = mkIf cfg.enable { + home.packages = [pkgs.zellij-ps]; + home.sessionVariables.PROJECT_FOLDERS = lib.concatStringsSep ":" cfg.projectFolders; + home.file.".config/zellij/layouts/zellij-ps.kdl".text = cfg.layout; + }; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..d34485b --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,18 @@ +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs {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: { + n8n = import ./mods/n8n.nix {inherit prev;}; + }; + + stable-packages = final: _prev: { + stable = import inputs.nixpkgs-stable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/overlays/mods/n8n.nix b/overlays/mods/n8n.nix new file mode 100644 index 0000000..f43f4c0 --- /dev/null +++ b/overlays/mods/n8n.nix @@ -0,0 +1,17 @@ +{prev}: +prev.n8n.overrideAttrs (oldAttrs: rec { + pname = oldAttrs.pname; + version = "1.63.0"; + + src = prev.fetchFromGitHub { + owner = "n8n-io"; + repo = "n8n"; + rev = "n8n@${version}"; + hash = "sha256-zJHveCbBPJs8qbgCsU+dgucoXpAKa7PVLH4tfdcJZlE="; + }; + + pnpmDeps = prev.pnpm.fetchDeps { + inherit pname version src; + hash = "sha256-FsBA/QENfreCJnYCw8MnX5W2D+WJ3DUuTIakH78TYU8="; + }; +}) diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..321a739 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,4 @@ +{pkgs, ...}: { + # Define your custom packages here + zellij-ps = pkgs.callPackage ./zellij-ps {}; +} diff --git a/pkgs/zellij-ps/default.nix b/pkgs/zellij-ps/default.nix new file mode 100644 index 0000000..357ed1d --- /dev/null +++ b/pkgs/zellij-ps/default.nix @@ -0,0 +1,41 @@ +{ + lib, + stdenv, + fetchFromGitea, + fish, + fd, + fzf, + makeWrapper, + zellij, +}: +with lib; + stdenv.mkDerivation { + pname = "zellij-ps"; + version = "0.1.0"; + + src = fetchFromGitea { + domain = "code.m3tam3re.com"; + owner = "m3tam3re"; + repo = "helper-scripts"; + rev = "08a3217b83391c1110545c1ee3161eecd5dbe5e9"; + sha256 = "1sc4i58mwcg3qsq0wwl5rvk08ykbxc497bq7mrxiirndsarskby7"; + }; + + buildInputs = []; + + nativeBuildInputs = [makeWrapper]; + installPhase = '' + mkdir -p $out/bin + cp zellij-ps.fish $out/bin/zellij-ps + wrapProgram $out/bin/zellij-ps \ + --prefix PATH : ${lib.makeBinPath [fish fd fzf zellij]} + ''; + + meta = with lib; { + description = "A small project script for zellij"; + homepage = "https://code.m3tam3re.com/m3tam3re/helper-scripts"; + license = licenses.mit; + maintainers = with maintainers; [m3tam3re]; + platforms = platforms.unix; + }; + }