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

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" = "\\";
};
};
};
};
};
}