From a2e660782fc234ffd4b6424b6280291f81a4e9d5 Mon Sep 17 00:00:00 2001 From: fabricsoul Date: Tue, 25 Feb 2025 17:17:26 -0500 Subject: [PATCH] revert: use old flake --- README.md | 37 ++ flake.nix | 6 +- home/fabric/default.nix | 131 +++++++ home/fabric/desktop/hyprland.nix | 82 +++++ home/fabric/desktop/hyprpanel.nix | 63 ++++ home/fabric/programs/git.nix | 12 + home/fabric/programs/kitty.nix | 76 +++++ home/fabric/programs/nixvim.nix | 434 ++++++++++++++++++++++++ home/fabric/programs/tmux.nix | 32 ++ home/fabric/programs/zsh.nix | 33 ++ hosts/common/global/default.nix | 55 +++ hosts/common/global/locale.nix | 14 + hosts/common/optional/docker.nix | 4 + hosts/common/optional/nvidia.nix | 21 ++ hosts/common/optional/steam.nix | 4 + hosts/tatara/default.nix | 0 hosts/tatara/hardware-configuration.nix | 38 +++ hosts/zion/default.nix | 43 +++ hosts/zion/hardware-configuration.nix | 39 +++ rebuild.sh | 37 ++ 20 files changed, 1158 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 home/fabric/default.nix create mode 100644 home/fabric/desktop/hyprland.nix create mode 100644 home/fabric/desktop/hyprpanel.nix create mode 100644 home/fabric/programs/git.nix create mode 100644 home/fabric/programs/kitty.nix create mode 100644 home/fabric/programs/nixvim.nix create mode 100644 home/fabric/programs/tmux.nix create mode 100644 home/fabric/programs/zsh.nix create mode 100644 hosts/common/global/default.nix create mode 100644 hosts/common/global/locale.nix create mode 100644 hosts/common/optional/docker.nix create mode 100644 hosts/common/optional/nvidia.nix create mode 100644 hosts/common/optional/steam.nix create mode 100644 hosts/tatara/default.nix create mode 100644 hosts/tatara/hardware-configuration.nix create mode 100644 hosts/zion/default.nix create mode 100644 hosts/zion/hardware-configuration.nix create mode 100755 rebuild.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..e740013 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Project Structure + +``` +nixos-configs/ +├── flake.nix +├── .gitignore +├── hosts/ +│ ├── common/ +│ │ ├── global/ +│ │ │ ├── default.nix +│ │ │ ├── fonts.nix +│ │ │ └── locale.nix +│ │ └── optional/ +│ │ ├── nvidia.nix +│ │ ├── docker.nix +│ │ └── steam.nix +│ ├── tatara/ +│ │ ├── default.nix +│ │ └── hardware-configuration.nix +│ └── nix/ +│ ├── default.nix +│ └── hardware-configuration.nix +├── home/ +│ ├── fabric/ +│ │ ├── default.nix +│ │ ├── programs/ +│ │ │ ├── git.nix +│ │ │ ├── kitty.nix +│ │ │ ├── nixvim.nix +│ │ │ ├── tmux.nix +│ │ │ └── zsh.nix +│ │ └── desktop/ +│ │ ├── hyprland.nix +│ │ └── hyprpanel.nix +│ └── home.nix +``` + diff --git a/flake.nix b/flake.nix index 175d739..3ab9446 100644 --- a/flake.nix +++ b/flake.nix @@ -37,10 +37,10 @@ pkgsUnstable = nixpkgs-unstable.legacyPackages."x86_64-linux"; in { nixosConfigurations = { - Tatara = lib.nixosSystem { + zion = lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./configuration.nix + ./hosts/zion/default.nix ]; }; }; @@ -56,7 +56,7 @@ hyprpanel.overlay ]; } - ./home.nix + ./home/fabric/default.nix nixvim.homeManagerModules.nixvim hyprpanel.homeManagerModules.hyprpanel ]; diff --git a/home/fabric/default.nix b/home/fabric/default.nix new file mode 100644 index 0000000..55e7605 --- /dev/null +++ b/home/fabric/default.nix @@ -0,0 +1,131 @@ +{ + nixvim, + hyprpanel, + pkgs, + pkgsUnstable, + config, + ... +}: { + imports = [ + # Import program configurations + ./programs/git.nix + ./programs/kitty.nix + ./programs/nixvim.nix + ./programs/tmux.nix + ./programs/zsh.nix + + # Import desktop configurations + ./desktop/hyprland.nix + # ./desktop/hyprpanel.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should manage + home.username = "fabric"; + home.homeDirectory = "/home/fabric"; + home.stateVersion = "24.11"; + + # Session variables + home.sessionVariables = { + EDITOR = "nvim"; + SHELL = "zsh"; + NIXOS_OZONE_WL = "1"; + }; + + # Common packages used across your system + home.packages = with pkgs; [ + git + kitty + firefox + mpv + nerdfonts + tmux + discord + fzf + yazi + zsh + pavucontrol + wofi + deno + hyprpanel + alejandra + rustup + tmuxPlugins.sensible + tmuxPlugins.vim-tmux-navigator + tmuxPlugins.onedark-theme + nodePackages.prettier + nodePackages.tailwindcss + prettierd + nodejs_23 + qbittorrent + go + gccgo14 + hypridle + dprint + code-cursor + delve + ldtk + libresprite + ]; + + # Wayland settings for hyprpanel + wayland.windowManager.hyprland.settings = { + exec-once = [ + "${pkgs.hyprpanel}/bin/hyprpanel" + ]; + }; + + programs.hyprpanel = { + # Enable the module. + enable = true; + + # Add to Hyprland config + hyprland.enable = true; + + # Fix the overwrite issue + overwrite.enable = false; + + # Import a theme + theme = "rose_pine_moon_split"; + + # Configure bar layouts for monitors + layout = { + "bar.layouts" = { + "0" = { + left = ["dashboard" "workspaces" "windowtitle"]; + middle = ["clock"]; + right = ["volume" "network" "bluetooth" "systray" "media" "notifications"]; + }; + }; + }; + + # Configure and theme options + settings = { + bar.launcher.autoDetectIcon = true; + bar.workspaces.show_icons = true; + + menus.clock = { + time = { + military = true; + hideSeconds = false; + }; + weather.unit = "metric"; + }; + + menus.dashboard.directories.enabled = false; + menus.dashboard.stats.enable_gpu = true; + + theme.bar.transparent = false; + + theme.font = { + name = "CaskaydiaCove NF"; + size = "16px"; + }; + }; + }; + + # Enable home-manager + programs.home-manager.enable = true; + + # Enable font configuration + fonts.fontconfig.enable = true; +} diff --git a/home/fabric/desktop/hyprland.nix b/home/fabric/desktop/hyprland.nix new file mode 100644 index 0000000..c6fe5fe --- /dev/null +++ b/home/fabric/desktop/hyprland.nix @@ -0,0 +1,82 @@ +# home/fabric/desktop/hyprland.nix +{ + config, + pkgs, + ... +}: { + wayland.windowManager.hyprland = { + enable = true; + settings = { + "$mainMod" = "SUPER"; + "$terminal" = "kitty"; + "$fileManager " = "dolphin"; + "$menu" = "wofi --show drun"; + + general = { + gaps_in = 0; + gaps_out = "0, 600, 0, 600"; + }; + + input = { + "repeat_delay" = 300; + "repeat_rate" = 50; + }; + + exec-once = [ + # "hypridle" + ]; + + windowrule = [ + "workspace 6 silent,^(discord)$" + "workspace 4 silent,^(kitty)$" + "workspace 5 silent,^(firefox)$" + ]; + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = [ + "$mainMod, T, exec, $terminal" + "$mainMod, Q, killactive" + "$mainMod, M, exit" + "$mainMod, E, exec, $fileManager" + "$mainMod, V, togglefloating" + "$mainMod, SPACE, exec, $menu" + # "$mainMod, P, pseudo" # dwindle + # "$mainMod, J, togglesplit" # dwindle + + # Move focus with mainMod + arrow keys + "$mainMod, H, movefocus, l" + "$mainMod, L, movefocus, r" + "$mainMod, K, movefocus, u" + "$mainMod, J, movefocus, d" + + # Switch workspaces with mainMod + [0-9] + "$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" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$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" + ]; + # monitor = [ + # "DP-3,preferred,auto,1,workspace=1,addreserved,200,200,0,0" + # ]; + }; + }; + home.sessionVariables.NIXOS_OZONE_WL = "1"; +} diff --git a/home/fabric/desktop/hyprpanel.nix b/home/fabric/desktop/hyprpanel.nix new file mode 100644 index 0000000..22ea3bd --- /dev/null +++ b/home/fabric/desktop/hyprpanel.nix @@ -0,0 +1,63 @@ +# home/fabric/desktop/hyprpanel.nix +{ + config, + pkgs, + lib, + ... +}: { + wayland.windowManager.hyprland.settings = { + exec-once = [ + "${pkgs.hyprpanel}/bin/hyprpanel" + ]; + }; + + # Changed from 'programs.hyprpanel' to just 'hyprpanel' + hyprpanel = { + # Enable the module. + enable = true; + + # Add to Hyprland config + hyprland.enable = true; + + # Fix the overwrite issue + overwrite.enable = false; + + # Import a theme + theme = "rose_pine_moon_split"; + + # Configure bar layouts for monitors + layout = { + "bar.layouts" = { + "0" = { + left = ["dashboard" "workspaces" "windowtitle"]; + middle = ["clock"]; + right = ["volume" "network" "bluetooth" "systray" "media" "notifications"]; + }; + }; + }; + + # Configure and theme options + settings = { + bar.launcher.autoDetectIcon = true; + bar.workspaces.show_icons = true; + + menus.clock = { + time = { + military = true; + hideSeconds = false; + }; + weather.unit = "metric"; + }; + + menus.dashboard.directories.enabled = false; + menus.dashboard.stats.enable_gpu = true; + + theme.bar.transparent = false; + + theme.font = { + name = "CaskaydiaCove NF"; + size = "16px"; + }; + }; + }; +} diff --git a/home/fabric/programs/git.nix b/home/fabric/programs/git.nix new file mode 100644 index 0000000..cb6d943 --- /dev/null +++ b/home/fabric/programs/git.nix @@ -0,0 +1,12 @@ +# home/fabric/programs/git.nix +{ + config, + pkgs, + ... +}: { + programs.git = { + enable = true; + userName = "FabricSoul"; + userEmail = "fabric.soul7@gmail.com"; + }; +} diff --git a/home/fabric/programs/kitty.nix b/home/fabric/programs/kitty.nix new file mode 100644 index 0000000..4539931 --- /dev/null +++ b/home/fabric/programs/kitty.nix @@ -0,0 +1,76 @@ +# home/fabric/programs/kitty.nix +{ + config, + pkgs, + ... +}: { + programs.kitty = { + enable = true; + settings = { + # Basic settings + enable_audio_bell = false; + font_family = "FiraCodeNerdFont"; + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + font_size = 11; + background_opacity = "0.80"; + confirm_os_window_close = 0; + + # Basic colors + foreground = "#CDD6F4"; + background = "#1E1E2E"; + selection_foreground = "#1E1E2E"; + selection_background = "#F5E0DC"; + + # Cursor colors + cursor = "#F5E0DC"; + cursor_text_color = "#1E1E2E"; + + # URL underline color + url_color = "#F5E0DC"; + + # Window border colors + active_border_color = "#B4BEFE"; + inactive_border_color = "#6C7086"; + bell_border_color = "#F9E2AF"; + + # OS Window titlebar colors + wayland_titlebar_color = "#1E1E2E"; + macos_titlebar_color = "#1E1E2E"; + + # Tab bar colors + active_tab_foreground = "#11111B"; + active_tab_background = "#CBA6F7"; + inactive_tab_foreground = "#CDD6F4"; + inactive_tab_background = "#181825"; + tab_bar_background = "#11111B"; + + # Mark colors + mark1_foreground = "#1E1E2E"; + mark1_background = "#B4BEFE"; + mark2_foreground = "#1E1E2E"; + mark2_background = "#CBA6F7"; + mark3_foreground = "#1E1E2E"; + mark3_background = "#74C7EC"; + + # The 16 terminal colors + color0 = "#45475A"; + color8 = "#585B70"; + color1 = "#F38BA8"; + color9 = "#F38BA8"; + color2 = "#A6E3A1"; + color10 = "#A6E3A1"; + color3 = "#F9E2AF"; + color11 = "#F9E2AF"; + color4 = "#89B4FA"; + color12 = "#89B4FA"; + color5 = "#F5C2E7"; + color13 = "#F5C2E7"; + color6 = "#94E2D5"; + color14 = "#94E2D5"; + color7 = "#BAC2DE"; + color15 = "#A6ADC8"; + }; + }; +} diff --git a/home/fabric/programs/nixvim.nix b/home/fabric/programs/nixvim.nix new file mode 100644 index 0000000..83bf4f3 --- /dev/null +++ b/home/fabric/programs/nixvim.nix @@ -0,0 +1,434 @@ +# home/fabric/programs/nixvim.nix +{ + config, + pkgs, + ... +}: { + programs.nixvim = { + enable = true; + plugins = { + cmp-dictionary.enable = true; + cmp-spell.enable = true; + toggleterm = { + enable = true; + }; + web-devicons.enable = true; + nix.enable = true; + bufferline.enable = true; + lualine.enable = true; + luasnip.enable = true; + yanky = { + enable = true; + settings = { + highlight.timer = 150; + }; + }; + ts-comments.enable = true; + telescope = { + enable = true; + keymaps = { + " " = { + action = "git_files"; + }; + }; + settings = { + defaults = { + file_ignore_patterns = [ + "^.git/" + "^.mypy_cache/" + "^__pycache__/" + "^output/" + "^data/" + "%.ipynb" + "^node_modules/" + "^.next/" + "%.env" + "%.env.local" + "%.env.development.local" + "%.env.test.local" + "%.env.production.local" + "^npm-debug.log" + "^yarn-debug.log" + "^yarn-error.log" + "^.vercel/" + "^.turbo/" + "^build/" + "^.DS_Store" + "^.tailwindcss/" + "^tailwind.config.js.backup" + "%.css.map" + "^styles/dist/" + ]; + }; + }; + }; + treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + auto_install = true; + ensure_installed = [ + "bash" + "c" + "diff" + "html" + "javascript" + "jsdoc" + "json" + "jsonc" + "lua" + "luadoc" + "luap" + "markdown" + "markdown_inline" + "printf" + "python" + "query" + "regex" + "toml" + "tsx" + "typescript" + "vim" + "vimdoc" + "xml" + "yaml" + ]; + }; + }; + snacks = { + enable = true; + }; + indent-blankline.enable = true; + harpoon = { + enable = true; + keymaps = { + addFile = "ha"; + toggleQuickMenu = ""; + navFile = { + "1" = "h;"; + "2" = "h,"; + "3" = "h."; + "4" = "hp"; + }; + }; + }; + yazi.enable = true; + gitsigns = { + enable = true; + settings = { + current_line_blame = true; + current_line_blame_opts = { + virt_text = true; + virt_text_pos = "eol"; + }; + signcolumn = true; + signs = { + add = { + text = "+"; + }; + change = { + text = "▎"; + }; + changedelete = { + text = "-"; + }; + delete = { + text = "-"; + }; + topdelete = { + text = "-"; + }; + untracked = { + text = "!"; + }; + }; + watch_gitdir = { + follow_files = true; + }; + }; + }; + conform-nvim = { + enable = true; + settings = { + formatters_by_ft = { + nix = ["alejandra"]; + markdown = ["dprint"]; + # Use prettierd first, fallback to prettier + javascript = { + __unkeyed-1 = "prettierd"; + __unkeyed-2 = "prettier"; + stop_after_first = true; + }; + typescript = { + __unkeyed-1 = "prettierd"; + __unkeyed-2 = "prettier"; + stop_after_first = true; + }; + javascriptreact = { + __unkeyed-1 = "prettierd"; + __unkeyed-2 = "prettier"; + stop_after_first = true; + }; + typescriptreact = { + __unkeyed-1 = "prettierd"; + __unkeyed-2 = "prettier"; + stop_after_first = true; + }; + css = ["prettier"]; + scss = ["prettier"]; + html = ["prettier"]; + json = ["prettier"]; + # Run on all files + "_" = ["trim_whitespace" "trim_newlines"]; + }; + format_on_save = { + timeout_ms = 500; + lsp_fallback = true; + }; + formatters = { + prettier = { + command = "prettier"; + args = [ + "--plugin=prettier-plugin-tailwindcss" + "--print-width=80" + "--tab-width=2" + "--use-tabs=false" + "--semi=true" + "--single-quote=false" + "--trailing-comma=es5" + "--bracket-spacing=true" + ]; + }; + # Optional: Add prettierd for faster formatting + prettierd = { + command = "prettierd"; + args = ["$FILENAME"]; + }; + }; + # Additional useful settings from the docs + log_level = "warn"; + notify_on_error = true; + notify_no_formatters = false; + }; + }; + which-key.enable = true; + undotree = { + enable = true; + }; + mini = { + enable = true; + modules = { + pairs.enable = true; + starter = { + enable = true; + header = '' + ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ + ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║ + ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║ + ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║ + ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║ + ''; + }; + surround = { + enable = true; + mappings = { + add = "gsa"; + delete = "gsd"; + find = "gsf"; + find_left = "gsF"; + highlight = "gsh"; + replace = "gsr"; + update_n_lines = "gsn"; + }; + }; + }; + }; + todo-comments.enable = true; + persistence.enable = true; + friendly-snippets.enable = true; + lsp = { + enable = true; + inlayHints = true; + servers = { + ts_ls.enable = true; + eslint.enable = true; + nil_ls.enable = true; + tailwindcss.enable = true; + gopls.enable = true; + rust_analyzer = { + enable = true; + installCargo = true; + installRustc = true; + installRustfmt = true; + }; + }; + }; + cmp = { + enable = true; + autoEnableSources = true; + settings = { + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + {name = "luasnip";} + {name = "dictionary";} + ]; + mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.confirm(), + [""] = cmp.mapping.confirm(), + }) + ''; + }; + }; + }; + tmux-navigator.enable = true; + vim-suda.enable = true; + }; + globals.mapleader = " "; + opts = { + relativenumber = true; + number = true; + tabstop = 2; + shiftwidth = 2; + expandtab = true; + autoindent = true; + wrap = false; + cursorline = true; + mouse = "a"; + clipboard = "unnamedplus"; + splitright = true; + splitbelow = true; + ignorecase = true; + smartcase = true; + termguicolors = true; + signcolumn = "yes"; + scrolloff = 12; + shada = "'1000,f1,<500,%"; + guicursor = ""; + colorcolumn = "80"; + }; + keymaps = [ + { + mode = "n"; + key = ""; + action = "h"; + options = { + desc = "Go to Left Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "j"; + options = { + desc = "Go to Lower Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "k"; + options = { + desc = "Go to Upper Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "l"; + options = { + desc = "Go to Right Window"; + remap = true; + }; + } + + # Window resizing + { + mode = "n"; + key = ""; + action = "resize +2"; + options.desc = "Increase Window Height"; + } + { + mode = "n"; + key = ""; + action = "resize -2"; + options.desc = "Decrease Window Height"; + } + { + mode = "n"; + key = ""; + action = "vertical resize -2"; + options.desc = "Decrease Window Width"; + } + { + mode = "n"; + key = ""; + action = "vertical resize +2"; + options.desc = "Increase Window Width"; + } + { + action = ":UndotreeToggle"; + key = "u"; + mode = ["n"]; + } + { + action = ":m '>+1gv=gv"; + key = "J"; + mode = ["v"]; + } + { + action = ":m '<-2gv=gv"; + key = "K"; + mode = ["v"]; + } + { + mode = "n"; + key = "sv"; + action = "v"; + } + { + mode = "n"; + key = "sh"; + action = "s"; + } + { + mode = "n"; + key = "e"; + action = ":Yazi"; + } + { + mode = "n"; + key = ""; + action = "zz"; + } + { + mode = "n"; + key = ""; + action = "zz"; + } + { + mode = "x"; + key = "p"; + action = "\"_dP"; + } + + # Toggleterm + { + mode = "n"; + key = "t"; + action = ":ToggleTerm direction=float"; + } + ]; + colorschemes.rose-pine.enable = true; + }; +} diff --git a/home/fabric/programs/tmux.nix b/home/fabric/programs/tmux.nix new file mode 100644 index 0000000..6421d23 --- /dev/null +++ b/home/fabric/programs/tmux.nix @@ -0,0 +1,32 @@ +# home/fabric/programs/tmux.nix +{ + config, + pkgs, + ... +}: { + programs.tmux = { + enable = true; + plugins = with pkgs.tmuxPlugins; [ + sensible + onedark-theme + vim-tmux-navigator + ]; + + # General settings + baseIndex = 1; + mouse = true; + keyMode = "vi"; + + # Custom key bindings + extraConfig = '' + # Set pane base index + setw -g pane-base-index 1 + + # Vi copy mode bindings + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" + bind-key P paste-buffer + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" + ''; + }; +} diff --git a/home/fabric/programs/zsh.nix b/home/fabric/programs/zsh.nix new file mode 100644 index 0000000..914da59 --- /dev/null +++ b/home/fabric/programs/zsh.nix @@ -0,0 +1,33 @@ +# home/fabric/programs/zsh.nix +{ + config, + pkgs, + ... +}: { + programs = { + zsh = { + enable = true; + autosuggestion = { + enable = true; + }; + oh-my-zsh = { + enable = true; + plugins = [ + "vi-mode" + ]; + }; + initExtra = '' + export PATH="/home/fabric/.deno/bin:$PATH" + export PATH=$PATH:(go env GOPATH)/bin + + alias wails='$(go env GOPATH)/bin/wails' + ''; + }; + + oh-my-posh = { + enable = true; + enableZshIntegration = true; + useTheme = "easy-term"; + }; + }; +} diff --git a/hosts/common/global/default.nix b/hosts/common/global/default.nix new file mode 100644 index 0000000..faaba9c --- /dev/null +++ b/hosts/common/global/default.nix @@ -0,0 +1,55 @@ +# hosts/common/global/default.nix +{ + config, + lib, + pkgs, + ... +}: { + imports = [ + ./locale.nix + ]; + + # Enable nix flakes + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Basic system packages + environment.systemPackages = with pkgs; [ + vim + greetd.greetd + greetd.tuigreet + libinput + libnotify + kitty + zsh + ollama + ]; + + # Enable the OpenSSH daemon + services.openssh.enable = true; + + # Greetd configuration + services.greetd = { + enable = true; + settings = { + default_session = { + command = "''${pkgs.greetd.tuigreet}/bin/tuigreet --time "; + user = "fabric"; + }; + }; + }; + + # Display manager configuration + services.displayManager.defaultSession = "hyprland"; + + # Default programs + programs = { + hyprland.enable = true; + zsh.enable = true; + }; + + # This value determines the NixOS release version + system.stateVersion = "24.11"; +} diff --git a/hosts/common/global/locale.nix b/hosts/common/global/locale.nix new file mode 100644 index 0000000..3f391e2 --- /dev/null +++ b/hosts/common/global/locale.nix @@ -0,0 +1,14 @@ +# hosts/common/global/locale.nix +{...}: { + # Set your time zone. + time.timeZone = "America/Toronto"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_CA.UTF-8"; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; +} diff --git a/hosts/common/optional/docker.nix b/hosts/common/optional/docker.nix new file mode 100644 index 0000000..43778b7 --- /dev/null +++ b/hosts/common/optional/docker.nix @@ -0,0 +1,4 @@ +# hosts/common/optional/docker.nix +{...}: { + virtualisation.docker.enable = true; +} diff --git a/hosts/common/optional/nvidia.nix b/hosts/common/optional/nvidia.nix new file mode 100644 index 0000000..317f451 --- /dev/null +++ b/hosts/common/optional/nvidia.nix @@ -0,0 +1,21 @@ +# hosts/common/optional/nvidia.nix +{ + config, + lib, + pkgs, + ... +}: { + services.xserver.videoDrivers = ["nvidia"]; + + hardware = { + graphics.enable = true; + nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + }; +} diff --git a/hosts/common/optional/steam.nix b/hosts/common/optional/steam.nix new file mode 100644 index 0000000..5a32e87 --- /dev/null +++ b/hosts/common/optional/steam.nix @@ -0,0 +1,4 @@ +# hosts/common/optional/steam.nix +{...}: { + programs.steam.enable = true; +} diff --git a/hosts/tatara/default.nix b/hosts/tatara/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/tatara/hardware-configuration.nix b/hosts/tatara/hardware-configuration.nix new file mode 100644 index 0000000..5364690 --- /dev/null +++ b/hosts/tatara/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1cc325bd-91a6-4c69-9593-e2cb27363c93"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/EF24-B12A"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp5s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/zion/default.nix b/hosts/zion/default.nix new file mode 100644 index 0000000..435fcfb --- /dev/null +++ b/hosts/zion/default.nix @@ -0,0 +1,43 @@ +# hosts/zion/default.nix +{ + config, + lib, + pkgs, + ... +}: { + imports = [ + # Hardware configuration + ./hardware-configuration.nix + + # Common configurations + ../common/global + ../common/optional/nvidia.nix + ../common/optional/docker.nix + ../common/optional/steam.nix + ]; + + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Networking + networking = { + hostName = "zion"; + networkmanager.enable = true; + useDHCP = lib.mkDefault true; + }; + + # User configuration + users.users.fabric = { + isNormalUser = true; + description = "fabric"; + extraGroups = ["networkmanager" "wheel" "docker"]; + shell = pkgs.zsh; + }; + + # Enable Ollama with CUDA + services.ollama = { + enable = true; + acceleration = "cuda"; + }; +} diff --git a/hosts/zion/hardware-configuration.nix b/hosts/zion/hardware-configuration.nix new file mode 100644 index 0000000..a2cd2bc --- /dev/null +++ b/hosts/zion/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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, pkgs, 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 = "/dev/disk/by-uuid/303cbd05-4811-4560-a136-23ef8fd3a4fa"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3083-F950"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp9s0f3u3u1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..90267e6 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +HOSTNAME=$(hostname | tr '[:upper:]' '[:lower:]') +USERNAME="fabric" + +# Check if an argument is provided +if [ $# -eq 0 ]; then + echo "No arguments provided. Usage:" + echo " ./rebuild.sh system # Rebuild NixOS configuration" + echo " ./rebuild.sh home # Rebuild home-manager configuration" + echo " ./rebuild.sh both # Rebuild both configurations" + exit 1 +fi + +case $1 in + "system") + echo "Rebuilding NixOS configuration for $HOSTNAME..." + sudo nixos-rebuild switch --flake .#$HOSTNAME + ;; + "home") + echo "Rebuilding home-manager configuration for $USERNAME@$HOSTNAME..." + home-manager switch --flake .#$USERNAME@$HOSTNAME + ;; + "both") + echo "Rebuilding NixOS configuration for $HOSTNAME..." + sudo nixos-rebuild switch --flake .#$HOSTNAME + echo "Rebuilding home-manager configuration for $USERNAME@$HOSTNAME..." + home-manager switch --flake .#$USERNAME@$HOSTNAME + ;; + *) + echo "Invalid argument. Usage:" + echo " ./rebuild.sh system # Rebuild NixOS configuration" + echo " ./rebuild.sh home # Rebuild home-manager configuration" + echo " ./rebuild.sh both # Rebuild both configurations" + exit 1 + ;; +esac