some formatting

This commit is contained in:
gwg313 2024-12-02 18:12:36 -05:00
parent c91faa5aaf
commit 57c3bb3e61
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
21 changed files with 472 additions and 360 deletions

View file

@ -2,32 +2,40 @@
## Overview
This repository contains my NixOS configuration as a flake. This configuration is designed to provide a reproducible and declarative setup for my system. It includes system configuration, package management, and various other NixOS features.
This repository contains my NixOS configuration as a flake. This configuration
is designed to provide a reproducible and declarative setup for my system. It
includes system configuration, package management, and various other NixOS
features.
### Window Manager
- hyrpland
- waybar
- swaylock
- wofi
- light
- grimshot
- mako
- hyrpland
- waybar
- swaylock
- wofi
- light
- grimshot
- mako
### Terminal
- alacritty
- zsh
- starship
- tmux
- neovim(my configuration can be found [here](https://github.com/gwg313/nvim-nix))
- eza
- ripgrep
- fd
- alacritty
- zsh
- starship
- tmux
- neovim(my configuration can be found
[here](https://github.com/gwg313/nvim-nix))
- eza
- ripgrep
- fd
## Prerequisites
Before using this NixOS flake configuration, you should have the following prerequisites:
Before using this NixOS flake configuration, you should have the following
prerequisites:
- NixOs should be installed on your system.
- Familiarity with Nix and NixOS concepts is helpful but not required.
- NixOs should be installed on your system.
- Familiarity with Nix and NixOS concepts is helpful but not required.
## Usage

View file

@ -6,7 +6,8 @@
outputs,
user,
...
}: {
}:
{
imports = [
./packages.nix
./users.nix
@ -16,12 +17,15 @@
#
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = ["nix-command" "flakes"];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.settings.auto-optimise-store = true;
nix.optimise.automatic = true;
nix.settings.trusted-users = ["${user}"];
nix.settings.trusted-users = [ "${user}" ];
# Disable so comma can be installed
programs.command-not-found.enable = false;

View file

@ -2,7 +2,8 @@
config,
lib,
...
}: {
}:
{
options = {
ssh_client.enable = lib.mkEnableOption "enable ssh client settings";
};

View file

@ -5,13 +5,21 @@
inputs,
outputs,
...
}: {
}:
{
# Define a user account. Don't forget to set a password with 'passwd'.
programs.zsh.enable = true;
users.users.gwg313 = {
isNormalUser = true;
description = "Glen Goodwin";
extraGroups = ["networkmanager" "wheel" "video" "docker" "audio" "wireshark"];
extraGroups = [
"networkmanager"
"wheel"
"video"
"docker"
"audio"
"wireshark"
];
shell = pkgs.zsh;
uid = 1000;
};

View file

@ -4,8 +4,13 @@
user,
lib,
...
}: {
imports = [./libvirt.nix ./podman.nix ./kubernetes.nix];
}:
{
imports = [
./libvirt.nix
./podman.nix
./kubernetes.nix
];
libvirt.enable = lib.mkDefault true;
podman.enable = lib.mkDefault true;

View file

@ -54,12 +54,14 @@
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
outputs =
{
self,
nixpkgs,
home-manager,
...
} @ inputs: let
}@inputs:
let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
@ -73,7 +75,8 @@
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
user = "gwg313";
in {
in
{
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
@ -82,7 +85,7 @@
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
overlays = import ./overlays { inherit inputs; };
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
@ -91,9 +94,11 @@
homeManagerModules = import ./modules/home-manager;
devShells = forAllSystems (
system: let
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
in
{
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = with pkgs; [
@ -104,13 +109,15 @@
);
checks = forAllSystems (
system: let
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
in
{
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
nixfmt-rfc-style.enable = true;
};
};
}
@ -120,7 +127,9 @@
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
candlekeep = nixpkgs.lib.nixosSystem {
specialArgs = {inherit user inputs outputs;};
specialArgs = {
inherit user inputs outputs;
};
modules = [
# > Our main nixos configuration file <
./hosts/candlekeep/configuration.nix
@ -130,7 +139,9 @@
nixosConfigurations = {
grymforge = nixpkgs.lib.nixosSystem {
specialArgs = {inherit user inputs outputs;};
specialArgs = {
inherit user inputs outputs;
};
modules = [
# > Our main nixos configuration file <
./hosts/grymforge/configuration.nix
@ -143,7 +154,9 @@
homeConfigurations = {
"gwg313@candlekeep" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [
# > Our main home-manager configuration file <
./home-manager/machines/candlekeep.nix
@ -155,7 +168,9 @@
homeConfigurations = {
"gwg313@grymforge" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [
# > Our main home-manager configuration file <
./home-manager/machines/grymforge.nix
@ -167,7 +182,9 @@
homeConfigurations = {
"gwg313@dorino" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [
# > Our main home-manager configuration file <
./home-manager/machines/dorino.nix

View file

@ -1,12 +1,25 @@
# A fast, GPU-accelerated terminal emulator.
{pkgs, ...}: {
{
pkgs,
lib,
...
}:
{
programs.alacritty = {
enable = true;
settings = {
env = {
TERM = "xterm-256color";
};
font = {
normal = {
family = lib.mkForce "Monaspace Krypton";
};
};
home.packages = with pkgs; [ueberzugpp];
};
};
home.packages = with pkgs; [
ueberzugpp
monaspace
];
}

View file

@ -3,7 +3,8 @@
lib,
pkgs,
...
}: {
}:
{
imports = [
./atuin.nix
./bat.nix
@ -18,7 +19,8 @@
];
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs;
home.packages =
with pkgs;
[
# Editors
# neovim # Improved version of vim, often used with overlays.
@ -56,6 +58,7 @@
age
portal
atac
dblab
# TUI Apps
#ncdu_2

View file

@ -3,11 +3,15 @@
pkgs,
lib,
...
}: let
}:
let
cfg = config.programs.discord;
discordPatcherBin = pkgs.writers.writePython3Bin "discord-krisp-patcher" {
libraries = with pkgs.python3Packages; [pyelftools capstone];
libraries = with pkgs.python3Packages; [
pyelftools
capstone
];
flakeIgnore = [
"E265" # from nix-shell shebang
"E501" # line too long (82 > 79 characters)
@ -27,19 +31,16 @@
# link fix
nss = pkgs.nss_latest;
};
in {
in
{
options.programs.discord = {
enable = lib.mkEnableOption "Discord";
wrapDiscord = lib.mkEnableOption "wrap the Discord binary with a patching each time";
};
config = lib.mkIf cfg.enable {
home.packages =
[discordPatcherBin]
++ (
if cfg.wrapDiscord
then [wrapDiscordBinary]
else [pkgs.discord]
);
home.packages = [
discordPatcherBin
] ++ (if cfg.wrapDiscord then [ wrapDiscordBinary ] else [ pkgs.discord ]);
};
}

View file

@ -1,9 +1,9 @@
import sys
import shutil
import sys
from elftools.elf.elffile import ELFFile
from capstone import *
from capstone.x86 import *
from elftools.elf.elffile import ELFFile
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} [path to discord_krisp.node]")
@ -13,14 +13,18 @@ if len(sys.argv) < 2:
executable = sys.argv[1]
elf = ELFFile(open(executable, "rb"))
symtab = elf.get_section_by_name('.symtab')
symtab = elf.get_section_by_name(".symtab")
krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[0].entry.st_value
isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value
krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[
0
].entry.st_value
isSignedByDiscord_address = symtab.get_symbol_by_name(
"_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE"
)[0].entry.st_value
text = elf.get_section_by_name('.text')
text_start = text['sh_addr']
text_start_file = text['sh_offset']
text = elf.get_section_by_name(".text")
text_start = text["sh_addr"]
text_start_file = text["sh_offset"]
# This seems to always be zero (.text starts at the right offset in the file). Do it just in case?
address_to_file = text_start_file - text_start
@ -72,9 +76,9 @@ if je_location:
print(f"Found patch location: 0x{je_location:x}")
shutil.copyfile(executable, executable + ".orig")
f = open(executable, 'rb+')
f = open(executable, "rb+")
f.seek(je_location - address_to_file)
f.write(b'\x66\x90') # Two byte NOP
f.write(b"\x66\x90") # Two byte NOP
f.close()
else:
if found_already_patched:

View file

@ -1,6 +1,8 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins.bufferline = let
plugins.bufferline =
let
mouse = {
right =
# Lua
@ -13,7 +15,8 @@
end
'';
};
in {
in
{
enable = true;
settings = {

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
programs.nixvim = {
extraConfigLuaPre =
# lua
@ -97,40 +98,40 @@
"shellharden"
"shfmt"
];
bicep = ["bicep"];
c = ["clang_format"];
cmake = ["cmake-format"];
cpp = ["clang_format"];
cs = ["csharpier"];
css = ["stylelint"];
fish = ["fish_indent"];
fsharp = ["fantomas"];
go = ["gofmt"];
haskell = ["ormolu"];
bicep = [ "bicep" ];
c = [ "clang_format" ];
cmake = [ "cmake-format" ];
cpp = [ "clang_format" ];
cs = [ "csharpier" ];
css = [ "stylelint" ];
fish = [ "fish_indent" ];
fsharp = [ "fantomas" ];
go = [ "gofmt" ];
haskell = [ "ormolu" ];
javascript = [
[
"prettierd"
"prettier"
]
];
json = ["jq"];
lua = ["stylua"];
markdown = ["deno_fmt"];
nix = ["nixfmt"];
json = [ "jq" ];
lua = [ "stylua" ];
markdown = [ "deno_fmt" ];
nix = [ "nixfmt" ];
python = [
"isort"
"black"
];
rust = ["rustfmt"];
rust = [ "rustfmt" ];
sh = [
"shellcheck"
"shellharden"
"shfmt"
];
sql = ["sqlfluff"];
swift = ["swift_format"];
terraform = ["terraform_fmt"];
toml = ["taplo"];
sql = [ "sqlfluff" ];
swift = [ "swift_format" ];
terraform = [ "terraform_fmt" ];
toml = [ "taplo" ];
typescript = [
[
"prettierd"
@ -141,8 +142,8 @@
"xmlformat"
"xmllint"
];
yaml = ["yamlfmt"];
zig = ["zigfmt"];
yaml = [ "yamlfmt" ];
zig = [ "zigfmt" ];
"_" = [
"squeeze_blanks"
"trim_whitespace"

View file

@ -1,11 +1,12 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins = {
mini = {
enable = true;
modules = {
bufremove = {};
bufremove = { };
};
};
};

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins.noice = {
enable = true;
@ -51,7 +52,7 @@
pattern = "^:%s*he?l?p?%s+";
icon = "󰋖";
};
input = {};
input = { };
};
};

View file

@ -1,6 +1,7 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.nixvim = {
extraPlugins = [pkgs.vimPlugins.precognition-nvim];
extraPlugins = [ pkgs.vimPlugins.precognition-nvim ];
keymaps = [
{

View file

@ -1,8 +1,10 @@
# A highly customizable status bar for Sway and other Wayland-based compositors.
{pkgs, ...}: let
{ pkgs, ... }:
let
networkInterface.eth = "wlp3s0";
hwmon = "/sys/class/hwmon/hwmon0/temp1_input";
in {
in
{
programs.waybar.enable = true;
programs.waybar.settings = {
@ -10,9 +12,25 @@ in {
layer = "bottom";
position = "top";
height = 24;
modules-left = ["hyprland/workspaces" "sway/mode"];
modules-center = ["hyprland/window" "gamemode"];
modules-right = ["network" "pulseaudio" "cpu" "custom/cpu_freq" "temperature" "memory" "battery" "tray" "clock"];
modules-left = [
"hyprland/workspaces"
"sway/mode"
];
modules-center = [
"hyprland/window"
"gamemode"
];
modules-right = [
"network"
"pulseaudio"
"cpu"
"custom/cpu_freq"
"temperature"
"memory"
"battery"
"tray"
"clock"
];
"hyprland/workspaces".sort-by-number = true;
@ -34,9 +52,7 @@ in {
"custom/cpu_freq" = {
format = "{}MHz ";
interval = 5;
exec =
pkgs.writeShellScript "cpuFreq"
''
exec = pkgs.writeShellScript "cpuFreq" ''
${pkgs.busybox}/bin/cat /proc/cpuinfo | \
${pkgs.busybox}/bin/grep MHz | \
${pkgs.busybox}/bin/cut -c 12-15 | \
@ -55,7 +71,13 @@ in {
};
"format" = "{capacity}% {icon} ";
"format-full" = "";
"format-icons" = ["" "" "" "" ""];
"format-icons" = [
""
""
""
""
""
];
};
"memory"."format" = "{used:0.1f}G/{total:0.1f}G ";
@ -81,7 +103,10 @@ in {
"phone" = "";
"portable" = "";
"car" = "";
"default" = ["" ""];
"default" = [
""
""
];
};
"on-click" = "pavucontrol";
};

View file

@ -8,7 +8,8 @@
pkgs,
user,
...
}: {
}:
{
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
@ -90,18 +91,17 @@
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
nix.registry = (lib.mapAttrs (_: flake: { inherit flake; })) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
);
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nix.nixPath = ["/etc/nix/path"];
environment.etc =
lib.mapAttrs'
(name: value: {
nix.nixPath = [ "/etc/nix/path" ];
environment.etc = lib.mapAttrs' (name: value: {
name = "nix/path/${name}";
value.source = value.flake;
})
config.nix.registry;
}) config.nix.registry;
networking.hostName = "candlekeep";
networking.networkmanager.enable = true;
@ -113,7 +113,7 @@
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILq54YrM3BbhBs0oDLOrc1bkg6FCCmkV4E3pWLZp0ejN gwg313@pm.me"
];
extraGroups = ["wheel"];
extraGroups = [ "wheel" ];
};
};

View file

@ -7,16 +7,23 @@
pkgs,
modulesPath,
...
}: {
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
../../common/nixos/nfs.nix
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/f2c87d99-ea17-4ef3-9ef6-bcc6637357f2";
@ -31,7 +38,7 @@
};
swapDevices = [
{device = "/dev/disk/by-uuid/dd8d717a-d872-4780-af3c-af4c702b587a";}
{ device = "/dev/disk/by-uuid/dd8d717a-d872-4780-af3c-af4c702b587a"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View file

@ -2,7 +2,8 @@
config,
user,
...
}: {
}:
{
services.syncthing = {
enable = true;
dataDir = "/home/gwg313";
@ -17,13 +18,15 @@
settings = {
devices = {
"grymforge" = {id = "N2TYFZ4-ODIIHIZ-UP27V4V-NYMAZNI-SIATS5S-5NTM6JX-A67HCZ5-ZB4TVQJ";};
"grymforge" = {
id = "N2TYFZ4-ODIIHIZ-UP27V4V-NYMAZNI-SIATS5S-5NTM6JX-A67HCZ5-ZB4TVQJ";
};
};
folders = {
"repos" = {
path = "/home/gwg313/repos";
devices = ["grymforge"];
devices = [ "grymforge" ];
versioning = {
type = "staggered";
params = {
@ -34,7 +37,7 @@
};
"documents" = {
path = "/home/gwg313/Documents";
devices = ["grymforge"];
devices = [ "grymforge" ];
versioning = {
type = "staggered";
params = {
@ -45,7 +48,7 @@
};
"obsidian" = {
path = "/home/gwg313/vault";
devices = ["grymforge"];
devices = [ "grymforge" ];
versioning = {
type = "staggered";
params = {

View file

@ -2,7 +2,8 @@
config,
user,
...
}: {
}:
{
services.syncthing = {
enable = true;
dataDir = "/home/gwg313";
@ -17,13 +18,15 @@
settings = {
devices = {
"candlekeep" = {id = "762A3TK-Z3ZX6DG-V4VASMJ-H6DJHE5-PBD6YZQ-MPILUWT-E7EY4O7-4EAPHAX";};
"candlekeep" = {
id = "762A3TK-Z3ZX6DG-V4VASMJ-H6DJHE5-PBD6YZQ-MPILUWT-E7EY4O7-4EAPHAX";
};
};
folders = {
"repos" = {
path = "/home/gwg313/repos";
devices = ["candlekeep"];
devices = [ "candlekeep" ];
versioning = {
type = "staggered";
params = {
@ -34,7 +37,7 @@
};
"documents" = {
path = "/home/gwg313/Documents";
devices = ["candlekeep"];
devices = [ "candlekeep" ];
versioning = {
type = "staggered";
params = {
@ -45,7 +48,7 @@
};
"obsidian" = {
path = "/home/gwg313/vault";
devices = ["candlekeep"];
devices = [ "candlekeep" ];
versioning = {
type = "staggered";
params = {

View file

@ -16,14 +16,17 @@ buildGoModule rec {
vendorHash = "sha256-zt1/gE4bVj+3yr9n0kT2FMYMEmiooy3k1lQ77rN6sTk=";
ldflags = ["-s" "-w"];
ldflags = [
"-s"
"-w"
];
meta = {
description = "Smart session manager for the terminal";
homepage = "https://github.com/joshmedeski/sesh";
changelog = "https://github.com/joshmedeski/sesh/releases/tag/${src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [gwg313];
maintainers = with lib.maintainers; [ gwg313 ];
mainProgram = "sesh";
};
}