From 9350ff271fce5eb08a65e54061e55f5a8b890a99 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 3 Sep 2024 22:24:20 -0400 Subject: [PATCH 1/6] adhere to nixos systems --- flake.nix | 56 +++++++++++++++--------- home/atuin.nix | 7 +-- home/core.nix | 19 ++++---- home/default.nix | 39 ++++++++++------- home/direnv.nix | 6 +-- home/eza.nix | 6 +-- home/lazygit.nix | 4 +- home/neovim.nix | 6 +-- home/shell.nix | 56 ++++++++++++------------ home/starship.nix | 6 +-- modules/{system.nix => darwinSystem.nix} | 0 modules/linuxSystem.nix | 0 12 files changed, 108 insertions(+), 97 deletions(-) rename modules/{system.nix => darwinSystem.nix} (100%) create mode 100644 modules/linuxSystem.nix diff --git a/flake.nix b/flake.nix index d716560..85eda0f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,11 @@ { - description = "Wyatt's nix configuration"; - + description = "Wyatt's nix configuration suite"; inputs = { - nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-24.05"; + # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; home-manager = { url = "github:nix-community/home-manager/release-24.05"; - inputs.nixpkgs.follows = "nixpkgs-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; }; darwin = { url = "github:lnl7/nix-darwin"; @@ -13,11 +13,6 @@ }; }; - # The `outputs` function will return all the build results of the flake. - # A flake can have many use cases and different types of outputs, - # parameters in `outputs` are defined in `inputs` and can be referenced by their names. - # However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference) - # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. outputs = inputs @ { self, nixpkgs, @@ -25,37 +20,56 @@ home-manager, ... }: let - username = "wyatt"; - useremail = "wyatt@wyattjmiller.com"; - system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin - hostname = "sephiroth"; + userName = "wyatt"; + userEmail = "wyatt@wyattjmiller.com"; + # supportedSystems = ["x86_64-linux" "aarch64-darwin"]; + # system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin + # hostname = "sephiroth"; + # forAllSystems = nixpkgs.lib.genAttrs supportedSystems; specialArgs = inputs // { - inherit username useremail hostname; + inherit userName userEmail; }; in { - darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { - inherit system specialArgs; + # Primary laptop - MacBook Pro (2023, M3) + darwinConfigurations."sephiroth" = darwin.lib.darwinSystem { + inherit specialArgs; + system = "aarch64-darwin"; modules = [ ./modules/nix-core.nix - ./modules/system.nix + ./modules/darwinSystem.nix ./modules/apps.nix ./modules/host-users.nix - # home manager home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.extraSpecialArgs = specialArgs; - home-manager.users.${username} = import ./home; + home-manager.users.${userName} = import ./home; } ]; }; - # nix code formatter - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + # Primary desktop computer + nixosConfiguration."cloud" = nixpkgs.lib.nixosSystem { + inherit specialArgs; + system = "x86_64-linux"; + modules = [ + /etc/nixos/configuration.nix + ./modules/nix-core.nix + # ./modules/linuxSystem.nix + ./modules/host-users.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${userName} = import ./home; + } + ]; + }; }; } diff --git a/home/atuin.nix b/home/atuin.nix index 16b6302..56b0dc2 100644 --- a/home/atuin.nix +++ b/home/atuin.nix @@ -1,9 +1,6 @@ -{ ... }: - -{ +{...}: { programs.atuin = { enable = true; - enableFishIntegration = true; }; -} \ No newline at end of file +} diff --git a/home/core.nix b/home/core.nix index 27d767d..8d482bd 100644 --- a/home/core.nix +++ b/home/core.nix @@ -9,15 +9,15 @@ p7zip # utils - bat # a batter cat - lazygit # a git tui that's easy to use - bottom # a better top - ripgrep # recursively searches directories for a regex pattern - jq # A lightweight and flexible command-line JSON processor - yq-go # yaml processer https://github.com/mikefarah/yq - fzf # A command-line fuzzy finder - fh # flake hub command line interface - aria2 # A lightweight multi-protocol & multi-source command-line download utility + bat + lazygit + bottom + ripgrep + jq + yq-go + fzf + fh + aria2 yt-dlp # misc @@ -41,6 +41,7 @@ nixd deadnix alejandra + statix # productivity iterm2 diff --git a/home/default.nix b/home/default.nix index 56bfdc8..7b5b3a3 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,6 +1,11 @@ -{ username, ... }: - { + pkgs, + lib, + userName, + ... +}: let + username = userName; +in { # import sub modules imports = [ ./atuin.nix @@ -15,20 +20,24 @@ # Home Manager needs a bit of information about you and the # paths it should manage. - home = { - username = username; - homeDirectory = "/Users/${username}"; + home = lib.mkMerge [ + (lib.mkIf pkgs.stdenv.isDarwin { + homeDirectory = "/Users/${username}"; + }) + (lib.mkIf pkgs.stdenv.isLinux { + homeDirectory = "/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 can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - stateVersion = "24.05"; - }; + # 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 can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + stateVersion = "24.05"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/direnv.nix b/home/direnv.nix index 47cc53f..2cd7f1e 100644 --- a/home/direnv.nix +++ b/home/direnv.nix @@ -1,6 +1,4 @@ -{ lib, config, ... }: - -{ +{...}: { programs.direnv = { enable = true; nix-direnv.enable = true; @@ -11,4 +9,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/home/eza.nix b/home/eza.nix index 5c05761..44350e0 100644 --- a/home/eza.nix +++ b/home/eza.nix @@ -1,10 +1,8 @@ -{ lib, config, ... }: - -{ +{...}: { programs.eza = { enable = true; enableFishIntegration = true; extraOptions = [ ]; }; -} \ No newline at end of file +} diff --git a/home/lazygit.nix b/home/lazygit.nix index 4f24f47..35ea71c 100644 --- a/home/lazygit.nix +++ b/home/lazygit.nix @@ -1,6 +1,4 @@ -{ ... }: - -{ +{...}: { programs.lazygit = { enable = true; diff --git a/home/neovim.nix b/home/neovim.nix index bcf357e..1d3114c 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -1,9 +1,7 @@ -{ lib, config, ... }: - -{ +{...}: { programs.neovim = { enable = true; defaultEditor = true; vimAlias = true; }; -} \ No newline at end of file +} diff --git a/home/shell.nix b/home/shell.nix index 30712f7..559e7c6 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.fish = { enable = true; # initExtra = '' @@ -7,18 +7,18 @@ shellAliases = { # ls aliases - ls = "eza --color $argv"; - la = "eza -l -all --color $argv"; - ll = "eza -l --color $argv"; - lt = "eza -l --color --git $argv"; + ls = "eza --color"; + la = "eza -l -all --color"; + ll = "eza -l --color"; + lt = "eza -l --color --git"; # lazygit alias lg = "lazygit"; # cat, less, more alias - cat = "bat $argv"; - less = "bat $argv"; - more = "bat $argv"; + cat = "bat"; + less = "bat"; + more = "bat"; # top alias top = "btm"; @@ -28,28 +28,28 @@ functions = { fish_greeting = { body = '' - set memes \ - "Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \ - "Daddy, chill!" \ - "What the hell is even that?!" \ - "Road work ahead? Yeah, I sure hope it does!" \ - "Look at all those chickens!" \ - "I smell like beef" \ - "Say, Coloardo - I'M A GIRAFFE" \ - "I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \ - "This is the dollar store, how good can it be?" \ - "That was legitness" \ - "Deez nuts" \ - "I wanna be a cowboy baby" \ - "Can I get a waffle? Can I please get a waffle?" \ - "I'm lesbian. I thought you were American." \ - "You gotta give 'em that 'hawk tuah' and spit on that thang!" \ - "We don't do that here..." + set memes \ + "Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \ + "Daddy, chill!" \ + "What the hell is even that?!" \ + "Road work ahead? Yeah, I sure hope it does!" \ + "Look at all those chickens!" \ + "I smell like beef" \ + "Say, Coloardo - I'M A GIRAFFE" \ + "I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \ + "This is the dollar store, how good can it be?" \ + "That was legitness" \ + "Deez nuts" \ + "I wanna be a cowboy baby" \ + "Can I get a waffle? Can I please get a waffle?" \ + "I'm lesbian. I thought you were American." \ + "You gotta give 'em that 'hawk tuah' and spit on that thang!" \ + "We don't do that here..." - set choose_meme (random)"%"(count $memes) - set choose_meme $memes[(math $choose_meme"+1")] + set choose_meme (random)"%"(count $memes) + set choose_meme $memes[(math $choose_meme"+1")] - printf (set_color F90)"%s\n" $choose_meme + printf (set_color F90)"%s\n" $choose_meme ''; onEvent = "fish_greeting"; }; diff --git a/home/starship.nix b/home/starship.nix index ef02d21..70051b9 100644 --- a/home/starship.nix +++ b/home/starship.nix @@ -1,9 +1,7 @@ -{ lib, config, ... }: - -{ +{...}: { programs.starship = { enable = true; enableFishIntegration = true; - settings = { }; + settings = {}; }; } diff --git a/modules/system.nix b/modules/darwinSystem.nix similarity index 100% rename from modules/system.nix rename to modules/darwinSystem.nix diff --git a/modules/linuxSystem.nix b/modules/linuxSystem.nix new file mode 100644 index 0000000..e69de29 From cfa75cb28ae9207ad3ea95d8c63b9d533826a84e Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sat, 7 Sep 2024 01:52:43 -0400 Subject: [PATCH 2/6] modified config for more modularity --- flake.lock | 22 ++++++++++++---------- flake.nix | 31 ++++++++++++++++--------------- home/default.nix | 31 +++++++++---------------------- home/git.nix | 4 ++-- modules/host-users.nix | 15 ++++++++++----- 5 files changed, 49 insertions(+), 54 deletions(-) diff --git a/flake.lock b/flake.lock index 326c10f..9ab31b5 100644 --- a/flake.lock +++ b/flake.lock @@ -23,7 +23,7 @@ "home-manager": { "inputs": { "nixpkgs": [ - "nixpkgs-darwin" + "nixpkgs" ] }, "locked": { @@ -43,25 +43,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722141560, - "narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", - "owner": "NixOS", + "lastModified": 1725407940, + "narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", + "rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-darwin": { "locked": { - "lastModified": 1722153173, - "narHash": "sha256-S46RmS9WkBOTLORpnWsNth4Ae6TlfJS9TKXqB55YQy4=", + "lastModified": 1725498621, + "narHash": "sha256-m12se55InZz03onhRji85deKJp4i0jrw980aDdxT0IM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7bba2df68503b68634e0070483ddaf6d59dc6530", + "rev": "0409a1b650bb50c225485f2ca21c325eb33f45c7", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 85eda0f..d470018 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,8 @@ { description = "Wyatt's nix configuration suite"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-24.05"; - # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; home-manager = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; @@ -22,21 +22,18 @@ }: let userName = "wyatt"; userEmail = "wyatt@wyattjmiller.com"; - # supportedSystems = ["x86_64-linux" "aarch64-darwin"]; - # system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin - # hostname = "sephiroth"; - # forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - - specialArgs = - inputs - // { - inherit userName userEmail; - }; + extraSpecialArgs = { + inherit userName userEmail; + }; in { # Primary laptop - MacBook Pro (2023, M3) darwinConfigurations."sephiroth" = darwin.lib.darwinSystem { - inherit specialArgs; system = "aarch64-darwin"; + specialArgs = { + inherit userName userEmail; + hostname = "sephiroth"; + }; + # nixpkgs = inputs.nixpkgs-darwin; modules = [ ./modules/nix-core.nix ./modules/darwinSystem.nix @@ -47,7 +44,7 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = specialArgs; + home-manager.extraSpecialArgs = extraSpecialArgs; home-manager.users.${userName} = import ./home; } ]; @@ -55,8 +52,11 @@ # Primary desktop computer nixosConfiguration."cloud" = nixpkgs.lib.nixosSystem { - inherit specialArgs; system = "x86_64-linux"; + specialArgs = { + inherit userName userEmail; + hostname = "cloud"; + }; modules = [ /etc/nixos/configuration.nix ./modules/nix-core.nix @@ -67,6 +67,7 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = extraSpecialArgs; home-manager.users.${userName} = import ./home; } ]; diff --git a/home/default.nix b/home/default.nix index 7b5b3a3..a088a0a 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,11 +1,8 @@ { pkgs, - lib, userName, ... -}: let - username = userName; -in { +}: { # import sub modules imports = [ ./atuin.nix @@ -20,24 +17,14 @@ in { # Home Manager needs a bit of information about you and the # paths it should manage. - home = lib.mkMerge [ - (lib.mkIf pkgs.stdenv.isDarwin { - homeDirectory = "/Users/${username}"; - }) - (lib.mkIf pkgs.stdenv.isLinux { - homeDirectory = "/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 can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - stateVersion = "24.05"; + home = { + username = userName; + homeDirectory = + if pkgs.stdenv.isDarwin + then "/Users/${userName}" + else "/home/${userName}"; + stateVersion = "24.05"; + }; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/git.nix b/home/git.nix index 2756ff5..43bbe6e 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,6 +1,6 @@ { lib, - useremail, + userEmail, ... }: { # `programs.git` will generate the config file: ~/.config/git/config @@ -14,7 +14,7 @@ programs.git = { enable = true; userName = "Wyatt J. Miller"; - userEmail = useremail; + userEmail = userEmail; extraConfig = { init.defaultBranch = "master"; diff --git a/modules/host-users.nix b/modules/host-users.nix index 079befd..06ef0f7 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -1,5 +1,7 @@ { - username, + lib, + pkgs, + userName, hostname, ... } @ args: @@ -14,10 +16,13 @@ system.defaults.smb.NetBIOSName = hostname; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users."${username}" = { - home = "/Users/${username}"; - description = username; + users.users."${userName}" = { + home = + if pkgs.stdenv.isDarwin + then "/Users/${userName}" + else "/home/${userName}"; + description = userName; }; - nix.settings.trusted-users = [username]; + nix.settings.trusted-users = [userName]; } From e0daf1276ca5502abd204a0db57ef0577b302268 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sat, 7 Sep 2024 22:22:12 -0400 Subject: [PATCH 3/6] added nixos configuration and home mananger stuff --- defaults/sway/config | 234 ++++++++++++++++++ defaults/waybar/config | 64 +++++ defaults/waybar/style.css | 74 ++++++ flake.nix | 7 +- home/core.nix | 3 +- home/default.nix | 2 + home/hyprland.nix | 10 + home/sway.nix | 41 +++ home/terminal.nix | 10 + modules/{ => darwin}/apps.nix | 0 .../configuration.nix} | 75 +++--- modules/host-users.nix | 21 +- modules/linuxSystem.nix | 0 modules/nixos/configuration.nix | 117 +++++++++ 14 files changed, 605 insertions(+), 53 deletions(-) create mode 100644 defaults/sway/config create mode 100644 defaults/waybar/config create mode 100644 defaults/waybar/style.css create mode 100644 home/hyprland.nix create mode 100644 home/sway.nix create mode 100644 home/terminal.nix rename modules/{ => darwin}/apps.nix (100%) rename modules/{darwinSystem.nix => darwin/configuration.nix} (75%) delete mode 100644 modules/linuxSystem.nix create mode 100644 modules/nixos/configuration.nix diff --git a/defaults/sway/config b/defaults/sway/config new file mode 100644 index 0000000..30775df --- /dev/null +++ b/defaults/sway/config @@ -0,0 +1,234 @@ +### Variables +# Logo key +set $mod Mod4 +# Direction keys +set $left h +set $down j +set $up k +set $right l +# Alacritty +set $term alacritty + +# Menu (rofi) +set $rofi_cmd rofi -terminal '$term' +set $menu $rofi_cmd -show combi -combi-modes drun#run -modes combi + +### Output configuration +output DP-3 pos 3840 0 res 1920x1080@59Hz +output HDMI-A-1 pos 0 0 res 1920x1080@59Hz +output DP-2 pos 1920 0 res 1920x1080@60Hz + +### Wallpaper +output HDMI-A-1 bg ~/.wallpaper/.wallpaper.png fill +output DP-2 bg ~/.wallpaper/.wallpaper.png fill +output DP-3 bg ~/.wallpaper/.wallpaper.png fill + +### Workspace binding + +## DP-3 bindings +workspace 1 output DP-2 +workspace 2 output DP-2 + +## HDMI-A-1 bindings +workspace 3 output HDMI-A-1 + +## DP-2 bindings +workspace 6 output DP-3 +workspace 7 output DP-3 + +### Colour options +set $bg #24283b +set $bg-inactive #323232 +set $bg-urgent #000000 +set $text #eeeeec +set $text-inactive #babdb6 +set $bar #323232 +set $statusline #e0e0e0 + +client.focused $bg $bg $text $bg $bg +client.unfocused $bg-inactive $bg-inactive $text-inactive $bar $bar +client.focused_inactive $bg-inactive $bg-inactive $text-inactive $bar $bar +client.urgent $bg-urgent $bg-urgent $text $bar $bar + + +### Idle configuration +# exec swayidle -w \ +# timeout 600 'swaylock -f -i /home/wyatt/.wallpaper_lock.jpeg' \ +# timeout 1200 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -f -c 000000' + +# Workspaces +set $workspace_www 1 +set $workspace_editor 2 +set $workspace_terminals 3 +set $workspace_documents 4 +set $workspace_multimedia 5 + +# Gaps +floating_modifier $mod normal + +### Key bindings + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' + +### Navigation + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + +### Workspaces + # Switch to workspace + bindsym $mod+1 workspace $workspace_www + bindsym $mod+2 workspace $workspace_editor + bindsym $mod+3 workspace $workspace_terminals + bindsym $mod+4 workspace $workspace_documents + bindsym $mod+5 workspace $workspace_multimedia + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace $workspace_www + bindsym $mod+Shift+2 move container to workspace $workspace_editor + bindsym $mod+Shift+3 move container to workspace $workspace_terminals + bindsym $mod+Shift+4 move container to workspace $workspace_documents + bindsym $mod+Shift+5 move container to workspace $workspace_multimedia + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. + +### Layout + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent + +### Taking screenshots + # Take a screenshot of all monitors + bindsym Print exec grim -t jpeg ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + + # Take a screenshot of a given selection + bindsym $mod+Print exec grim -t jpeg -g "$(slurp)" ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpeg + +### Resizing containers +mode "resize" { + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + + +### Audio and brightness keybinds +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle +bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +bindsym XF86AudioPlay exec playerctl play-pause +bindsym XF86AudioNext exec playerctl next +bindsym XF86AudioPrev exec playerctl previous +bindsym XF86MonBrightnessUp exec light -A 5 +bindsym XF86MonBrightnessDown exec light -U 5 + +### Lock the screen so my brother +### won't dick with my computer +bindsym $mod+Ctrl+l 'swaylock -f -i /home/wyatt/.wallpaper_lock.jpeg' + +### Status Bar: +bar { + swaybar_command waybar +} + + +### Font settings: +font pango:FiraCode: 14px + +### Window formatting +default_border none +default_border pixel 2 +gaps inner 10px + +# Applications +exec_always /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway +exec mako +#exec swww init +#exec bash /home/wyatt/.wallpaper/wallpaper.sh /home/wyatt/.wallpaper + +set $opacity 1.00 +for_window [class=".*"] opacity $opacity +for_window [app_id=".*"] opacity $opacity + +# Disable locking when conditions are met +for_window [class="streaming_client"] inhibit_idle fullscreen +for_window [app_id="firefox"] inhibit_idle fullscreen +for_window [app_id="neovide"] inhibit_idle fullscreen + +for_window [title="Beyond All Reason"] inhibit_idle fullscreen +include /etc/sway/config.d/* diff --git a/defaults/waybar/config b/defaults/waybar/config new file mode 100644 index 0000000..d9db3ce --- /dev/null +++ b/defaults/waybar/config @@ -0,0 +1,64 @@ +{ + "layer": "top", + "modules-left": ["sway/workspaces"], + "modules-center": ["clock"], + "modules-right": ["custom/playerctl", "custom/weather", "pulseaudio", "network", "tray"], + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": true, + "format": "{name}: {icon}", + "format-icons": { + "1":"", + "2":"", + "3":"", + "4":"", + "5":"", + "6":"", + "urgent": "", + "focused": "", + "default": "" + } + }, + "sway/window": { + "max-length": 50, + "tooltip": false + }, + "clock": { + "format-alt": "{:%m-%d-%Y}", + "tooltip": false + }, +"custom/weather": { + "format": "{} °", + "tooltip": true, + "interval": 3600, + "exec": "wttrbar --fahrenheit --main-indicator 'temp_F' --location 'Grand Rapids'", + "return-type": "json" +}, + "network": { + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": " {ipaddr}", + "format-disconnected": "⚠ Disconnected", + "interval": 5, + "tooltip": false + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-bluetooth": "{icon} {volume}%", + "format-muted": "", + "format-icons": { + "headphones": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", ""] + }, + "tooltip": false + }, + "custom/playerctl": { + "format": "♬ {}", + "max-length": 40, + "interval": 5, + "exec": "playerctl metadata --format '{{ artist }} - {{ title }}'", + "tooltip": false + }, +} diff --git a/defaults/waybar/style.css b/defaults/waybar/style.css new file mode 100644 index 0000000..1997440 --- /dev/null +++ b/defaults/waybar/style.css @@ -0,0 +1,74 @@ +* { + border: none; + border-radius: 0; + font-family: "Monaspace Krypton"; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background: #1f2335; + border-bottom: 1px solid #24283b; + color: #c0caf5; + opacity: 0.808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808; +} + +#workspaces button { + padding: 5px; + padding-left: 12px; + padding-right: 12px; + background: transparent; + color: #c0caf5; + border-bottom: 1px solid transparent; +} + +#workspaces button.focused { + background: #c0caf5; + color: #1d2021; + border-bottom: 1px solid #c0caf5; +} + +#cpu, +#memory, +#pulseaudio, +#network, +#battery, +#clock, +#custom-playerctl { + padding: 0 10px; + margin: 0 5px; +} + +#battery.charging { + color: #9ece6a; +} + +#battery.warning:not(.charging) { + color: #ff9e64; +} + +@keyframes blink { + to { + background-color: #1d2021; + color: #ebdbb2; + } +} + +#battery.critical:not(.charging) { + background: #f7768e; + color: #ebdbb2; + border-bottom: 1px solid #ebdbb2; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#network.disconnected { + color: #cc241d; +} + +#pulseaudio.muted { + color: #cc241d; +} diff --git a/flake.nix b/flake.nix index d470018..f5ba25f 100644 --- a/flake.nix +++ b/flake.nix @@ -33,11 +33,10 @@ inherit userName userEmail; hostname = "sephiroth"; }; - # nixpkgs = inputs.nixpkgs-darwin; modules = [ ./modules/nix-core.nix - ./modules/darwinSystem.nix - ./modules/apps.nix + ./modules/darwin/configuration.nix + ./modules/darwin/apps.nix ./modules/host-users.nix home-manager.darwinModules.home-manager @@ -60,7 +59,7 @@ modules = [ /etc/nixos/configuration.nix ./modules/nix-core.nix - # ./modules/linuxSystem.nix + ./modules/nixos/configuration.nix ./modules/host-users.nix home-manager.nixosModules.home-manager diff --git a/home/core.nix b/home/core.nix index 8d482bd..71a947a 100644 --- a/home/core.nix +++ b/home/core.nix @@ -9,6 +9,8 @@ p7zip # utils + zellij + tmux bat lazygit bottom @@ -27,7 +29,6 @@ tree gnutar gnupg - tmux nerdfonts zoxide babelfish diff --git a/home/default.nix b/home/default.nix index a088a0a..c7973d9 100644 --- a/home/default.nix +++ b/home/default.nix @@ -13,6 +13,8 @@ ./eza.nix ./neovim.nix ./direnv.nix + ./sway.nix + ./terminal.nix ]; # Home Manager needs a bit of information about you and the diff --git a/home/hyprland.nix b/home/hyprland.nix new file mode 100644 index 0000000..284be25 --- /dev/null +++ b/home/hyprland.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: { + wayland.windowManager.hyprland = { + enable = false; # TODO: to enable later + plugins = with pkgs; [ + hyprtrails + hy3 + ]; + xwayland = false; # TODO: to enable later + }; +} diff --git a/home/sway.nix b/home/sway.nix new file mode 100644 index 0000000..f2bfc80 --- /dev/null +++ b/home/sway.nix @@ -0,0 +1,41 @@ +{pkgs, ...}: let + dirs = { + defaults = ../../defaults; + }; +in { + wayland.windowManager.sway = { + enable = pkgs.stdenv.isLinux; + extraOptions = []; # Extra arguments to pass into sway. If sway goes haywire, we might need something in here + xwayland = true; + systemd = true; + + # Install packages that will be installed with sway + extraPackages = with pkgs; [ + wl-clipboard + wofi + mako + wttrbar + light + brightnessctl + playerctl + grim + slurp + cliphist + ]; + + wrapperFeatures = { + gtk = true; + }; + }; + + xdg.configFile."sway/config".source = dirs.defaults + /sway/config; + + programs.wofi.enable = pkgs.stdenv.isLinux; + programs.waybar = { + enable = pkgs.stdenv.isLinux; + systemd.enable = true; + }; + + xdg.configFile."waybar/config".source = dirs.defaults + /waybar/config.json; + xdg.configFile."waybar/style.css".source = dirs.defaults + /waybar/style.css; +} diff --git a/home/terminal.nix b/home/terminal.nix new file mode 100644 index 0000000..ea519a5 --- /dev/null +++ b/home/terminal.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: { + programs.alacritty = { + enable = pkgs.stdenv.isLinux; + settings = {}; # TODO: this will be filled in the future + }; + + programs.kitty = { + enable = false; # TODO: to enable later + } +} diff --git a/modules/apps.nix b/modules/darwin/apps.nix similarity index 100% rename from modules/apps.nix rename to modules/darwin/apps.nix diff --git a/modules/darwinSystem.nix b/modules/darwin/configuration.nix similarity index 75% rename from modules/darwinSystem.nix rename to modules/darwin/configuration.nix index 76ccd49..646da62 100644 --- a/modules/darwinSystem.nix +++ b/modules/darwin/configuration.nix @@ -1,7 +1,4 @@ -{ pkgs, ... }: - -{ - +{pkgs, ...}: { system = { # activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`. activationScripts.postUserActivation.text = '' @@ -11,29 +8,29 @@ ''; defaults = { - menuExtraClock.Show24Hour = true; # show 24 hour clock - - # customize dock - # dock = { - # autohide = true; - # show-recents = false; # disable recent apps + menuExtraClock.Show24Hour = true; # show 24 hour clock - # # customize Hot Corners - # wvous-tl-corner = 2; # top-left - Mission Control - # wvous-tr-corner = 13; # top-right - Lock Screen - # wvous-bl-corner = 3; # bottom-left - Application Windows - # wvous-br-corner = 4; # bottom-right - Desktop - # }; + # customize dock + dock = { + autohide = true; + # show-recents = false; # disable recent apps + + # # customize Hot Corners + # wvous-tl-corner = 2; # top-left - Mission Control + # wvous-tr-corner = 13; # top-right - Lock Screen + # wvous-bl-corner = 3; # bottom-left - Application Windows + # wvous-br-corner = 4; # bottom-right - Desktop + }; # # customize finder - # finder = { - # _FXShowPosixPathInTitle = true; # show full path in finder title - # AppleShowAllExtensions = true; # show all file extensions - # FXEnableExtensionChangeWarning = false; # disable warning when changing file extension - # QuitMenuItem = true; # enable quit menu item - # ShowPathbar = true; # show path bar - # ShowStatusBar = true; # show status bar - # }; + finder = { + _FXShowPosixPathInTitle = true; # show full path in finder title + AppleShowAllExtensions = true; # show all file extensions + FXEnableExtensionChangeWarning = false; # disable warning when changing file extension + QuitMenuItem = true; # enable quit menu item + ShowPathbar = true; # show path bar + ShowStatusBar = true; # show status bar + }; # # customize trackpad # trackpad = { @@ -56,9 +53,9 @@ # # If you press and hold certain keyboard keys when in a text area, the key’s character begins to repeat. # # This is very useful for vim users, they use `hjkl` to move cursor. # # sets how long it takes before it starts repeating. - # InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms) - # # sets how fast it repeats once it starts. - # KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms) + InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms) + # # sets how fast it repeats once it starts. + KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms) # NSAutomaticCapitalizationEnabled = false; # disable auto capitalization # NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution @@ -72,7 +69,7 @@ # # Customize settings that not supported by nix-darwin directly # # see the source code of this project to get more undocumented options: # # https://github.com/rgcr/m-cli - # # + # # # # All custom entries can be found by running `defaults read` command. # # or `defaults read xxx` to read a specific domain. # CustomUserPreferences = { @@ -133,19 +130,19 @@ # keyboard settings is not very useful on macOS # the most important thing is to remap option key to alt key globally, # but it's not supported by macOS yet. - # keyboard = { - # enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` + keyboard = { + # enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` - # # NOTE: do NOT support remap capslock to both control and escape at the same time - # remapCapsLockToControl = false; # remap caps lock to control, useful for emac users - # remapCapsLockToEscape = true; # remap caps lock to escape, useful for vim users + # # NOTE: do NOT support remap capslock to both control and escape at the same time + # remapCapsLockToControl = false; # remap caps lock to control, useful for emac users + remapCapsLockToEscape = true; # remap caps lock to escape, useful for vim users - # # swap left command and left alt - # # so it matches common keyboard layout: `ctrl | command | alt` - # # - # # disabled, caused only problems! - # swapLeftCommandAndLeftAlt = false; - # }; + # # swap left command and left alt + # # so it matches common keyboard layout: `ctrl | command | alt` + # # + # # disabled, caused only problems! + # swapLeftCommandAndLeftAlt = false; + }; }; # Add ability to used TouchID for sudo authentication diff --git a/modules/host-users.nix b/modules/host-users.nix index 06ef0f7..5dc991e 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -1,27 +1,30 @@ { - lib, pkgs, userName, hostname, ... -} @ args: -############################################################# -# -# Host & Users configuration -# -############################################################# -{ +} @ args: { + # Set up networking configuration networking.hostName = hostname; networking.computerName = hostname; + networking.firewall.enable = true; # VERY important, do not touch + # networking.firewall.allowedTCPPorts = []; + # networking.firewall.allowedUDPPorts = []; + networking.networkmanager.enable = pkgs.stdenv.isLinux; # Linux tool for managing network connections system.defaults.smb.NetBIOSName = hostname; - # Define a user account. Don't forget to set a password with ‘passwd’. + # Set up user accounts + # Don't forget to set a password with ‘passwd’! users.users."${userName}" = { home = if pkgs.stdenv.isDarwin then "/Users/${userName}" else "/home/${userName}"; description = userName; + extraGroups = + if pkgs.stdenv.isLinux + then ["wheel" "video"] + else []; }; nix.settings.trusted-users = [userName]; diff --git a/modules/linuxSystem.nix b/modules/linuxSystem.nix deleted file mode 100644 index e69de29..0000000 diff --git a/modules/nixos/configuration.nix b/modules/nixos/configuration.nix new file mode 100644 index 0000000..33741ba --- /dev/null +++ b/modules/nixos/configuration.nix @@ -0,0 +1,117 @@ +{ + inputs, + config, + lib, + pkgs, + ... +}: { + # Bring in the hardware configuration + imports = [ + /etc/nixos/hardware-configuration.nix + ]; + + # Enable flakes for NixOS + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Utilize systemd-boot + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Install and enable common graphics drivers + hardware.opengl = { + driSupport = true; + extraPackages = with pkgs; [ + mesa_drivers + libvdpau-va-gl + libva + libva-utils + intel-vaapi-driver # for Intel + intel-media-driver # for Intel + rocm-opencl-icd # for AMD + ]; + }; + + # For systems with AMD graphics, this enables Vulkan on 32-bit applications + # For 64-bit application, however, Vulkan is enabled by default + hardware.graphics.driSupport32Bit = true; + + # For systems with AMD graphics, enable AMDVLK + hardware.hardware = { + extraPackages = with pkgs; [ + amdvlk + ]; + extraPackages32 = with pkgs; [ + driversi686Linux + ]; + }; + + # Enable Bluetooth if present + hardware.bluetooth.enable = true; + + # Set your timezone + time.timeZone = "America/Detroit"; + + # Enable Pipewire (sound) + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + # Enable touchpad + services.libinput.enable = true; + + # Install packages to be installed system-wide + environment.systemPackages = with pkgs; [ + vim + neovim + git + wireguard-tools + podman + toolbox + ]; + + # Install system-wide fonts + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + liberation_ttf + monaspace + nerdfonts + ]; + + # Set the EDITOR global environment variable to neovim + environment.variables.EDITOR = "nvim"; + + # Enable OpenSSH + services.openssh.enable = true; + + # Enable keyring + services.gnome.gnome-keyring.enable = true; + + # Enable GnuPG + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # Enable SUID wrappers (some programs need them) + programs.mtr.enable = true; + + # Enable Polkit + security.polkit.enable = true; + + # Enable power management + powerManagement = { + enable = true; + powertop.enable = false; # TODO: to be enabled on laptops + cpuFreqGovernor = "performace"; + }; + + # Enable Steam and open various firewall ports when applicable + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + localNetworkGameTransfers = true; + }; +} From baae8c629296fa1c746320ed54a42cc78dc5d8ca Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sat, 7 Sep 2024 23:20:24 -0400 Subject: [PATCH 4/6] cleanup --- home/sway.nix | 109 +++++++++++++++++++++++++------ home/terminal.nix | 2 +- modules/darwin/configuration.nix | 26 ++++---- modules/host-users.nix | 8 +-- modules/nixos/configuration.nix | 4 ++ 5 files changed, 110 insertions(+), 39 deletions(-) diff --git a/home/sway.nix b/home/sway.nix index f2bfc80..e923dd0 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -1,41 +1,112 @@ {pkgs, ...}: let dirs = { - defaults = ../../defaults; + defaults = ./defaults; }; in { wayland.windowManager.sway = { enable = pkgs.stdenv.isLinux; extraOptions = []; # Extra arguments to pass into sway. If sway goes haywire, we might need something in here xwayland = true; - systemd = true; + systemd.enable = true; # Install packages that will be installed with sway - extraPackages = with pkgs; [ - wl-clipboard - wofi - mako - wttrbar - light - brightnessctl - playerctl - grim - slurp - cliphist - ]; + # extraPackages = with pkgs; [ + # wl-clipboard + # wofi + # mako + # wttrbar + # light + # brightnessctl + # playerctl + # grim + # slurp + # cliphist + # ]; wrapperFeatures = { gtk = true; }; }; - xdg.configFile."sway/config".source = dirs.defaults + /sway/config; - programs.wofi.enable = pkgs.stdenv.isLinux; programs.waybar = { enable = pkgs.stdenv.isLinux; systemd.enable = true; - }; + style = '' + * { + border: none; + border-radius: 0; + font-family: "Monaspace Krypton"; + font-size: 13px; + min-height: 0; + } - xdg.configFile."waybar/config".source = dirs.defaults + /waybar/config.json; - xdg.configFile."waybar/style.css".source = dirs.defaults + /waybar/style.css; + window#waybar { + background: #1f2335; + border-bottom: 1px solid #24283b; + color: #c0caf5; + opacity: 0.808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808; + } + + #workspaces button { + padding: 5px; + padding-left: 12px; + padding-right: 12px; + background: transparent; + color: #c0caf5; + border-bottom: 1px solid transparent; + } + + #workspaces button.focused { + background: #c0caf5; + color: #1d2021; + border-bottom: 1px solid #c0caf5; + } + + #cpu, + #memory, + #pulseaudio, + #network, + #battery, + #clock, + #custom-playerctl { + padding: 0 10px; + margin: 0 5px; + } + + #battery.charging { + color: #9ece6a; + } + + #battery.warning:not(.charging) { + color: #ff9e64; + } + + @keyframes blink { + to { + background-color: #1d2021; + color: #ebdbb2; + } + } + + #battery.critical:not(.charging) { + background: #f7768e; + color: #ebdbb2; + border-bottom: 1px solid #ebdbb2; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #network.disconnected { + color: #cc241d; + } + + #pulseaudio.muted { + color: #cc241d; + } + ''; + }; } diff --git a/home/terminal.nix b/home/terminal.nix index ea519a5..b8d0b88 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -6,5 +6,5 @@ programs.kitty = { enable = false; # TODO: to enable later - } + }; } diff --git a/modules/darwin/configuration.nix b/modules/darwin/configuration.nix index 646da62..b394f80 100644 --- a/modules/darwin/configuration.nix +++ b/modules/darwin/configuration.nix @@ -53,9 +53,9 @@ # # If you press and hold certain keyboard keys when in a text area, the key’s character begins to repeat. # # This is very useful for vim users, they use `hjkl` to move cursor. # # sets how long it takes before it starts repeating. - InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms) + # InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms) # # sets how fast it repeats once it starts. - KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms) + # KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms) # NSAutomaticCapitalizationEnabled = false; # disable auto capitalization # NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution @@ -130,19 +130,19 @@ # keyboard settings is not very useful on macOS # the most important thing is to remap option key to alt key globally, # but it's not supported by macOS yet. - keyboard = { - # enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` + # keyboard = { + # enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` - # # NOTE: do NOT support remap capslock to both control and escape at the same time - # remapCapsLockToControl = false; # remap caps lock to control, useful for emac users - remapCapsLockToEscape = true; # remap caps lock to escape, useful for vim users + # # NOTE: do NOT support remap capslock to both control and escape at the same time + # remapCapsLockToControl = false; # remap caps lock to control, useful for emac users + # remapCapsLockToEscape = true; # remap caps lock to escape, useful for vim users - # # swap left command and left alt - # # so it matches common keyboard layout: `ctrl | command | alt` - # # - # # disabled, caused only problems! - # swapLeftCommandAndLeftAlt = false; - }; + # # swap left command and left alt + # # so it matches common keyboard layout: `ctrl | command | alt` + # # + # # disabled, caused only problems! + # swapLeftCommandAndLeftAlt = false; + # }; }; # Add ability to used TouchID for sudo authentication diff --git a/modules/host-users.nix b/modules/host-users.nix index 5dc991e..bc78d23 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -7,10 +7,10 @@ # Set up networking configuration networking.hostName = hostname; networking.computerName = hostname; - networking.firewall.enable = true; # VERY important, do not touch + # networking.firewall.enable = true; # VERY important, do not touch # networking.firewall.allowedTCPPorts = []; # networking.firewall.allowedUDPPorts = []; - networking.networkmanager.enable = pkgs.stdenv.isLinux; # Linux tool for managing network connections + # networking.networkmanager.enable = pkgs.stdenv.isLinux; # Linux tool for managing network connections system.defaults.smb.NetBIOSName = hostname; # Set up user accounts @@ -21,10 +21,6 @@ then "/Users/${userName}" else "/home/${userName}"; description = userName; - extraGroups = - if pkgs.stdenv.isLinux - then ["wheel" "video"] - else []; }; nix.settings.trusted-users = [userName]; diff --git a/modules/nixos/configuration.nix b/modules/nixos/configuration.nix index 33741ba..781cd05 100644 --- a/modules/nixos/configuration.nix +++ b/modules/nixos/configuration.nix @@ -3,6 +3,7 @@ config, lib, pkgs, + userName, ... }: { # Bring in the hardware configuration @@ -114,4 +115,7 @@ remotePlay.openFirewall = true; localNetworkGameTransfers = true; }; + + # Add username to groups "wheel" and "video" - more may be added here later + users.users.${userName}.extraGroups = ["wheel" "video"]; } From 90b4e20faed82c59b6f1cdc7160e376df79909ae Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 8 Sep 2024 16:44:14 -0400 Subject: [PATCH 5/6] added browser, added system level and user level packges, added flatpak input --- flake.lock | 17 ++++ flake.nix | 7 +- home/browser.nix | 5 ++ home/core.nix | 2 + home/default.nix | 5 +- home/sway.nix | 154 +++++++++++++++----------------- modules/nixos/configuration.nix | 27 ++++++ 7 files changed, 132 insertions(+), 85 deletions(-) create mode 100644 home/browser.nix diff --git a/flake.lock b/flake.lock index 9ab31b5..7e3367e 100644 --- a/flake.lock +++ b/flake.lock @@ -41,6 +41,22 @@ "type": "github" } }, + "nix-flatpak": { + "locked": { + "lastModified": 1711997201, + "narHash": "sha256-J71xzQlVYsjagA4AsVwRazhBh2rZrPpKvxTgs6UzL7c=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "b76fa31346db7fc958a9898f3c594696ca71c4fd", + "type": "github" + }, + "original": { + "owner": "gmodena", + "ref": "v0.4.1", + "repo": "nix-flatpak", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1725407940, @@ -77,6 +93,7 @@ "inputs": { "darwin": "darwin", "home-manager": "home-manager", + "nix-flatpak": "nix-flatpak", "nixpkgs": "nixpkgs", "nixpkgs-darwin": "nixpkgs-darwin" } diff --git a/flake.nix b/flake.nix index f5ba25f..fb5c50b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,7 @@ description = "Wyatt's nix configuration suite"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; home-manager = { url = "github:nix-community/home-manager/release-24.05"; @@ -16,6 +17,7 @@ outputs = inputs @ { self, nixpkgs, + nix-flatpak, darwin, home-manager, ... @@ -67,7 +69,10 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.extraSpecialArgs = extraSpecialArgs; - home-manager.users.${userName} = import ./home; + home-manager.users.${userName}.imports = [ + nix-flatpak.homeManagerModules.nix-flatpak + ./home + ]; } ]; }; diff --git a/home/browser.nix b/home/browser.nix new file mode 100644 index 0000000..68dc3dd --- /dev/null +++ b/home/browser.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + programs.firefox = { + enable = pkgs.stdenv.isLinux; + }; +} diff --git a/home/core.nix b/home/core.nix index 71a947a..64ac322 100644 --- a/home/core.nix +++ b/home/core.nix @@ -49,6 +49,8 @@ discord obsidian vscode + weechat + # iamb ollama # games? diff --git a/home/default.nix b/home/default.nix index c7973d9..a06fb8d 100644 --- a/home/default.nix +++ b/home/default.nix @@ -3,7 +3,7 @@ userName, ... }: { - # import sub modules + # Import sub modules imports = [ ./atuin.nix ./shell.nix @@ -25,6 +25,9 @@ if pkgs.stdenv.isDarwin then "/Users/${userName}" else "/home/${userName}"; + sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + }; stateVersion = "24.05"; }; diff --git a/home/sway.nix b/home/sway.nix index e923dd0..d698b69 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -9,104 +9,92 @@ in { xwayland = true; systemd.enable = true; - # Install packages that will be installed with sway - # extraPackages = with pkgs; [ - # wl-clipboard - # wofi - # mako - # wttrbar - # light - # brightnessctl - # playerctl - # grim - # slurp - # cliphist - # ]; - wrapperFeatures = { gtk = true; }; }; programs.wofi.enable = pkgs.stdenv.isLinux; + programs.mako.enable = pkgs.stdenv.isLinux; + # programs.cliphist.enable = pkgs.stdenv.isLinux; programs.waybar = { enable = pkgs.stdenv.isLinux; systemd.enable = true; style = '' - * { - border: none; - border-radius: 0; - font-family: "Monaspace Krypton"; - font-size: 13px; - min-height: 0; - } - - window#waybar { - background: #1f2335; - border-bottom: 1px solid #24283b; - color: #c0caf5; - opacity: 0.808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808; - } - - #workspaces button { - padding: 5px; - padding-left: 12px; - padding-right: 12px; - background: transparent; - color: #c0caf5; - border-bottom: 1px solid transparent; - } - - #workspaces button.focused { - background: #c0caf5; - color: #1d2021; - border-bottom: 1px solid #c0caf5; - } - - #cpu, - #memory, - #pulseaudio, - #network, - #battery, - #clock, - #custom-playerctl { - padding: 0 10px; - margin: 0 5px; - } - - #battery.charging { - color: #9ece6a; - } - - #battery.warning:not(.charging) { - color: #ff9e64; - } - - @keyframes blink { - to { - background-color: #1d2021; - color: #ebdbb2; + * { + border: none; + border-radius: 0; + font-family: "Monaspace Krypton"; + font-size: 13px; + min-height: 0; } + + window#waybar { + background: #1f2335; + border-bottom: 1px solid #24283b; + color: #c0caf5; + opacity: 0.808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808; + } + + #workspaces button { + padding: 5px; + padding-left: 12px; + padding-right: 12px; + background: transparent; + color: #c0caf5; + border-bottom: 1px solid transparent; + } + + #workspaces button.focused { + background: #c0caf5; + color: #1d2021; + border-bottom: 1px solid #c0caf5; + } + + #cpu, + #memory, + #pulseaudio, + #network, + #battery, + #clock, + #custom-playerctl { + padding: 0 10px; + margin: 0 5px; } - #battery.critical:not(.charging) { - background: #f7768e; - color: #ebdbb2; - border-bottom: 1px solid #ebdbb2; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } + #battery.charging { + color: #9ece6a; + } - #network.disconnected { - color: #cc241d; - } + #battery.warning:not(.charging) { + color: #ff9e64; + } - #pulseaudio.muted { - color: #cc241d; - } + @keyframes blink { + to { + background-color: #1d2021; + color: #ebdbb2; + } + } + + #battery.critical:not(.charging) { + background: #f7768e; + color: #ebdbb2; + border-bottom: 1px solid #ebdbb2; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #network.disconnected { + color: #cc241d; + } + + #pulseaudio.muted { + color: #cc241d; + } ''; }; } diff --git a/modules/nixos/configuration.nix b/modules/nixos/configuration.nix index 781cd05..0c06960 100644 --- a/modules/nixos/configuration.nix +++ b/modules/nixos/configuration.nix @@ -69,6 +69,13 @@ wireguard-tools podman toolbox + grim + slurp + playerctl + light + brightnessctl + wttrbar + cliphist ]; # Install system-wide fonts @@ -118,4 +125,24 @@ # Add username to groups "wheel" and "video" - more may be added here later users.users.${userName}.extraGroups = ["wheel" "video"]; + + # XDG stuff + xdg = { + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + }; + }; + + # Firewall stuff not allowed in common user and network creation + networking.firewall.enable = true; # VERY important, do not touch + # networking.firewall.allowedTCPPorts = []; + # networking.firewall.allowedUDPPorts = []; + networking.networkmanager.enable = true; # Linux tool for managing network connections + + # Enable Flatpak (app containerization) + services.flatpak.enable = true; } From b03d9ff7ef00432ae30620bd73466e148601e346 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 8 Sep 2024 16:59:16 -0400 Subject: [PATCH 6/6] added flatpak remote, packages --- home/flatpak.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 home/flatpak.nix diff --git a/home/flatpak.nix b/home/flatpak.nix new file mode 100644 index 0000000..f050a7e --- /dev/null +++ b/home/flatpak.nix @@ -0,0 +1,22 @@ +{...}: { + services.flatpak = { + remotes = [ + { + name = "flathub"; + location = "https://dl.flathub.org/repo/flathub..flatpakrepo"; + } + ]; + + packages = [ + "com.github.tchx84.Flatseal" + "com.slack.Slack" + "dev.goats.xivlauncher" + "info.beyondallreason.bar" + "io.dbeaver.DBeaverCommunity" + "io.openrct.OpenRCT2" + "md.obsidian.Obsidian" + "org.prismlauncher.PrismLauncher" + "sh.cider.Cider" + ]; + }; +}