initial commit

This commit is contained in:
= 2024-03-11 00:34:01 -05:00
commit 8ea01dbfac
11 changed files with 659 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
hardware-configuration.nix

View file

@ -0,0 +1,30 @@
{
# Same as catppuccin mocha for these
rosewater = "#f5e0dc";
flamingo = "#f2cdcd";
pink = "#f5c2e7";
mauve = "#cba6f7";
red = "#f38ba8";
maroon = "#eba0ac";
peach = "#fab387";
yellow = "#f9e2af";
green = "#a6e3a1";
teal = "#94e2d5";
sky = "#89dceb";
sapphire = "#74c7ec";
blue = "#89b4fa";
lavender = "#b4befe";
# Coal variant: https://gist.github.com/RingOfStorms/b2ff0c4e37f5be9f985c72c3ec9a3e62
text = "#e0e0e0";
subtext1 = "#cccccc";
subtext0 = "#b8b8b8";
overlay2 = "#a3a3a3";
overlay1 = "#8c8c8c";
overlay0 = "#787878";
surface2 = "#636363";
surface1 = "#4f4f4f";
surface0 = "#3b3b3b";
base = "#262626";
mantle = "#1f1f1f";
crust = "#171717";
}

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1709884566,
"narHash": "sha256-NSYJg2sfdO/XS3L8XN/59Zhzn0dqWm7XtVnKI2mHq3w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2be119add7b37dc535da2dd4cba68e2cf8d1517e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11-small",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View file

@ -0,0 +1,37 @@
{
description = "My systems flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11-small";
# home-manager = { };
};
outputs = { self, nixpkgs, ... } @ args:
let
nixosSystem = nixpkgs.lib.nixosSystem;
mkMerge = nixpkgs.lib.mkMerge;
settings = {
system = {
hostname = "gpdPocket3";
architecture = "x86_64-linux";
timeZone = "America/Chicago";
defaultLocale = "en_US.UTF-8";
};
user = {
username = "josh";
};
usersDir = ./users;
systemsDir = ./systems;
commonDir = ./_common;
flakeDir = ./.;
};
in
{
nixosConfigurations.${settings.system.hostname} = nixosSystem {
system = settings.system.architecture;
modules = [ ./systems/_common/configuration.nix ./systems/${settings.system.hostname}/configuration.nix ];
specialArgs = args // { inherit settings; };
};
# homeConfigurations = { };
};
}

28
readme.md Normal file
View file

@ -0,0 +1,28 @@
# First Install
- //todo add experimental whatevers `nixos-rebuild switch --flake /etc/nixos#gpdPocket3`
# Later updates
- `nix flake update /etc/nixos`
- `nixos-rebuild switch --flake /etc/nixos`
# Cleanup boot
I used the existing windows 100MB boot partition and it fills up constantly. Have to purge old stuff a lot this is how:
- `find '/boot/loader/entries' -type f | head -n -4 | xargs -I {} rm {}; nix-collect-garbage -d; nixos-rebuild boot; echo; df`
# Settings references:
- Flake docs: https://nixos.wiki/wiki/Flakes
- nixos: https://search.nixos.org/options
- home manager: https://nix-community.github.io/home-manager/options.xhtml
TODO make an offline version of this, does someone else have this already?
# TODO
- Use top level split out home manager configurations instead of the one built into the system config...
- get dot files setup better (see todo comment on wezterm config)
- Make a flake for neovim and move out some system packages required for that into that flake, re-use for root and user rather than cloning each place?
-

View file

@ -0,0 +1,49 @@
{ config, lib, pkgs, settings, ... }:
let
home-manager = builtins.fetchTarball {
url = "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz";
# to get hash run `nix-prefetch-url --unpack "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz"`
sha256 = "0562y8awclss9k4wk3l4akw0bymns14sfy2q9n23j27m68ywpdkh";
};
in
{
imports =
[
# Include the results of the hardware scan.
# Note we need to be in the /etc/nixos directory with this entire config repo for this relative path to work
../../hardware-configuration.nix
# home manager import
(import "${home-manager}/nixos")
];
# Enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Home manager options
security.polkit.enable = true;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.extraSpecialArgs = { inherit settings; };
# ==========
# Common
# ==========
networking.hostName = settings.system.hostname;
time.timeZone = settings.system.timeZone;
# Select internationalisation properties.
i18n.defaultLocale = settings.system.defaultLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = settings.system.defaultLocale;
LC_IDENTIFICATION = settings.system.defaultLocale;
LC_MEASUREMENT = settings.system.defaultLocale;
LC_MONETARY = settings.system.defaultLocale;
LC_NAME = settings.system.defaultLocale;
LC_NUMERIC = settings.system.defaultLocale;
LC_PAPER = settings.system.defaultLocale;
LC_TELEPHONE = settings.system.defaultLocale;
LC_TIME = settings.system.defaultLocale;
};
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,148 @@
{ config, lib, pkgs, settings, ... } @ args:
let
homeManagerUser = import "${settings.usersDir}/${settings.user.username}/home.nix";
in
{
imports =
[
# Our custom stuff
./stupid-keyboard.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "keep";
};
timeout = 5;
efi = {
canTouchEfiVariables = true;
};
};
# We want connectivity
networking.networkmanager.enable = true;
hardware.bluetooth.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.package = pkgs.pulseaudioFull;
# TODO evaluate if any of this kernal/hardware sutff is actually needed for our pocket. This is a hodge podge of shit from online
# The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise.
# This requires cusotm kernal params.
boot.kernelParams = [
"video=DSI-1:panel_orientation=right_side_up"
"fbcon=rotate:1"
"mem_sleep_default=s2idel"
];
boot.kernelModules = [ "btusb" ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "thunderbolt" ];
services.xserver.videoDrivers = [ "intel" ];
hardware.opengl = {
enable = true;
driSupport = true;
};
hardware.opengl.extraPackages = with pkgs; [
intel-media-driver
intel-vaapi-driver
];
hardware.enableAllFirmware = true;
# [Laptop] screens with brightness settings
programs.light.enable = true;
# I want this globally even for root so doing it outside of home manager
services.xserver.xkbOptions = "caps:escape";
console = {
earlySetup = true;
packages = with pkgs; [ terminus_font ];
# We want to be able to read the screen so use a 32 sized font...
font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz";
useXkbConfig = true; # use xkb.options in tty. (caps -> escape)
};
# Attempting to get fingerprint scanner to work... having issues though
#services.fwupd.enable = true;
#services.fprintd = {
# enable = true;
# package = pkgs.fprintd-tod;
# tod.enable = true;
# tod.driver = pkgs.libfprint-2-tod1-vfs0090;
# #tod.driver = pkgs.libfprint-2-tod1-goodix;
#};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
22 # sshd
];
# networking.firewall.allowedUDPPorts = [ ... ];
fonts.packages = with pkgs; [
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
users.users.root.initialPassword = "password1";
users.users.${settings.user.username} = {
initialPassword = "password1";
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "video" "input" ];
shell = pkgs.zsh;
};
# TODO how to do this from home manager file instead
environment.pathsToLink = [ "/share/fish" ];
home-manager.users.${settings.user.username} = homeManagerUser;
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.gnome.core-utilities.enable = false;
# List packages installed in system profile. To search, run:
# $ nix search wget
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
# Basics
neovim
vim
wget
curl
neofetch
bat
htop
nvtop
unzip
git
# [Laptop] Battery status
acpi
# extras, more for my neovim setup TODO move these into a more isolated place for nvim setup? Should be its own flake probably
cargo
rustc
nodejs_21
python313
ripgrep
nodePackages.cspell
#
fzf
];
programs.zsh = {
enable = true;
};
# does for all shells. Can use `programs.zsh.shellAliases` for specific ones
environment.shellAliases = {
n = "nvim";
battery = "acpi";
wifi = "nmtui";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
nix-boot-clean = "find '/boot/loader/entries' -type f | head -n -4 | xargs -I {} rm {}; nix-collect-garbage -d; nixos-rebuild boot; echo; df";
};
}

View file

@ -0,0 +1,35 @@
# This nix file is just a fix for a really stupid lay-outed keyboard I bought that I
# only use with the gpd pocket 3. Probably not relevant to anyone else
#
# Keyboard in question: https://www.walmart.com/ip/R-Go-Split-Ergonomic-Keyboard-QWERTY-US-Black-Wired-USB-Keyboard-Spilt-Wired-Windows-Linux/452297950
# R-Go Split Break Keyboard (maybe the walmart one is a fake since their real site does not have the same layout)
# https://www.r-go-tools.com/ergonomic-keyboard/r-go-split-break/
{ config, lib, pkgs, ... }:
let
rgo_keyboard_vid = "0911";
rgo_keyboard_pid = "2188";
rgo_hub_vid = "05e3";
rgo_hub_pid = "0608";
in
{
services.keyd = {
enable = true;
# `keyd monitor` to get new keys to remap
keyboards = {
rgo_sino_keyboard = {
ids = [ "0911:2188" "05e3:0608" ];
settings = {
main = {
# Backslash is in place of the enter key's normal position, so setting it to enter
"\\" = "enter";
# This keyboard has a strange extra key that outputs < and > characters. It has the
# backslash key printed on it though, conveniently, so we will just map this to backslash
# since it does not affect how I use left shift (which it takes half the space of)
"102nd" = "\\";
};
};
};
};
};
}

4
users/_common/home.nix Normal file
View file

@ -0,0 +1,4 @@
{ pkgs, ... }: {
home.stateVersion = "23.11";
programs.home-manager.enable = true;
}

View file

@ -0,0 +1,82 @@
{ pkgs, ... }:
{
"org/gnome/shell" = {
favorite-apps = [
"vivaldi-stable.desktop"
"org.wezfurlong.wezterm.desktop"
"org.gnome.Nautilus.desktop"
];
enabled-extensions = with pkgs.gnomeExtensions; [
workspace-switch-wraparound.extensionUuid
];
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
enable-hot-corners = false;
show-battery-percentage = true;
};
"org/gnome/desktop/wm/preferences" = {
resize-with-right-button = true;
button-layout = "maximize:appmenu,close";
audible-bell = false;
wrap-around = true;
};
"org/gnome/settings-daemon/plugins/media-keys" = {
# Disable the lock screen shortcut
screensaver = [ "" ];
};
"org/gnome/desktop/wm/keybindings" = {
minimize = [ "" ];
move-to-workspace-1 = [ "" ];
move-to-workspace-2 = [ "" ];
move-to-workspace-3 = [ "" ];
move-to-workspace-4 = [ "" ];
move-to-workspace-down = [ "" ];
move-to-workspace-last = [ "" ];
move-to-workspace-left = [ "" ];
move-to-workspace-right = [ "" ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace0 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-down = [ "" ];
switch-to-workspace-last = [ "" ];
switch-to-workspace-left = [ "<Super>h" ];
switch-to-workspace-right = [ "<Super>l" ];
};
"org/gnome/mutter" = {
edge-tiling = true;
workspaces-only-on-primary = true;
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action = "nothing";
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "nothing";
idle-brightness = 15;
power-saver-profile-on-low-battery = false;
};
"org/gnome/desktop/screensaver" = {
lock-enabled = false;
idle-activation-enabled = false;
};
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = false;
night-light-schedule-automatic = false;
};
"org/gnome/shell/keybindings" = {
shift-overview-down = [ "<Super>j" ];
shift-overview-up = [ "<Super>k" ];
switch-to-application-1 = [ "" ];
switch-to-application-2 = [ "" ];
switch-to-application-3 = [ "" ];
switch-to-application-4 = [ "" ];
switch-to-application-5 = [ "" ];
switch-to-application-6 = [ "" ];
switch-to-application-7 = [ "" ];
switch-to-application-8 = [ "" ];
switch-to-application-9 = [ "" ];
toggle-quick-settings = [ "" ];
};
}

217
users/josh/home.nix Normal file
View file

@ -0,0 +1,217 @@
{ pkgs, lib, settings, ... } @ args:
let
# TODO update to be in this config normally
# cursor fix? https://github.com/wez/wezterm/issues/1742#issuecomment-1075333507
weztermConfig = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/RingOfStorms/setup/72635c6674540bfefa2325f69e6ee6de9a11a62b/home/dotfiles/wezterm.lua";
sha256 = "sha256-kwbg9S9IHhAw6RTPvRjqGew5qz8a8VxjqonkgEKGtys=";
};
tmux = pkgs.tmuxPlugins;
in
{
imports = [
(settings.usersDir + "/_common/home.nix")
];
home.packages = with pkgs; [
firefox-esr
wezterm
vivaldi
ollama
# Desktop Environment stuff
wofi # app launcher TODO configure this somehow
gnome.dconf-editor # use `dump dconf /` before and after and diff the files for easy editing of dconf below
gnomeExtensions.workspace-switch-wraparound
#gnome.gnome-tweaks
#gnomeExtensions.forge # probably dont need on this on tiny laptop but may explore this instead of sway for my desktop
];
home.file.".wezterm.lua".source = weztermConfig; # todo actual configure this in nix instead of pulling from existing one. Maybe lookup the more official home manager dotfile solutions instead of inline
home.file.".psqlrc".text = ''
\pset pager off
'';
programs.zsh = {
enable = true;
enableAutosuggestions = true;
};
# home manager doesn't give us an option to add tmux extra config at the top so we do it ourselves here.
xdg.configFile."tmux/tmux.conf".text = lib.mkBefore ''
# Reset everything then add what we want exactly
unbind-key -a
# Window stuff
bind -r H previous-window
bind -r L next-window
bind -r 1 select-window -t:1
bind -r 2 select-window -t:2
bind -r 3 select-window -t:3
bind -r 4 select-window -t:4
bind -r 5 select-window -t:5
bind -r 6 select-window -t:6
bind -r 7 select-window -t:7
bind -r 8 select-window -t:8
bind -r 9 select-window -t:9
bind r command-prompt "rename-window %%"
bind | split-window -h -c "#{pane_current_path}"
bind \\ split-window -v -c "#{pane_current_path}"
bind t new-window
bind T command-prompt -p "window name:" "new-window; rename-window '%%'"
bind m command-prompt -p "Swap with window index:" "swap-window -t '%%'"
bind -r [ swap-window -t -1 \; previous-window
bind -r ] swap-window -t +1 \; next-window
# Sessions
bind C-s command-prompt -p "session name:" "new-session -s '%%'"
bind C-r command-prompt "rename-session %%"
bind -r C-L switch-client -n
bind -r C-H switch-client -p
# Pane stuff
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
bind -r , resize-pane -L 20
bind -r . resize-pane -R 20
bind -r - resize-pane -D 7
bind -r = resize-pane -U 7
bind q kill-pane
bind w kill-window
bind x swap-pane -D
# Tmux util
bind p paste-buffer
bind X source-file ~/.config/tmux/tmux.conf
bind z resize-pane -Z
bind : command-prompt
bind ^Q detach
# ==========
# My options
set-option -g terminal-overrides ',xterm-256color:RGB'
set -g detach-on-destroy off
set -g renumber-windows on
set -g status-position top
'';
programs.tmux = {
enable = true;
# Revisit this later, permission denied to make anything in run as my user...
secureSocket = false;
shortcut = "a";
prefix = "C-a";
baseIndex = 1;
mouse = true;
keyMode = "vi";
newSession = true;
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
aggressiveResize = true;
plugins = [
{
plugin = tmux.sessionist;
extraConfig = ''
set -g @sessionist-join-pane "j"
set -g @sessionist-goto "o"
set -g @default_key_bindings_new "UNSET"
'';
}
tmux.yank
tmux.tmux-thumbs
{
plugin = tmux.fzf-tmux-url;
extraConfig = ''
set -g @fzf-url-fzf-options '-p 60%,30% --prompt = " " - -border-label=" Open URL "'
set -g @fzf-url-history-limit '2000'
'';
}
{
plugin = tmux.catppuccin.overrideAttrs (_: {
src = pkgs.fetchFromGitHub {
owner = "ringofstorms";
repo = "tmux-catppuccin-coal";
rev = "e6d7c658e2d11798912ca1ed4e3626e3e1fad3fc";
sha256 = "sha256-M1XAeCz/lqgjZ7CnWCykJxZCDk+WVoawwHrR9SEO9ns=";
};
});
extraConfig = ''
set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
set -g @catppuccin_status_modules_right "directory application date_time"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{b:pane_current_path}"
set -g @catppuccin_date_time_text "%H:%M"
'';
}
];
};
programs.atuin = {
enable = true;
enableZshIntegration = true;
flags = [ "--disable-up-arrow" ];
settings = {
workspaces = true;
exit-mode = "return-query";
enter_accept = true;
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
palette = "catppuccin_coal";
palettes.catppuccin_coal = import "${settings.commonDir}/catppuccin_coal.nix";
};
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [ "--cmd cd" ];
};
dconf = {
enable = true;
settings = (import ./gnome_settings.nix args);
};
gtk = {
enable = true;
cursorTheme = {
name = "Numix-Cursor";
package = pkgs.numix-cursor-theme;
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
home.sessionVariables.GTK_THEME = "palenight";
}