first commit

This commit is contained in:
Mars 2024-05-07 03:17:46 -04:00
commit f1c5038fd7
15 changed files with 2481 additions and 0 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
watch_file flake.in.nix
nix run .#genflake flake.nix
use_flake

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.direnv/

74
flake.in.nix Normal file
View file

@ -0,0 +1,74 @@
{
inputs = let
mkInput = url: {
url = "github:${url}";
};
mkFollowingNixpkgs = url: {
url = "github:${url}";
inputs.nixpkgs.follows = "nixpkgs";
};
in {
agenix = mkInput "ryantm/agenix";
chaotic = mkInput "chaotic-cx/nyx/nyxpkgs-unstable";
flakegen = mkInput "jorsn/flakegen";
impermanence = mkInput "nix-community/impermanence";
nixpkgs = mkInput "nixos/nixpkgs/nixos-unstable";
nixvim = mkInput "pupbrained/nixvim";
sops-nix = mkInput "Mic92/sops-nix";
treefmt-nix = mkInput "numtide/treefmt-nix";
home-manager = mkFollowingNixpkgs "nix-community/home-manager";
kwin-effects-forceblur = mkFollowingNixpkgs "taj-ny/kwin-effects-forceblur";
nix-index-database = mkFollowingNixpkgs "nix-community/nix-index-database";
snowfall-lib = mkFollowingNixpkgs "snowfallorg/lib/dev";
};
outputs = inputs: let
pkgs = import inputs.nixpkgs {inherit system;};
system = "x86_64-linux";
in
with inputs;
inputs.snowfall-lib.mkFlake {
inherit inputs;
src = ./.;
formatter.${system} = treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
deadnix.enable = true;
};
};
channels-config = {
allowUnfree = true;
};
homes.modules = [
chaotic.homeManagerModules.default
nix-index-database.hmModules.nix-index
];
systems.modules.nixos = [
agenix.nixosModules.default
chaotic.nixosModules.default
impermanence.nixosModules.impermanence
];
devShells.${system}.default = with pkgs;
mkShellNoCC {
packages = [
alejandra
git
statix
(writeScriptBin "build" ''
nix fmt
nh os switch
nh home switch
'')
(writeScriptBin "up" "nix flake update")
];
};
};
}

1589
flake.lock Normal file

File diff suppressed because it is too large Load diff

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
# Do not modify! This file is generated.
{
inputs = {
agenix.url = "github:ryantm/agenix";
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
flakegen.url = "github:jorsn/flakegen";
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
impermanence.url = "github:nix-community/impermanence";
kwin-effects-forceblur = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:taj-ny/kwin-effects-forceblur";
};
nix-index-database = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/nix-index-database";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:pupbrained/nixvim";
snowfall-lib = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:snowfallorg/lib/dev";
};
sops-nix.url = "github:Mic92/sops-nix";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = inputs: inputs.flakegen ./flake.in.nix inputs;
}

View file

@ -0,0 +1,36 @@
{
lib,
pkgs,
inputs,
...
}: {
home = {
packages = with pkgs;
[
grc
jamesdsp
vesktop
]
++ (with inputs; [
nixvim.packages.${pkgs.system}.default
])
++ (with inputs.chaotic.packages.${pkgs.system}; [
distrobox_git
]);
stateVersion = "24.05";
};
programs = {
nheko.enable = true;
nix-index-database.comma.enable = true;
nix-index.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
};
nix.package = lib.mkForce pkgs.nixVersions.git;
}

View file

@ -0,0 +1,62 @@
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.programs.macchina;
tomlFormat = pkgs.formats.toml {};
in {
options.programs.macchina = {
enable = mkEnableOption "macchina";
package = mkPackageOption pkgs "macchina" {};
config = mkOption {
inherit (tomlFormat) type;
default = {};
example = {
theme = "Mezora";
show = [
"Kernel"
"Machine"
"OperatingSystem"
"Resolution"
"Uptime"
"LocalIP"
"Packages"
"ProcessorLoad"
"Memory"
"Battery"
];
};
description = ''
Macchina configuration.
'';
};
themes = with types;
mkOption {
inherit (tomlFormat) type;
default = {};
};
};
config = mkIf cfg.enable {
home.packages = [cfg.package];
xdg.configFile =
{
"macchina/macchina.toml".source =
tomlFormat.generate "macchina.toml" cfg.config;
}
// (
attrsets.concatMapAttrs (name: value: {
"macchina/themes/${name}.toml".source =
tomlFormat.generate "${name}.toml" value;
})
cfg.themes
);
};
}

View file

@ -0,0 +1,5 @@
{...}: {
programs.plasma = {
enable = true;
};
}

View file

@ -0,0 +1,32 @@
{pkgs, ...}:
with pkgs; {
imports = [
./fish.nix
./git.nix
./wezterm.nix
./macchina.nix
];
programs = {
bat = {
enable = true;
config.theme = "catppuccin";
themes.catppuccin = {
src = fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
hash = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
};
file = "/Catppuccin-mocha.tmTheme";
};
};
zoxide = {
enable = true;
options = ["--cmd" "cd"];
};
};
}

135
modules/home/shell/fish.nix Normal file
View file

@ -0,0 +1,135 @@
{pkgs, ...}:
with pkgs; {
programs = {
fish = let
mkFishPlugins = names:
map (name: {
inherit name;
src = pkgs.fishPlugins.${name}.src;
})
names;
in {
enable = true;
plugins =
[
{
name = "replay.fish";
src = fetchFromGitHub {
owner = "jorgebucaran";
repo = "replay.fish";
rev = "bd8e5b89ec78313538e747f0292fcaf631e87bd2";
hash = "sha256-bM6+oAd/HXaVgpJMut8bwqO54Le33hwO9qet9paK1kY=";
};
}
{
name = "license";
src = fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-license";
rev = "0155b16f102957ec0c734a90979245dc1073f979";
hash = "sha256-Bi9Q5rekZoyXYbRV+U4SmwCdqCl0pFupzm5si7SxFns=";
};
}
{
name = "wttr";
src = fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-wttr";
rev = "7500e382e6b29a463edc57598217ce0cfaf8c90c";
hash = "sha256-k3FrRPxKCiObO6HgtDx8ORbcLmfSYQsQeq5SAoNfZbE=";
};
}
{
name = "gityaw";
src = fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-gityaw";
rev = "59196560e0f4520db63fb8cab645510377bb8b13";
hash = "sha256-STXNxSsjSopB+lbB4hEYdhJifRfsImRwbZ1SxwEhkuM=";
};
}
{
name = "bang-bang";
src = fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-bang-bang";
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=";
};
}
{
name = "autopair";
src = fetchFromGitHub {
owner = "jorgebucaran";
repo = "autopair.fish";
rev = "4d1752ff5b39819ab58d7337c69220342e9de0e2";
hash = "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A=";
};
}
{
name = "done";
src = fetchFromGitHub {
owner = "franciscolourenco";
repo = "done";
rev = "d47f4d6551cccb0e46edfb14213ca0097ee22f9a";
hash = "sha256-VSCYsGjNPSFIZSdLrkc7TU7qyPVm8UupOoav5UqXPMk=";
};
}
]
++ (mkFishPlugins ["grc" "plugin-git"]);
shellAliases = {
cat = "${bat}/bin/bat";
df = "${duf}/bin/duf";
rm = "${rm-improved}/bin/rip";
cp = "${xcp}/bin/xcp";
};
interactiveShellInit = ''
function fish_greeting
macchina
end
'';
};
starship = {
enable = true;
settings = {
jobs.disabled = true;
palette = "catppuccin_mocha";
nix_shell.symbol = " ";
palettes.catppuccin_mocha = {
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";
text = "#cdd6f4";
subtext1 = "#bac2de";
subtext0 = "#a6adc8";
overlay2 = "#9399b2";
overlay1 = "#7f849c";
overlay0 = "#6c7086";
surface2 = "#585b70";
surface1 = "#45475a";
surface0 = "#313244";
base = "#1e1e2e";
mantle = "#181825";
crust = "#11111b";
};
};
};
};
}

View file

@ -0,0 +1,28 @@
{pkgs, ...}:
with pkgs; {
programs = {
git = {
enable = true;
package = gitAndTools.gitFull;
userName = "pupbrained";
userEmail = "mars@pupbrained.xyz";
aliases.pushall = "!git remote | xargs -L1 git push";
difftastic.enable = true;
extraConfig = {
init.defaultBranch = "main";
push.autoSetupRemote = true;
};
signing = {
signByDefault = true;
key = "0FF5B8826803F895";
};
};
gh = {
enable = true;
extensions = [gh-copilot gh-dash gh-markdown-preview];
};
};
}

View file

@ -0,0 +1,95 @@
{pkgs, ...}:
with pkgs; {
programs.macchina = {
enable = true;
config = {
theme = "Mezora";
interface = "wlp4s0";
show = [
"DesktopEnvironment"
"Distribution"
"Kernel"
"LocalIP"
"Machine"
"Memory"
"Packages"
"ProcessorLoad"
"Resolution"
"Shell"
"Terminal"
"Uptime"
"WindowManager"
];
};
themes = {
Mezora = {
custom_ascii = {
path = writeText "nix_logo" ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
'';
};
separator = "";
separator_color = "blue";
key_color = "blue";
palette = {
type = "Dark";
visible = true;
glyph = " ";
};
box = {
border = "rounded";
visible = true;
inner_margin = {
x = 0;
y = 1;
};
};
bar = {
glyph = "";
hide_delimiters = true;
visible = true;
};
keys = {
kernel = " Kernel";
packages = " Packages";
cpu_load = " CPU";
memory = " Memory";
resolution = "󰔂 Res";
uptime = " Uptime";
distro = " Distro";
machine = "󰌢 Machine";
de = " DE";
local_ip = "󰤨 Local IP";
terminal = " Terminal";
shell = " Shell";
};
};
};
};
}

View file

@ -0,0 +1,107 @@
{...}: {
programs.wezterm = {
enable = true;
extraConfig = ''
local wezterm = require('wezterm')
local c = wezterm.config_builder()
local resize_amount = 3;
local wezmodeConfig = {
theme = {
textColor = "white",
hintColor = "#a6e3a1",
normalModeColor = "#cba6f7",
modeTextColor = "#11111b",
}
}
wezterm.plugin.require('https://github.com/nekowinston/wezterm-bar').apply_to_config(c, {
position = 'bottom',
max_width = 32,
dividers = 'slant_right',
indicator = {
leader = {
enabled = true,
off = ' ',
on = ' ',
},
mode = {
enabled = true,
names = {
resize_mode = 'RESIZE',
copy_mode = 'VISUAL',
search_mode = 'SEARCH',
},
},
},
tabs = {
numerals = 'arabic',
pane_count = 'subscript',
brackets = {
active = { "", ':' },
inactive = { "", ':' },
},
},
clock = {
enabled = true,
format = '%l:%M %p',
},
})
local act = wezterm.action
local keybinds = {
{
key = 'Enter',
mods = 'CTRL|SHIFT',
action = act.SplitHorizontal({ domain = 'CurrentPaneDomain' }),
},
{
key = 'h',
mods = 'ALT',
action = act.ActivatePaneDirection('Left'),
},
{
key = 'l',
mods = 'ALT',
action = act.ActivatePaneDirection 'Right',
},
{
key = 'k',
mods = 'ALT',
action = act.ActivatePaneDirection 'Up',
},
{
key = 'j',
mods = 'ALT',
action = act.ActivatePaneDirection 'Down',
},
}
local config = {
adjust_window_size_when_changing_font_size = false,
color_scheme = 'Catppuccin Mocha',
cursor_blink_ease_in = 'Constant',
cursor_blink_ease_out = 'Constant',
cursor_blink_rate = 500,
default_cursor_style = 'BlinkingBar',
enable_scroll_bar = false,
font_size = 12,
font = wezterm.font('Maple Mono NF'),
front_end = 'WebGpu',
underline_position = -4,
use_fancy_tab_bar = false,
webgpu_power_preference = 'HighPerformance',
window_background_opacity = 0.8,
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
}
for k, v in pairs(config) do
c[k] = v
end
return c
'';
};
}

View file

@ -0,0 +1,193 @@
{
pkgs,
config,
inputs,
...
}:
with pkgs; {
imports = [./hardware.nix];
age = {
secrets.passwd.file = /etc/secrets/passwd.age;
identityPaths = [
"/persist/root/.ssh/id_ed25519"
];
};
chaotic = {
scx = {
enable = true;
scheduler = "scx_rusty";
};
steam.extraCompatPackages = [
luxtorpeda
proton-ge-custom
];
};
virtualisation.podman.enable = true;
virtualisation.podman.enableNvidia = true;
environment = {
sessionVariables = {
NIXOS_OZONE_WL = "1";
EDITOR = "nvim";
};
systemPackages =
[
kde-rounded-corners
]
++ (with inputs; [
agenix.packages.${system}.default
kwin-effects-forceblur.packages.${system}.default
]);
persistence."/persist" = {
hideMounts = true;
directories = [
"/root/.ssh"
"/etc/secrets"
"/etc/ssh"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
{
directory = "/var/lib/colord";
user = "colord";
group = "colord";
mode = "u=rwx,g=rx,o=";
}
];
files = [
"/etc/machine-id"
{
file = "/var/keys/secret_file";
parentDirectory = {mode = "u=rwx,g=,o=";};
}
];
};
};
boot = {
#initrd.systemd.enable = true;
#plymouth.enable = true;
blacklistedKernelModules = ["i915"];
kernelPackages = linuxPackages_cachyos;
kernelParams = ["module_blacklist=i915" "quiet"];
supportedFilesystems = ["btrfs" "ntfs"];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
nix = {
package = nixVersions.git;
settings = {
trusted-users = ["marshall"];
substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
"https://cache.iog.io"
"https://nyx.chaotic.cx/"
];
trusted-substituters = [
"cache.nixos.org"
"nix-community.cachix.org"
"cache.iog.io"
"nyx.chaotic.cx"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"nyx.chaotic.cx-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
"chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
];
};
};
programs = {
fish.enable = true;
gamemode.enable = true;
steam.enable = true;
gnupg.agent.enable = true;
nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/marshall/nix-config";
};
};
networking = {
hostName = "navis";
networkmanager.enable = true;
firewall.enable = false;
};
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_US.UTF-8";
services = {
btrfs.autoScrub.enable = true;
desktopManager.plasma6.enable = true;
displayManager.sddm.enable = true;
flatpak.enable = true;
libinput.enable = true;
libinput.touchpad.naturalScrolling = true;
openssh.enable = true;
xserver = {
enable = true;
videoDrivers = ["nvidia"];
xkb.layout = "us";
};
pipewire = {
enable = true;
pulse.enable = true;
};
};
users = {
mutableUsers = false;
users.marshall = {
isNormalUser = true;
extraGroups = ["wheel" "gamemode"];
shell = fish;
hashedPasswordFile = config.age.secrets.passwd.path;
packages = [
firefox
neovim
telegram-desktop
];
};
};
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.latest;
modesetting.enable = true;
};
};
system.stateVersion = "24.05";
}

View file

@ -0,0 +1,90 @@
# 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,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
fsType = "btrfs";
options = ["subvol=root"];
};
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/9952fcd1-46eb-4c9c-ab7d-361d31fdb9a2";
fileSystems."/home" = {
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
fsType = "btrfs";
options = ["subvol=home" "compress=zstd"];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
fileSystems."/persist" = {
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
neededForBoot = true;
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd"];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
fsType = "btrfs";
options = ["subvol=log" "compress=zstd" "noatime"];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/12CE-A600";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
swapDevices = [];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}