Working config for fw13 amd

This commit is contained in:
Jurn Wubben 2025-02-14 19:40:27 +00:00
commit e706230566
48 changed files with 1812 additions and 0 deletions

33
system/core/boot.nix Normal file
View file

@ -0,0 +1,33 @@
{
pkgs,
config,
...
}: {
boot = {
bootspec.enable = true;
initrd = {
systemd.enable = true;
supportedFilesystems = ["ext4"];
};
# use latest kernel
kernelPackages = pkgs.linuxPackages_latest;
consoleLogLevel = 3;
kernelParams = [
"quiet"
"systemd.show_status=auto"
"rd.udev.log_level=3"
"plymouth.use-simpledrm"
];
loader = {
# systemd-boot on UEFI
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
};
plymouth.enable = true;
};
}

6
system/core/default.nix Normal file
View file

@ -0,0 +1,6 @@
{
imports = [
./boot.nix
./users.nix
];
}

14
system/core/users.nix Normal file
View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
users.users.jsw = {
isNormalUser = true;
shell = pkgs.fish;
initialPassword = "changeme";
extraGroups = [
"libvirtd"
"NetworkManager"
"plugdev"
"dialout"
"wheel"
];
};
}

10
system/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
imports = [
./core
./hardware
./network
./nix
./programs
./services
];
}

View file

@ -0,0 +1,6 @@
{pkgs, ...}: {
hardware.bluetooth = {
enable = true;
};
environment.systemPackages = [pkgs.bluetui];
}

View file

@ -0,0 +1,16 @@
{pkgs, ...}: {
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
};
}

View file

@ -0,0 +1,9 @@
{
hardware.enableRedistributableFirmware = true;
imports = [
./bluetooth.nix
./commonGraphics.nix
./fwupd.nix
];
}

View file

@ -0,0 +1,3 @@
{
services.fwupd.enable = true;
}

12
system/network/avahi.nix Normal file
View file

@ -0,0 +1,12 @@
{
# network discovery, mDNS
services.avahi = {
enable = true;
nssmdns4 = true;
publish = {
enable = true;
domain = true;
userServices = true;
};
};
}

View file

@ -0,0 +1,28 @@
# networking configuration
{pkgs, ...}: {
networking = {
# use quad9 with DNS over TLS
nameservers = ["9.9.9.9#dns.quad9.net"];
networkmanager = {
enable = true;
dns = "systemd-resolved";
wifi.powersave = true;
};
};
services = {
openssh = {
enable = true;
settings.UseDns = true;
};
# DNS resolver
resolved = {
enable = true;
dnsovertls = "opportunistic";
};
};
systemd.services.NetworkManager-wait-online.serviceConfig.ExecStart = ["" "${pkgs.networkmanager}/bin/nm-online -q"];
}

View file

@ -0,0 +1,13 @@
{
networking.firewall = {
trustedInterfaces = ["tailscale0"];
# required to connect to Tailscale exit nodes
checkReversePath = "loose";
};
# inter-machine VPN
services.tailscale = {
enable = true;
openFirewall = true;
};
}

44
system/nix/default.nix Normal file
View file

@ -0,0 +1,44 @@
{
config,
pkgs,
inputs,
lib,
...
}: {
imports = [
./nh.nix
./nixpkgs.nix
./substituters.nix
];
# we need git for flakes
environment.systemPackages = [pkgs.git];
nix = let
flakeInputs = lib.filterAttrs (_: v: lib.isType "flake" v) inputs;
in {
package = pkgs.lix;
# pin the registry to avoid downloading and evaling a new nixpkgs version every time
registry = lib.mapAttrs (_: v: {flake = v;}) flakeInputs;
# set the path for channels compat
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
experimental-features = ["nix-command" "flakes"];
flake-registry = "/etc/nix/registry.json";
# for direnv GC roots
keep-derivations = true;
keep-outputs = true;
trusted-users = ["root" "@wheel"];
accept-flake-config = false;
};
};
system.stateVersion = "25.05";
}

11
system/nix/nh.nix Normal file
View file

@ -0,0 +1,11 @@
{
programs.nh = {
enable = true;
# weekly cleanup
clean = {
enable = true;
extraArgs = "--keep-since 30d";
};
flake = "/home/jsw/NixOS";
};
}

5
system/nix/nixpkgs.nix Normal file
View file

@ -0,0 +1,5 @@
{self, ...}: {
nixpkgs = {
config.allowUnfree = true;
};
}

View file

@ -0,0 +1,28 @@
{
nix.settings = {
substituters = [
# high priority since it's almost always used
"https://cache.nixos.org?priority=10"
# "https://anyrun.cachix.org"
# "https://fufexan.cachix.org"
# "https://helix.cachix.org"
# "https://hyprland.cachix.org"
# "https://nix-community.cachix.org"
# "https://nix-gaming.cachix.org"
# "https://yazi.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
# "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
# "fufexan.cachix.org-1:LwCDjCJNJQf5XD2BV+yamQIMZfcKWR9ISIFy5curUsY="
# "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
# "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
# "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
# "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
# "yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
];
};
}

View file

@ -0,0 +1,10 @@
{
imports = [
./fish.nix
./fonts.nix
./games.nix
./home-manager.nix
./hyprland.nix
./xdg.nix
];
}

3
system/programs/fish.nix Normal file
View file

@ -0,0 +1,3 @@
{
programs.fish.enable = true;
}

42
system/programs/fonts.nix Normal file
View file

@ -0,0 +1,42 @@
{}
# Migrated to home-manager stylix.
# {pkgs, ...}: {
# fonts = {
# packages = with pkgs; [
# # icon fonts
# material-symbols
#
# # Sans(Serif) fonts
# libertinus
# noto-fonts
# noto-fonts-cjk-sans
# noto-fonts-emoji
# roboto
# (google-fonts.override {fonts = ["Inter"];})
#
# # monospace fonts
# jetbrains-mono
#
# # nerdfonts
# nerd-fonts.jetbrains-mono
# nerd-fonts.symbols-only
# ];
#
# # causes more issues than it solves
# enableDefaultPackages = false;
#
# # user defined fonts
# # the reason there's Noto Color Emoji everywhere is to override DejaVu's
# # B&W emojis that would sometimes show instead of some Color emojis
# fontconfig.defaultFonts = let
# addAll = builtins.mapAttrs (_: v: v ++ ["Noto Color Emoji"]);
# in
# addAll {
# serif = ["Libertinus Serif"];
# sansSerif = ["Inter"];
# monospace = ["JetBrains Mono Nerd Font"];
# emoji = [];
# };
# };
# }

22
system/programs/games.nix Normal file
View file

@ -0,0 +1,22 @@
{pkgs, ...}: {
programs = {
gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
steam = {
enable = true;
extraCompatPackages = [
pkgs.proton-ge-bin
];
gamescopeSession.enable = true;
};
};
}

View file

@ -0,0 +1,15 @@
{inputs, specialArgs, config, ...}: {
imports = [
inputs.hm.nixosModules.default
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs;
users.jsw = import ../../home;
};
programs.dconf.enable = true; # else gtk-managed stuff won't work
}

View file

@ -0,0 +1,10 @@
{pkgs, ...}: {
programs.hyprland = {
enable = true;
withUWSM = true;
};
environment.systemPackages = [
pkgs.kitty # This is the default config's terminal and also my main one.
];
environment.sessionVariables.NIXOS_OZONE_WL = "1"; # Makes electron apps use wayland.
}

14
system/programs/xdg.nix Normal file
View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
config = {
common.default = ["gtk"];
hyprland.default = ["gtk" "hyprland"];
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
}

View file

@ -0,0 +1,8 @@
{
imports = [
./greetd.nix
./kanata.nix
./pipewire.nix
./power.nix
];
}

View file

@ -0,0 +1,23 @@
{
config,
lib,
...
}: {
# greetd display manager
services.greetd = let
session = {
command = "${lib.getExe config.programs.uwsm.package} start hyprland-uwsm.desktop";
user = "jsw";
};
in {
enable = true;
settings = {
terminal.vt = 1;
default_session = session;
initial_session = session;
};
};
programs.uwsm.enable = true;
}

View file

@ -0,0 +1,39 @@
{
# keyboard remapping
services.kanata = {
enable = true;
keyboards.default = {
# i know this config is aweful but it does the job.
config = ''
(defsrc
caps d w e b h j k l
)
(deflayer default
@cap _ _ _ _ _ _ _ _
)
(deflayer arrows
_ @tablayer @nextword @nextword @prevword left down up right
)
(deflayer tabs
_ _ _ _ _ @tableft _ _ @tabright
)
(defalias
cap (tap-hold-press 170 170 esc (layer-toggle arrows))
nextword (multi lctrl right)
prevword (multi lctrl left)
tablayer (layer-while-held tabs)
tableft (multi lctrl lshift tab)
tabright (multi lctrl tab)
)
'';
};
};
}

View file

@ -0,0 +1,11 @@
{lib, ...}: {
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
jack.enable = true;
pulse.enable = true;
};
services.pulseaudio.enable = lib.mkForce false;
}

10
system/services/power.nix Normal file
View file

@ -0,0 +1,10 @@
{
services = {
logind = {
powerKey = "suspend-then-hibernate";
powerKeyLongPress = "poweroff";
};
upower.enable = true;
power-profiles-daemon.enable = true;
};
}