commit ccecea715ce6e6c87adfdaf4f7af54f3e727e4ab Author: Michael Thomson Date: Tue Feb 27 08:46:24 2024 -0500 initial commit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..298ae81 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "home/nvim"] + path = home/nvim + url = https://github.com/michaelthomson0797/nvim.git diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..249eaac --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708294481, + "narHash": "sha256-DZtxmeb4OR7iCaKUUuq05ADV2rX8WReZEF7Tq//W0+Y=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a54e05bc12d88ff2df941d0dc1183cb5235fa438", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1708296515, + "narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "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..ac34d5b --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "A simple NixOS flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nixpkgs, home-manager, ... }: { + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./system + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.mthomson = import ./home; + } + ]; + }; + }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..7985e32 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./i3 + ./wezterm + ./nvim + ]; + home.username = "mthomson"; + home.homeDirectory = "/home/mthomson"; + home.stateVersion = "23.11"; + + home.packages = with pkgs; [ + cowsay + firefox + _1password-gui + gcc + fzf + nodejs + ]; + + programs.home-manager.enable = true; + programs.git.enable = true; +} diff --git a/home/i3/config b/home/i3/config new file mode 100644 index 0000000..8a3699a --- /dev/null +++ b/home/i3/config @@ -0,0 +1,251 @@ +set $rosewater #f5e0dc +set $flamingo #f2cdcd +set $pink #f5c2e7 +set $mauve #cba6f7 +set $red #f38ba8 +set $maroon #eba0ac +set $peach #fab387 +set $yellow #f9e2af +set $green #a6e3a1 +set $teal #94e2d5 +set $sky #89dceb +set $sapphire #74c7ec +set $blue #89b4fa +set $lavender #b4befe +set $text #cdd6f4 +set $subtext1 #bac2de +set $subtext0 #a6adc8 +set $overlay2 #9399b2 +set $overlay1 #7f849c +set $overlay0 #6c7086 +set $surface2 #585b70 +set $surface1 #45475a +set $surface0 #313244 +set $base #1e1e2e +set $mantle #181825 +set $crust #11111b + +# target title bg text indicator border +client.focused $lavender $base $text $rosewater $lavender +client.focused_inactive $overlay0 $base $text $rosewater $overlay0 +client.unfocused $overlay0 $base $text $rosewater $overlay0 +client.urgent $peach $base $peach $overlay0 $peach +client.placeholder $overlay0 $base $text $overlay0 $overlay0 +client.background $base +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod1 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# move tiling windows via drag & drop by left-clicking into the title bar, +# or left-clicking anywhere into the window while holding the floating modifier. +tiling_drag modifier titlebar + +# start a terminal +bindsym $mod+Return exec wezterm + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +bindsym $mod+d exec --no-startup-id dmenu_run +# A more modern dmenu replacement is rofi: +# bindcode $mod+40 exec "rofi -modi drun,run -show drun" +# There also is i3-dmenu-desktop which only displays applications shipping a +# .desktop file. It is a wrapper around dmenu, so you need that installed. +# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor 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 + +# split in horizontal orientation +# bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status + colors { + background $base + statusline $text + focused_statusline $text + active_workspace $base $text $blue + focused_separator $base + focused_workspace $base $base $green + active_workspace $base $base $blue + inactive_workspace $base $base $surface1 + urgent_workspace $base $base $surface1 + binding_mode $base $base $surface1 + } +} + +# Gaps +for_window [class="^.*"] border pixel 2 +gaps inner 10 +gaps outer -2 +hide_edge_borders both + +# wallpaper +exec_always --no-startup-id feh --bg-fill ~/wallpaper/wallpaper.jpg + +# nm-applet +#exec_always --no-startup-id nm-applet + +# dunst +#exec_always --no-startup-id dunst diff --git a/home/i3/default.nix b/home/i3/default.nix new file mode 100644 index 0000000..8ee92d0 --- /dev/null +++ b/home/i3/default.nix @@ -0,0 +1,5 @@ +{ pkgs, config, ... }: + +{ + home.file.".config/i3/config".source = ./config; +} diff --git a/home/nvim b/home/nvim new file mode 160000 index 0000000..ccd3d56 --- /dev/null +++ b/home/nvim @@ -0,0 +1 @@ +Subproject commit ccd3d56eb3097febe89dccbfa39be088386e85b3 diff --git a/home/wezterm/default.nix b/home/wezterm/default.nix new file mode 100644 index 0000000..3a7f820 --- /dev/null +++ b/home/wezterm/default.nix @@ -0,0 +1,34 @@ +{ pkgs, config, ... }: + +{ + programs.wezterm = { + enable = true; + extraConfig = '' + return { + color_scheme = 'catppuccin-frappe', + -- font = wezterm.font('PragmataPro Liga'), + font_size = 16, + use_fancy_tab_bar = false, + native_macos_fullscreen_mode = false, + enable_scroll_bar = false, + window_decorations = "RESIZE", + hide_tab_bar_if_only_one_tab = true, + keys = { + { + key = 'n', + mods = 'CMD|SHIFT', + action = wezterm.action.ToggleFullScreen, + }, + }, + window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + -- window_background_opacity = 0.90, + -- macos_window_background_blur = 20, + } + ''; + }; +} diff --git a/home/wezterm/wezterm.lua b/home/wezterm/wezterm.lua new file mode 100644 index 0000000..a830235 --- /dev/null +++ b/home/wezterm/wezterm.lua @@ -0,0 +1,27 @@ +local wezterm = require 'wezterm' + +return { + color_scheme = 'catppuccin-frappe', + -- font = wezterm.font('PragmataPro Liga'), + font_size = 16, + use_fancy_tab_bar = false, + native_macos_fullscreen_mode = false, + enable_scroll_bar = false, + window_decorations = "RESIZE", + hide_tab_bar_if_only_one_tab = true, + keys = { + { + key = 'n', + mods = 'CMD|SHIFT', + action = wezterm.action.ToggleFullScreen, + }, + }, + window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + -- window_background_opacity = 0.90, + -- macos_window_background_blur = 20, +} diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..c469259 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,107 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Toronto"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_CA.UTF-8"; + + # i3 relates stuff + environment.pathsToLink = [ "/libexec" ]; + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + }; + + videoDrivers = [ "nvidia "]; + + displayManager = { + defaultSession = "none+i3"; + lightdm.enable = true; + }; + + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + i3blocks + feh + arandr + ]; + }; + + layout = "us"; + xkbVariant = ""; + }; + + # pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.mthomson = { + isNormalUser = true; + description = "Michael Thomson"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + environment.systemPackages = with pkgs; [ + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + curl + ]; + + environment.variables.EDITOR = "nvim"; + + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs + # here, NOT in environment.systemPackages + ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100644 index 0000000..ae9358f --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/96c63add-dc4b-473e-9273-db9e281f3004"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A240-8690"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3b38e555-ddc9-41ae-a3c7-49a20a2c5295"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp38s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}