feat: initial commit

This commit is contained in:
Zoty 2026-03-27 19:34:02 -03:00
commit 54c34faa64
Signed by: Zoty
SSH key fingerprint: SHA256:WsGEGivgl37t3Mth6uugXMOgMCTR7QolIepNbC+j/tA
17 changed files with 841 additions and 0 deletions

View file

@ -0,0 +1,50 @@
# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/530e2b6f-2a15-4204-9445-8150743e3835";
fsType = "btrfs";
options = [ "subvol=@root" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/530e2b6f-2a15-4204-9445-8150743e3835";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/530e2b6f-2a15-4204-9445-8150743e3835";
fsType = "btrfs";
options = [ "subvol=@log" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/530e2b6f-2a15-4204-9445-8150743e3835";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/B7BD-80CC";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,54 @@
# 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 = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "ums_realtek" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/79211c8d-bd5e-4d19-b47c-2e57a4c6253e";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/79211c8d-bd5e-4d19-b47c-2e57a4c6253e";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/79211c8d-bd5e-4d19-b47c-2e57a4c6253e";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8981-AD7D";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/43d24b75-0fe1-422c-8a8f-b89f32063d3c"; }
];
# 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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

47
modules/_home/default.nix Normal file
View file

@ -0,0 +1,47 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
firefox
wezterm
];
programs.git = {
enable = true;
userName = "Zoty";
userEmail = "zotydev@gmail.com";
};
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history = {
size = 10000;
path = "$HOME/.zsh_history";
};
setOptions = [
"HIST_IGNORE_ALL_DUPS"
"AUTO_CD"
];
initContent = ''
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
'';
oh-my-zsh = {
enable = true;
plugins = [
"git"
"dirhistory"
"history"
];
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

79
modules/_home/git.nix Normal file
View file

@ -0,0 +1,79 @@
{ pkgs, ... }:
let
gitUsername = "Zoty";
gitEmail = "zotydev@gmail.com";
myPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8fKj0nQMJt9nnXbYgT4ggYuj6ieGCy6KL53frwoNHa";
in
{
home.packages = with pkgs; [ diff-so-fancy ];
home.file.".ssh/id_ed25519.pub".text = myPublicKey;
programs.git = {
enable = true;
settings = {
user = {
name = gitUsername;
email = gitEmail;
signingKey = "/run/secrets/ssh-private-key";
};
core = {
compression = 9;
whitespace = "error";
preloadindex = true;
};
advice = {
addEmptyPathspec = false;
pushNonFastForward = false;
statusHints = false;
};
init.defaultBranch = "main";
status = {
branch = true;
showStash = true;
showUntrackedFiles = "all";
};
diff = {
context = 3;
rename = "copies";
interHunkContext = 10;
};
pager = {
diff = "diff-so-fancy | $PAGER";
branch = false;
tag = false;
};
diff-so-fancy.markEmptyLines = false;
interactive = {
diffFilter = "diff-so-fancy --patch";
singlekey = true;
};
push = {
autoSetupRemote = true;
default = "current";
followTags = true;
};
pull = {
default = "current";
rebase = true;
};
rebase = {
autoStash = true;
missingCommitsCheck = "warn";
};
log = {
abbrevCommit = true;
graphColors = "blue,yellow,cyan,magenta,green,red";
};
branch.sort = "-committerdate";
tag.sort = "-taggerdate";
commit.gpgSign = true;
gpg.format = "ssh";
url = {
"git@github.com:ZotyDev/".insteadOf = "zoty:";
"git@github.com:UnnamedEngine/".insteadOf = "unen:";
"git@github.com:Taumaturgo/".insteadOf = "taumaturgo:";
};
};
};
}

73
modules/_home/niri.nix Normal file
View file

@ -0,0 +1,73 @@
{ pkgs, ... }: {
xdg.configFile."niri/config.kdl".text = ''
// Modificadores: Mod = Super (tecla Windows)
input {
keyboard {
xkb {
layout "en"
}
}
touchpad {
tap
natural-scroll
}
}
layout {
gaps 8
border {
width 2
active-color "#7aa2f7"
inactive-color "#3b4261"
}
}
prefer-no-csd
screenshot-path "~/Imagens/screenshots/%Y-%m-%d %H-%M-%S.png"
binds {
// Aplicativos
Mod+Return { spawn "wezterm"; }
Mod+D { spawn "fuzzel"; }
Mod+Q { close-window; }
// Foco
Mod+Left { focus-column-left; }
Mod+Right { focus-column-right; }
Mod+Up { focus-window-up; }
Mod+Down { focus-window-down; }
// Mover janelas
Mod+Shift+Left { move-column-left; }
Mod+Shift+Right { move-column-right; }
Mod+Shift+Up { move-window-up; }
Mod+Shift+Down { move-window-down; }
// Workspaces
Mod+1 { focus-workspace 1; }
Mod+2 { focus-workspace 2; }
Mod+3 { focus-workspace 3; }
Mod+4 { focus-workspace 4; }
Mod+5 { focus-workspace 5; }
Mod+Shift+1 { move-window-to-workspace 1; }
Mod+Shift+2 { move-window-to-workspace 2; }
Mod+Shift+3 { move-window-to-workspace 3; }
Mod+Shift+4 { move-window-to-workspace 4; }
Mod+Shift+5 { move-window-to-workspace 5; }
// Sistema
Mod+Shift+E { quit; }
Mod+L { spawn "swaylock"; }
// Volume
XF86AudioRaiseVolume { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+"; }
XF86AudioLowerVolume { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-"; }
XF86AudioMute { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
// Screenshot
Print { screenshot; }
Mod+Print { screenshot-screen; }
}
'';
}

39
modules/core.nix Normal file
View file

@ -0,0 +1,39 @@
{ den, ... }: {
den.aspects.core.nixos = { pkgs, ... }: {
nixpkgs.config.allowUnfree = true;
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
services.xserver.xkb.layout = "us";
environment.systemPackages = with pkgs; [
curl
wget
neovim
btop
nixd
];
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
networking.networkmanager.enable = true;
time.timeZone = "America/Sao_Paulo";
i18n.defaultLocale = "en_US.UTF-8";
};
}

72
modules/den.nix Normal file
View file

@ -0,0 +1,72 @@
{ inputs, den, lib, ... }: {
imports = [ inputs.den.flakeModule ];
den.schema.user.classes = lib.mkDefault [ "homeManager" ];
den.default.homeManager.home.stateVersion = "25.11";
den.hosts.x86_64-linux.desktop = {
users.zoty = {};
home-manager.module = inputs.home-manager.nixosModules.home-manager;
};
den.hosts.x86_64-linux.notebook = {
users.zoty = {};
home-manager.module = inputs.home-manager.nixosModules.home-manager;
};
den.aspects.notebook = {
includes = [
den.provides.hostname
den.aspects.core
den.aspects.niri
den.aspects.notebook-specific
den.aspects.secrets
];
nixos = {
system.stateVersion = "25.11";
};
};
den.aspects.desktop = {
includes = [
den.provides.hostname
den.aspects.core
den.aspects.niri
den.aspects.desktop-specific
den.aspects.dev
den.aspects.secrets
];
nixos = {
system.stateVersion = "25.11";
};
};
den.aspects.zoty = {
includes = [
den.provides.define-user
den.provides.primary-user
];
nixos = { pkgs, ... }: {
users.users.zoty = {
isNormalUser = true;
extraGroups = [ "wheel" "video" "audio" "input" ];
shell = pkgs.zsh;
hashedPasswordFile = "/run/secrets/user-password";
};
programs.zsh.enable = true;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
};
security.sudo.wheelNeedsPassword = false;
};
homeManager = {
imports = [
./_home/default.nix
./_home/niri.nix
./_home/git.nix
];
};
};
}

50
modules/desktop.nix Normal file
View file

@ -0,0 +1,50 @@
{ den, ... }: {
den.aspects.desktop-specific.nixos = { config, pkgs, ... }: {
imports = [ ./_hardware/desktop-hardware.nix ];
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
libva-vdpau-driver
libvdpau-va-gl
];
};
nvidia = {
# Required by Wayland
modesetting.enable = true;
open = false;
nvidiaSettings = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
};
services.xserver.videoDrivers = [ "nvidia" ];
boot = {
initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
loader = {
grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
efi.canTouchEfiVariables = true;
};
};
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
MOZ_ENABLE_WAYLAND = "1";
MOZ_USE_XINPUT2 = "1";
};
};
}

7
modules/dev.nix Normal file
View file

@ -0,0 +1,7 @@
{ den, pkgs, ... }: {
den.aspects.dev.nixos = { pkgs, ... }: {
environment.systemPackages = with pkgs; [
fzf
];
};
}

37
modules/niri.nix Normal file
View file

@ -0,0 +1,37 @@
{ inputs, den, pkgs, ... }: {
den.aspects.niri.nixos = { pkgs, ... }: {
imports = [ inputs.niri-flake.nixosModules.niri ];
programs.niri = {
enable = true;
package = pkgs.niri;
};
environment.systemPackages = with pkgs; [
waybar
fuzzel
swaylock
swayidle
grim
slurp
wl-clipboard
mako
xdg-desktop-portal-gnome
];
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gnome ];
};
security.pam.services.swaylock = {};
services.greetd = {
enable = true;
settings.default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd niri-session";
user = "greeter";
};
};
};
}

17
modules/notebook.nix Normal file
View file

@ -0,0 +1,17 @@
{ den, ... }: {
den.aspects.notebook-specific.nixos = { pkgs, ... }: {
imports = [ ./_hardware/notebook-hardware.nix ];
hardware.graphics.enable = true;
services.thermald.enable = true;
powerManagement.enable = true;
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
};
};
};
}

6
modules/output.nix Normal file
View file

@ -0,0 +1,6 @@
{ lib, ... }: {
options.flake.nixosConfigurations = lib.mkOption {
default = {};
type = lib.types.lazyAttrsOf lib.types.raw;
};
}

21
modules/secrets.nix Normal file
View file

@ -0,0 +1,21 @@
{ inputs, den, ... }: {
den.aspects.secrets.nixos = { ... }: {
imports = [ inputs.sops-nix.nixosModules.sops ];
sops = {
defaultSopsFile = ../secrets/secrets.yaml;
age.keyFile = "/etc/sops/age/keys.txt";
secrets = {
"user-password" = {
neededForUsers = true;
};
"ssh-private-key" = {
path = "/run/secrets/ssh-private-key";
owner = "zoty";
mode = "0400";
};
};
};
};
}