From 44a3f420c670b900d8876ebdbc811a00b892f717 Mon Sep 17 00:00:00 2001 From: Steven Carpenter Date: Sat, 13 Apr 2024 03:58:29 -0400 Subject: [PATCH] first working build of rewrite --- .gitignore | 2 + flake.lock | 49 +++++ flake.nix | 23 +++ hosts/katana.nix | 141 ++++++++++++++ modules/default.nix | 6 + modules/home-manager/alacritty.nix | 73 +++++++ modules/home-manager/default.nix | 11 ++ modules/home-manager/direnv.nix | 10 + modules/home-manager/git.nix | 15 ++ modules/home-manager/helix.nix | 146 ++++++++++++++ modules/home-manager/home.nix | 99 ++++++++++ modules/home-manager/ncspot.nix | 10 + modules/home-manager/starship.nix | 10 + modules/home-manager/syncthing.nix | 10 + modules/home-manager/waybar-style.css | 180 ++++++++++++++++++ modules/home-manager/waybar.nix | 124 ++++++++++++ modules/home-manager/zellij.nix | 10 + modules/home-manager/zoxide.nix | 10 + modules/home-manager/zsh.nix | 26 +++ modules/system/default.nix | 5 + .../system/desktop-environments/budgie.nix | 15 ++ .../system/desktop-environments/default.nix | 12 ++ modules/system/desktop-environments/gnome.nix | 57 ++++++ .../system/desktop-environments/hyprland.nix | 113 +++++++++++ .../system/desktop-environments/tuigreet.nix | 45 +++++ modules/system/services/default.nix | 9 + modules/system/services/pipewire.nix | 23 +++ modules/system/services/tailscale.nix | 13 ++ users/speccon18/default.nix | 14 ++ 29 files changed, 1261 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/katana.nix create mode 100644 modules/default.nix create mode 100644 modules/home-manager/alacritty.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/direnv.nix create mode 100644 modules/home-manager/git.nix create mode 100644 modules/home-manager/helix.nix create mode 100644 modules/home-manager/home.nix create mode 100644 modules/home-manager/ncspot.nix create mode 100644 modules/home-manager/starship.nix create mode 100644 modules/home-manager/syncthing.nix create mode 100644 modules/home-manager/waybar-style.css create mode 100644 modules/home-manager/waybar.nix create mode 100644 modules/home-manager/zellij.nix create mode 100644 modules/home-manager/zoxide.nix create mode 100644 modules/home-manager/zsh.nix create mode 100644 modules/system/default.nix create mode 100644 modules/system/desktop-environments/budgie.nix create mode 100644 modules/system/desktop-environments/default.nix create mode 100644 modules/system/desktop-environments/gnome.nix create mode 100644 modules/system/desktop-environments/hyprland.nix create mode 100644 modules/system/desktop-environments/tuigreet.nix create mode 100644 modules/system/services/default.nix create mode 100644 modules/system/services/pipewire.nix create mode 100644 modules/system/services/tailscale.nix create mode 100644 users/speccon18/default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e20408f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +result/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6ac683e --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712386041, + "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712741485, + "narHash": "sha256-bCs0+MSTra80oXAsnM6Oq62WsirOIaijQ/BbUY59tR4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b2cf36f43f9ef2ded5711b30b1f393ac423d8f72", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4fba1c9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,23 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations.katana = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + inputs.home-manager.nixosModules.default + ./hosts/katana.nix + ./modules + ./users/speccon18 + ]; + }; + }; +} diff --git a/hosts/katana.nix b/hosts/katana.nix new file mode 100644 index 0000000..b7155f3 --- /dev/null +++ b/hosts/katana.nix @@ -0,0 +1,141 @@ +{ config, pkgs, lib, self, ... }: + +{ + system.stateVersion = "23.05"; + # Hardware + hardware = { + enableRedistributableFirmware = lib.mkDefault true; + cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + pulseaudio.enable = false; + bluetooth = { + enable = true; # enables support for Bluetooth + powerOnBoot = true; # powers up the default Bluetooth controller on boot + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + }; + + # Boot + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + initrd = { + availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ]; + kernelModules = [ ]; + }; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + # Prevent tampering of the pkgstore + readOnlyNixStore = true; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/55c746b3-b9dc-4c9b-ab56-de68a561f9a3"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-uuid/0C59-9996"; + fsType = "vfat"; + }; + }; + + swapDevices = [ ]; + + # Networking + networking = { + hostName = "katana"; # Define your hostname. + networkmanager.enable = true; #Enable Network Manager + firewall = { + checkReversePath = "loose"; + allowedTCPPorts = [ ]; + allowedUDPPorts = [ ]; + }; + }; + + # Sound + sound.enable = true; + + # Localization + time.timeZone = "America/Detroit"; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + + # Services. + services = { + blueman.enable = true; + printing.enable = true; + xserver = { + layout = "us"; + xkbVariant = ""; + }; + }; + + # Package Manager + nixpkgs = { + config.allowUnfree = true; + hostPlatform = lib.mkDefault "x86_64-linux"; + }; + + nix = { + # Sets flakes to unstable track instead of stable # + package = pkgs.nixUnstable; # or versioned attributes like nix_2_4 + # Enable flakes and nix-command + extraOptions = ''experimental-features = nix-command flakes''; + # Auto maintainence + settings.auto-optimise-store = lib.mkDefault true; + # Garbage collection + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + environment.systemPackages = with pkgs; [ + gparted + bluez + blueman + nerdfonts + home-manager + pkg-config + ripgrep + openssl + tree + eza + htop + zsh + dig #dns lookup + rage #file encryption + age-plugin-yubikey #plugin for rage to manage yubi-2fa + sops #file based secrets operations + direnv #used for development environments + gcc + bottom + felix-fm + zulip + vscode + ]; + + # Fonts + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "SourceCodePro" "DroidSansMono" ]; }) + ]; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..39db9c5 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,6 @@ +{config,lib,inputs,...}:{ + imports = [ + ./system + ./home-manager + ]; +} diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix new file mode 100644 index 0000000..e9733f5 --- /dev/null +++ b/modules/home-manager/alacritty.nix @@ -0,0 +1,73 @@ +{ config, lib, pkgs, ... }: + +{ + options.speccon18.hm.alacritty.enable = lib.mkEnableOption "Enable Alacritty"; + config = lib.mkIf config.speccon18.hm.alacritty.enable { + programs.alacritty = { + enable = true; + settings = { + cursor = { + style = { + shape = "Beam"; + blinking = "On"; + blink_interval = 75; + }; + }; + window = { + dimensions = { + columns = 120; + lines = 25; + }; + decorations = "full"; + opacity = 1.0; + title = "Alacritty"; + }; + font = { + normal = { + family = "SauceCodePro Nerd Font"; + style = "Regular"; + }; + bold = { + family = "SauceCodePro Nerd Font"; + style = "Bold"; + }; + italic = { + family = "SauceCodePro Nerd Font"; + style = "Italic"; + }; + size = 14; + }; + colors = { + primary = { + background = "#1d1f21"; + foreground = "#c5c8c6"; + }; + cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + normal = { + black = "#363537"; + red = "#FC618D"; + green = "#7BD88F"; + yellow = "#FCE566"; + blue = "#FD9353"; + magenta = "#948AE3"; + cyan = "#5AD4E6"; + white = "#F7F1FF"; + }; + bright = { + black = "#69676C"; + red = "#FC618D"; + green = "#7BD88F"; + yellow = "#FCE566"; + blue = "#FD9353"; + magenta = "#948AE3"; + cyan = "#5AD4E6"; + white = "#F7F1FF"; + }; + }; + }; + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..3e7a3a9 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,11 @@ +{inputs,config,pkgs,...}:{ + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; + home-manager = { + # useGlobalPackages = true; + # useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users.speccon18 = import ./home.nix; + }; +} diff --git a/modules/home-manager/direnv.nix b/modules/home-manager/direnv.nix new file mode 100644 index 0000000..e3914be --- /dev/null +++ b/modules/home-manager/direnv.nix @@ -0,0 +1,10 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.direnv.enable = lib.mkEnableOption "enables direnv with zsh integration"; + config = lib.mkIf config.speccon18.hm.direnv.enable { + programs.direnv = { + enable = true; + enableZshIntegration = lib.mkDefault true; + }; + }; +} diff --git a/modules/home-manager/git.nix b/modules/home-manager/git.nix new file mode 100644 index 0000000..e41fb7a --- /dev/null +++ b/modules/home-manager/git.nix @@ -0,0 +1,15 @@ +{pkgs, config, lib, ...}:{ + options.speccon18.hm.git.enable = lib.mkEnableOption "enables specs personal git preferences"; + config = lib.mkIf config.speccon18.hm.git.enable { + programs.git = { + enable = true; + userName = "specCon18"; + userEmail = "steven.carpenter@skdevstudios.com"; + extraConfig = { + init = { + defaultBranch = "main"; + }; + }; + }; + }; +} diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix new file mode 100644 index 0000000..671e0e9 --- /dev/null +++ b/modules/home-manager/helix.nix @@ -0,0 +1,146 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.helix.enable = lib.mkEnableOption "enables specs custom helix configuration"; + config = lib.mkIf config.speccon18.hm.helix.enable { + home.packages = with pkgs; [ + nodePackages_latest.yaml-language-server + nodePackages_latest.bash-language-server + nodePackages_latest.vscode-langservers-extracted + nodePackages_latest.dockerfile-language-server-nodejs + nodePackages_latest.typescript + nodePackages_latest.typescript-language-server + nodePackages_latest.svelte-language-server + nodePackages_latest.vls + python311Packages.python-lsp-server + # rnix-lsp is archived need to update to fix CVE-2024-27297 + rust-analyzer + taplo + ]; + programs.helix = { + enable = true; + settings = { + theme = "monokai_pro_octagon"; + editor = { + line-number = "relative"; + shell = ["zsh" "-c"]; + completion-trigger-len = 0; + scroll-lines = 1; + scrolloff = 5; + cursorline = true; + cursor-shape = { + normal = "block"; + insert = "bar"; + select = "underline"; + }; + color-modes = true; + indent-guides.render = true; + file-picker.hidden = false; + auto-pairs = true; + lsp = { + enable = true; + display-messages = true; + auto-signature-help = true; + display-signature-help-docs = true; + snippets = true; + goto-reference-include-declaration = true; + }; + statusline = { + mode = { + normal = "NORMAL"; + insert = "INSERT"; + select = "SELECT"; + }; + left = [ "mode" "separator" "spinner" "separator" "file-name" ]; + right = [ "diagnostics" "position" "file-encoding" ]; + }; + }; + + }; + themes = { + monokai_pro_octagon = let + red = "#ff657a"; + orange = "#ff9b5e"; + yellow = "#ffd76d"; + green = "#bad761"; + blue = "#9cd1bb"; + purple = "#c39ac9"; + base0 = "#161821"; + base1 = "#1e1f2b"; + base2 = "#282a3a"; + base3 = "#3a3d4b"; + base4 = "#535763"; + base5 = "#696d77"; + base6 = "#767b81"; + base7 = "#b2b9bd"; + base8 = "#eaf2f1"; + base8x0c = "#303342"; + in { + "ui.linenr.selected" = { bg = base3; }; + "ui.text.focus" = { fg = yellow; modifiers = ["bold"]; }; + "ui.menu" = { fg = base8; bg = base3; }; + "ui.menu.selected" = { fg = base2; bg = yellow; }; + "ui.virtual.whitespace" = base5; + "ui.virtual.ruler" = { bg = base1; }; + "info" = base8; + "hint" = base8; + "ui.background" = {}; + "ui.statusline.inactive" = { fg = base8; bg = base8x0c; }; + "ui.statusline" = { fg = base8; bg = base4; }; + "ui.statusline.normal" = { fg = base4; bg = blue; }; + "ui.statusline.insert" = { fg = base4; bg = green; }; + "ui.statusline.select" = { fg = base4; bg = purple; }; + "ui.popup" = { bg = base3; }; + "ui.window" = { bg = base3; }; + "ui.help" = { fg = base8; bg = base3; }; + "ui.selection" = { bg = base4; }; + "ui.cursor.match" = { bg = base4; }; + "ui.cursorline" = { bg = base1; }; + "comment" = { fg = base5; modifiers = ["italic"]; }; + "ui.linenr" = { fg = base5; }; + "ui.cursor.primary" = { fg = base7; modifiers = ["reversed"]; }; + "attribute" = blue; + "variable" = base8; + "constant" = orange; + "variable.builtin" = red; + "constant.builtin" = red; + "namespace" = base8; + "ui.text" = { fg = base8; }; + "punctuation" = base6; + "type" = green; + "type.builtin" = { fg = red; }; + "label" = base8; + "constructor" = blue; + "function" = green; + "function.macro" = { fg = blue; }; + "function.builtin" = { fg = "cyan"; }; + "operator" = red; + "variable.other.member" = base8; + "keyword" = { fg = red; }; + "keyword.directive" = blue; + "variable.parameter" = "#f59762"; + "error" = red; + "special" = "#f59762"; + "module" = "#f59762"; + "warning" = "orange"; + "constant.character.escape" = { fg = base8; }; + "string" = yellow; + "constant.numeric" = purple; + "diff.plus" = green; + "diff.delta" = "orange"; + "diff.minus" = red; + "diagnostic.warning" = { underline = { color = "orange"; style = "curl"; }; }; + "diagnostic.error" = { underline = { color = red; style = "curl"; }; }; + "diagnostic.info" = { underline = { color = base8; style = "curl"; }; }; + "diagnostic.hint" = { underline = { color = base8; style = "curl"; }; }; + "markup.heading" = green; + "markup.bold" = { fg = "orange"; modifiers = ["bold"]; }; + "markup.italic" = { fg = "orange"; modifiers = ["italic"]; }; + "markup.strikethrough" = { modifiers = ["crossed_out"]; }; + "markup.link.url" = { fg = "orange"; modifiers = ["underlined"]; }; + "markup.link.text" = yellow; + "markup.quote" = green; + }; + }; + }; + }; +} diff --git a/modules/home-manager/home.nix b/modules/home-manager/home.nix new file mode 100644 index 0000000..b2f6425 --- /dev/null +++ b/modules/home-manager/home.nix @@ -0,0 +1,99 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./alacritty.nix + ./direnv.nix + ./git.nix + ./helix.nix + ./ncspot.nix + ./starship.nix + ./syncthing.nix + ./waybar.nix + ./zellij.nix + ./zoxide.nix + ./zsh.nix + ]; + speccon18.hm.alacritty.enable = true; + speccon18.hm.direnv.enable = true; + speccon18.hm.git.enable = true; + speccon18.hm.helix.enable = true; + speccon18.hm.ncspot.enable = true; + speccon18.hm.starship.enable = true; + speccon18.hm.syncthing.enable = true; + speccon18.hm.waybar.enable = false; + speccon18.hm.zellij.enable = true; + speccon18.hm.zoxide.enable = true; + speccon18.hm.zsh.enable = true; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home = { + username = "speccon18"; + homeDirectory = "/home/speccon18"; + # 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. + stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + packages = [ + # # 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'. + 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/speccon18/etc/profile.d/hm-session-vars.sh + # + sessionVariables = { + # EDITOR = "emacs"; + }; + }; + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/modules/home-manager/ncspot.nix b/modules/home-manager/ncspot.nix new file mode 100644 index 0000000..1d78a34 --- /dev/null +++ b/modules/home-manager/ncspot.nix @@ -0,0 +1,10 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.ncspot.enable = lib.mkEnableOption "enable ncspot"; + config = lib.mkIf config.speccon18.hm.ncspot.enable { + programs.ncspot = { + enable = true; + package = pkgs.ncspot; + }; + }; +} diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix new file mode 100644 index 0000000..70f16c0 --- /dev/null +++ b/modules/home-manager/starship.nix @@ -0,0 +1,10 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.starship.enable = lib.mkEnableOption "enables specs custom starship config"; + config = lib.mkIf config.speccon18.hm.starship.enable { + programs.starship = { + enable = true; + enableZshIntegration = true; + }; + }; +} diff --git a/modules/home-manager/syncthing.nix b/modules/home-manager/syncthing.nix new file mode 100644 index 0000000..1b9f31b --- /dev/null +++ b/modules/home-manager/syncthing.nix @@ -0,0 +1,10 @@ +{config, lib, pkgs, modulesPath, ... }: +{ + options.speccon18.hm.syncthing.enable = lib.mkEnableOption "enable syncthing"; + config = lib.mkIf config.speccon18.hm.syncthing.enable { + services.syncthing = { + enable = true; + tray.enable = false; + }; + }; +} diff --git a/modules/home-manager/waybar-style.css b/modules/home-manager/waybar-style.css new file mode 100644 index 0000000..3fdb8b8 --- /dev/null +++ b/modules/home-manager/waybar-style.css @@ -0,0 +1,180 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, FiraCode, Helvetica, Arial, sans-serif; + font-size: 16px; +} + +window#waybar { + background-color: rgba(68, 64, 60, 0.0); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: 0; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber { + padding: 0 10px; + color: #030712; +} + +#window { + margin: 0 4px; +} + +#clock { + background-color: #ec6148; + border-radius: 24px; +} + +#battery { + background-color: #ec6148; + color: #000000; + border-radius: 24px; +} + +#battery.charging, +#battery.plugged { + color: #000000; + background-color: #ec6148; +} + +@keyframes blink { + to { + background-color: #ec6148; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #ec6148; + color: #030712; + border-radius: 24px; +} + +#memory { + background-color: #ec6148; + color: #030712; + border-radius: 24px; +} + +#disk { + background-color: #ec6148; + border-radius: 24px; +} + +#backlight { + background-color: #ec6148; + border-radius: 24px; +} + +#network { + background-color: #ec6148; + color: #030712; + border-radius: 24px; +} + +#network.disconnected { + background-color: #ec6148; +} + +#pulseaudio { + background-color: #ec6148; + color: #030712; + border-radius: 24px; +} + +#pulseaudio.muted { + background-color: #ec6148; + color: #2a5c45; +} + +#wireplumber { + background-color: #ec6148; + color: #000000; + border-radius: 24px; +} + +#wireplumber.muted { + background-color: #ec6148; +} + +#temperature { + background-color: #ec6148; + border-radius: 24px; +} + +#temperature.critical { + background-color: #ec6148; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state>label { + padding: 0 5px; +} + +#keyboard-state>label.locked { + background: rgba(0, 0, 0, 0.2); +} \ No newline at end of file diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix new file mode 100644 index 0000000..ccb8441 --- /dev/null +++ b/modules/home-manager/waybar.nix @@ -0,0 +1,124 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.waybar.enable = lib.mkEnableOption "enable specs custom waybar for hyprland"; + config = lib.mkIf config.speccon18.hm.waybar.enable { + programs.waybar = { + enable = true; + package = pkgs.waybar; + systemd = { + enable = true; + target = "hyprland-session.target"; + }; + settings = { + main_bar = { + layer = "top"; + position = "top"; + height = 40; + spacing = 8; + modules-left = [ + "battery" + ]; + modules-center = [ + "temperature" + ]; + modules-right = [ + "backlight" + "cpu" + "memory" + "pulseaudio" + "network" + "clock" + ]; + keyboard-state = { + numlock = true; + capslock = true; + format = "{name} {icon}"; + format-icons = { + locked = ""; + unlocked = ""; + }; + }; + clock = { + timezone = "America/Detroit"; + tooltip-format = "{:%Y %B}\n{calendar}"; + format-alt = "{:%d-%m-%Y}"; + }; + cpu = { + format = "{usage}% "; + tooltip = false; + }; + memory = { + format = "{}% "; + }; + temperature = { + thermal-zone = 2; + hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + format-critical = "{temperatureC}°C {icon}"; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" ""]; + }; + backlight = { + format = "{percent} {icon}"; + format-icons = ["" "" "" "" "" "" "" "" ""]; + }; + battery = { + states = { + good = 95; + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-good = ""; + format-full = ""; + format-icons = [ + "" + "" + "" + "" + "" + ]; + }; + "battery#bat2" = { + bat = "BAT"; + }; + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + pulseaudio = { + scroll-step = 1; + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = "{icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "pavucontrol"; + }; + }; + }; + style = builtins.readFile ./waybar-style.css; + }; + }; + } diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix new file mode 100644 index 0000000..8905623 --- /dev/null +++ b/modules/home-manager/zellij.nix @@ -0,0 +1,10 @@ +{pkgs,config,lib,...}: +{ + options.speccon18.hm.zellij.enable = lib.mkEnableOption "enable zellij"; + config = lib.mkIf config.speccon18.hm.zellij.enable { + programs.zellij = { + enable = true; + package = pkgs.zellij; + }; + }; +} diff --git a/modules/home-manager/zoxide.nix b/modules/home-manager/zoxide.nix new file mode 100644 index 0000000..abb8eea --- /dev/null +++ b/modules/home-manager/zoxide.nix @@ -0,0 +1,10 @@ +{pkgs,config,lib,...}: +{ + options.speccon18.hm.zoxide.enable = lib.mkEnableOption ""; + config = lib.mkIf config.speccon18.hm.zoxide.enable { + programs.zoxide = { + enable = true; + enableZshIntegration = lib.mkDefault true; + }; + }; +} diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix new file mode 100644 index 0000000..ecd684b --- /dev/null +++ b/modules/home-manager/zsh.nix @@ -0,0 +1,26 @@ +{ pkgs, config, lib, ...}: +{ + options.speccon18.hm.zsh.enable = lib.mkEnableOption "enables specs zsh config"; + config = lib.mkIf config.speccon18.hm.zsh.enable { + programs.zsh = { + enable = lib.mkDefault true; + dotDir = ".config/zsh"; + history = { + path = "$ZDOTDIR/.zsh_history"; + save = 10000000; + }; + enableAutosuggestions = lib.mkDefault true; + enableCompletion = lib.mkDefault true; + syntaxHighlighting.enable = lib.mkDefault true; + shellAliases = { + ls = "eza -l"; + lsa = "eza -al"; + grep = "rg"; + osrb = "sudo nixos-rebuild $1 --flake ~/code/nixos-config/#katana"; + }; + localVariables = { + EDITOR="hx"; + }; + }; + }; +} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..e6137d0 --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,5 @@ +{config,...}:{ + imports = [ + ./desktop-environments + ]; +} diff --git a/modules/system/desktop-environments/budgie.nix b/modules/system/desktop-environments/budgie.nix new file mode 100644 index 0000000..1547756 --- /dev/null +++ b/modules/system/desktop-environments/budgie.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.speccon18.desktop.budgie; +in { + options.speccon18.desktop.budgie = { + enable = lib.mkEnableOption "enables specs custom budgie setup"; + }; + config = lib.mkIf cfg.enable { + services.xserver = { + enable = true; + desktopManager.budgie.enable = true; + displayManager.lightdm.enable = true; + }; + }; +} diff --git a/modules/system/desktop-environments/default.nix b/modules/system/desktop-environments/default.nix new file mode 100644 index 0000000..1046e58 --- /dev/null +++ b/modules/system/desktop-environments/default.nix @@ -0,0 +1,12 @@ +{config,...}:{ + imports = [ + ./budgie.nix + ./gnome.nix + ./hyprland.nix + ./tuigreet.nix + ]; + speccon18.desktop.budgie.enable = true; + speccon18.desktop.gnome.enable = false; + speccon18.desktop.hyprland.enable = false; + speccon18.desktop.tuigreet.enable = false; +} diff --git a/modules/system/desktop-environments/gnome.nix b/modules/system/desktop-environments/gnome.nix new file mode 100644 index 0000000..6cce5f6 --- /dev/null +++ b/modules/system/desktop-environments/gnome.nix @@ -0,0 +1,57 @@ +{ config, pkgs, lib, ... }: +{ + options.speccon18.desktop.gnome.enable = lib.mkEnableOption "enables specs custom gnome setup"; + config = lib.mkIf config.speccon18.desktop.gnome.enable { + # Dconf settings for home manager + # dconf = { + # enable = true; + # settings = { + # "org/gnome/mutter" = { + # attach-modal-dialogs = true; + # dynamic-workspaces = true; + # edge-tiling = false; + # experimental-features = [ "scale-monitor-framebuffer" ]; + # focus-change-on-pointer-rest = true; + # workspaces-only-on-primary = true; + # }; + # }; + # }; + # Gnome extensions + environment.systemPackages = with pkgs; [ ]; + + services = { + gnome = { + core-utilities.enable = false; + gnome-keyring.enable = true; + }; + + xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + displayManager = { + gdm = { + enable = true; + wayland = true; + }; + defaultSession = lib.mkDefault "budgie-desktop"; + }; + desktopManager = { + xterm.enable = false; + gnome.enable = false; + }; + }; + }; + + programs = { + xwayland.enable = lib.mkDefault true; + }; + + xdg = { + portal = { enable = lib.mkDefault true; }; + mime.defaultApplications = { + "text/markdown" = "hx"; + }; + }; + }; +} diff --git a/modules/system/desktop-environments/hyprland.nix b/modules/system/desktop-environments/hyprland.nix new file mode 100644 index 0000000..f04d685 --- /dev/null +++ b/modules/system/desktop-environments/hyprland.nix @@ -0,0 +1,113 @@ +{ config, pkgs, lib, ...}: +{ + options.speccon18.desktop.hyprland.enable = lib.mkEnableOption "enables specs custom hyprland setup"; + config = lib.mkIf config.speccon18.desktop.hyprland.enable { + programs.hyprland = { + enable = true; + nvidiaPatches = true; + xwayland.enable = true; + }; + environment = { + systemPackages = with pkgs; [ + # libsForQt5.polkit-kde-agent + libsForQt5.qt5.qtwayland + qt6.full + qt6.qtwayland + waybar + swww + pw-volume + rofi-wayland + libnotify + mako + hyprland + font-awesome + brightnessctl + grim + slurp + wl-clipboard + ]; + sessionVariables = { + #Enable Wayland + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + MOZ_ENABLE_WAYLAND = "1"; + GTK_USE_PORTAL = "1"; + NIXOS_XDG_OPEN_USE_PORTAL = "1"; + SDL_VIDEODRIVER = "wayland"; + + # XDG_Config + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + + #Default Applications + BROWSER = "firefox"; + TERMINAL = "alacritty"; + }; + }; + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-hyprland + ]; + }; + hardware = { + opengl.enable = true; + nvidia.modesetting.enable = true; + }; + # wayland.windowManager.hyprland = { + # # systemdIntegration = true; + # enable = true; + # extraConfig = '' + # $mainMod = SUPER + # # Application Lauch Keybinds + # bind = $mainMod, Return, exec, alacritty + # bind = $mainMod, W, exec, firefox + # bind = $mainMod, R, exec, rofi -show drun + # # Switch workspaces with mainMod + [0-9] + # bind = $mainMod, 1, workspace, 1 + # bind = $mainMod, 2, workspace, 2 + # bind = $mainMod, 3, workspace, 3 + # bind = $mainMod, 4, workspace, 4 + # bind = $mainMod, 5, workspace, 5 + # bind = $mainMod, 6, workspace, 6 + # bind = $mainMod, 7, workspace, 7 + # bind = $mainMod, 8, workspace, 8 + # bind = $mainMod, 9, workspace, 9 + # bind = $mainMod, 0, workspace, 10 + + # # Move active window to a workspace with mainMod + SHIFT + [0-9] + # bind = $mainMod SHIFT, 1, movetoworkspace, 1 + # bind = $mainMod SHIFT, 2, movetoworkspace, 2 + # bind = $mainMod SHIFT, 3, movetoworkspace, 3 + # bind = $mainMod SHIFT, 4, movetoworkspace, 4 + # bind = $mainMod SHIFT, 5, movetoworkspace, 5 + # bind = $mainMod SHIFT, 6, movetoworkspace, 6 + # bind = $mainMod SHIFT, 7, movetoworkspace, 7 + # bind = $mainMod SHIFT, 8, movetoworkspace, 8 + # bind = $mainMod SHIFT, 9, movetoworkspace, 9 + # bind = $mainMod SHIFT, 0, movetoworkspace, 10 + # bind = $mainMod, Print, exec, grim -o /home/speccon18/Pictures/$(date +'%s_grim.png') -g "$(slurp)" -t png + # # Startup Runners + # exec-once=systemctl --user start waybar.service + # exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + # exec-once=mako + # exec-once = swww init + # monitor=,highres,auto,1 + # ''; + # }; + # options.speccon18.home_manager.rofi.enable = lib.mkEnableOption "enable specs custom rofi config for hyprland"; + # config = lib.mkIf config.speccon18.home_manager.rofi.enable { + # programs.rofi = { + # enable = true; + # theme = "android_notification"; + # location = "top-left"; + # }; + # }; + }; +} diff --git a/modules/system/desktop-environments/tuigreet.nix b/modules/system/desktop-environments/tuigreet.nix new file mode 100644 index 0000000..11b6fd2 --- /dev/null +++ b/modules/system/desktop-environments/tuigreet.nix @@ -0,0 +1,45 @@ +{config,lib,pkgs,...}: +let + inherit (lib) mkEnableOption mkOption optionalString mkIf types; + dmcfg = config.services.xserver.displayManager; + cfg = config.speccon18.desktop.tuigreet; + gduser = config.services.greetd.settings.default_session.user; +in { + options.speccon18.desktop.tuigreet = { + enable = mkEnableOption "enables tuigreet"; + args = mkOption { + default = "--time --asterisks --remember -s ${dmcfg.sessionData.desktops}/share/wayland-sessions:${dmcfg.sessionData.desktops}/share/xsessions"; + type = types.str; + }; + }; + config = mkIf cfg.enable { + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet ${cfg.args}"; + user = "greeter"; + }; + }; + }; + # this is a life saver. + # literally no documentation about this anywhere. + # might be good to write about this... + # https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/ + systemd = { + services.greetd.serviceConfig = { + Type = "idle"; + StandardInput = "tty"; + StandardOutput = "tty"; + StandardError = "journal"; # Without this errors will spam on screen + # Without these bootlogs will spam on screen + TTYReset = true; + TTYVHangup = true; + TTYVTDisallocate = true; + }; + tmpfiles.rules = [ + "d /var/cache/tuigreet/ 0755 greeter ${gduser} - -" + ]; + }; + }; +} diff --git a/modules/system/services/default.nix b/modules/system/services/default.nix new file mode 100644 index 0000000..c9c550f --- /dev/null +++ b/modules/system/services/default.nix @@ -0,0 +1,9 @@ +{pkgs,config,...}:{ + imports = [ + ./tailscale.nix + ./pipewire.nix + ]; + + speccon18.tailscale.enable = true; + speccon18.sound.pipewire.enable = true; +} diff --git a/modules/system/services/pipewire.nix b/modules/system/services/pipewire.nix new file mode 100644 index 0000000..c8dbe57 --- /dev/null +++ b/modules/system/services/pipewire.nix @@ -0,0 +1,23 @@ +# https://nixos.wiki/wiki/PipeWire +{pkgs,config,lib, ...}: +{ + options.speccon18.sound.pipewire.enable = lib.mkEnableOption "enable pipewire with jack integrations"; + + config = lib.mkIf config.speccon18.sound.pipewire.enable { + environment.systemPackages = with pkgs; [ + pipewire + wireplumber + ]; + # rtkit is optional but recommended + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + }; + }; +} diff --git a/modules/system/services/tailscale.nix b/modules/system/services/tailscale.nix new file mode 100644 index 0000000..17695dc --- /dev/null +++ b/modules/system/services/tailscale.nix @@ -0,0 +1,13 @@ +{ pkgs, config, lib, ... }: { + + options.speccon18.tailscale.enable = lib.mkEnableOption "enables the tailscale service and sets the package to use"; + + config = lib.mkIf config.speccon18.tailscale.enable { + # make the tailscale command usable to users + environment.systemPackages = with pkgs;[ + pkgs.tailscale + ]; + # enable the tailscale service + services.tailscale.enable = true; + }; +} diff --git a/users/speccon18/default.nix b/users/speccon18/default.nix new file mode 100644 index 0000000..e16cc98 --- /dev/null +++ b/users/speccon18/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: +{ + programs.zsh.enable = true; + users.users.speccon18 = { + shell = pkgs.zsh; + isNormalUser = true; + initialHashedPassword = "$y$j9T$RdLBHOvUpb17egl0d16LT/$3Y2RD/tT1IZ0nkfAR13pp3IzBjvKLRgGpDPLobUeO23"; + openssh.authorizedKeys.keys = []; + description = "steven Carpenter"; + extraGroups = [ + "wheel" + ]; + }; +}