This commit is contained in:
monologiq 2025-12-25 10:28:27 +01:00
parent e06b409221
commit 2c37447ec3
26 changed files with 861 additions and 494 deletions

View file

@ -0,0 +1,49 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
getName
mkIf
mkMerge
optionalAttrs
;
cfg = config;
in
{
config = mkMerge [
{
environment.systemPackages = with pkgs; [
chezmoi
direnv
git
curl
vim
wget
];
users.users."${config.machine.mainUser}".packages = with pkgs; [
(vscode-with-extensions.override {
vscode = vscodium;
vscodeExtensions = with vscode-extensions; [
bbenoist.nix
jnoortheen.nix-ide
mkhl.direnv
ms-azuretools.vscode-docker
ms-python.python
ms-vscode-remote.remote-ssh
yzhang.markdown-all-in-one
];
})
];
}
(mkIf cfg.programs.zsh.enable {
environment.pathsToLink = [ "/share/zsh" ];
})
];
}

24
modules/common/nix.nix Normal file
View file

@ -0,0 +1,24 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getName mkMerge;
in
{
config = mkMerge [
{
nix = {
package = pkgs.lixPackageSets.stable.lix;
settings = {
experimental-features = [
"nix-command"
"flakes"
];
};
};
}
];
}

View file

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getName mkMerge optionalAttrs;
in
{
config = mkMerge [
{
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (getName pkg) [
"1password-cli"
"1password"
"nvidia-settings"
"nvidia-x11"
"obsidian"
"vscode-extension-ms-vscode-remote-remote-ssh"
];
}
(optionalAttrs (builtins.pathExists ../../overlays) {
nixpkgs.overlays = [
(import ../../overlays)
];
})
];
}

View file

@ -0,0 +1,16 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getName mkMerge;
in
{
config = mkMerge [
{
programs.zsh.enable = true;
}
];
}

View file

@ -0,0 +1,23 @@
{ lib, pkgs, ... }:
let
inherit (lib) getName mkMerge;
in
{
config = mkMerge [
{
homebrew = {
enable = true;
casks = [
"1password-cli"
"1password"
"adguard"
"alacritty"
"brave-browser"
"figma"
"firefox"
];
};
}
];
}

View file

@ -0,0 +1,22 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getName mkMerge;
in
{
config = mkMerge [
{
programs.zsh = {
shellInit = ''
if [ -e "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
'';
};
}
];
}

73
modules/machine.nix Normal file
View file

@ -0,0 +1,73 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkAliasOptionModule
mkOption
types
;
in
{
options.machine = {
mainUser = mkOption {
type = types.str;
description = "The main user of the machine";
};
hostName = mkOption {
type = types.str;
description = "The name of the machine";
};
filesystem.uuid = {
boot = mkOption {
type = types.nullOr types.str;
description = "The UUID of the XBOOTLDR partition.";
default = null;
};
esp = mkOption {
type = types.nullOr types.str;
description = "The UUID of the ESP.";
default = null;
};
luks = mkOption {
type = types.nullOr types.str;
description = "The UUID of the encrypted root partition.";
default = null;
};
cryptroot = mkOption {
type = types.nullOr types.str;
description = "The UUID of the decrypted root partition.";
default = null;
};
};
};
config = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
assertions = [
{
assertion = config.machine.filesystem.uuid.boot != null;
message = "machine.filesystem.uuid.boot must be set on Linux systems";
}
{
assertion = config.machine.filesystem.uuid.esp != null;
message = "machine.filesystem.uuid.esp must be set on Linux systems";
}
{
assertion = config.machine.filesystem.uuid.luks != null;
message = "machine.filesystem.uuid.luks must be set on Linux systems";
}
{
assertion = config.machine.filesystem.uuid.cryptroot != null;
message = "machine.filesystem.cryptroot.esp must be set on Linux systems";
}
];
};
}

40
modules/nixos/boot.nix Normal file
View file

@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkMerge;
boot = "cb03cf78-715e-4030-ba82-189ff8897eaf";
esp = "4E4C-1139";
luks = "0cf52ea1-16d1-4dec-a69a-bdac82bbcf25";
cryptroot = "6fb9ce3c-c870-4eb7-8199-6536ff898701";
in
{
config = mkMerge [
{
boot.bootspec.enable = true;
boot.initrd = {
kernelModules = [ ];
systemd.enable = true;
};
boot.lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
boot.loader.efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "efi";
};
boot.loader.systemd-boot = {
enable = lib.mkForce false;
xbootldrMountPoint = "/boot";
};
}
];
}

View file

@ -0,0 +1,54 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkIf mkMerge;
in
{
config = mkMerge [
{
environment.sessionVariables = {
EDITOR = "${pkgs.vim}/bin/vim";
PAGER = "${pkgs.less}/bin/less";
};
environment.systemPackages = with pkgs; [
alacritty
brave
firefox
foliate
fuzzel
loupe
mpv
adwaita-icon-theme
ddcutil
gsettings-desktop-schemas
libva-utils
loupe
sbctl
vdpauinfo
];
}
(mkIf config.programs.niri.enable {
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
})
(mkIf config.programs._1password.enable {
environment.etc = {
"1password/custom_allowed_browsers" = {
text = ''
firefox
brave
'';
mode = "0755";
};
};
})
];
}

View file

@ -0,0 +1,94 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkMerge
mkOption
optionalAttrs
types
;
boot = "cb03cf78-715e-4030-ba82-189ff8897eaf";
esp = "4E4C-1139";
luks = "0cf52ea1-16d1-4dec-a69a-bdac82bbcf25";
cryptroot = "6fb9ce3c-c870-4eb7-8199-6536ff898701";
in
{
config = mkMerge [
{
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/${boot}";
fsType = "ext4";
};
fileSystems."/efi" = {
device = "/dev/disk/by-uuid/${esp}";
fsType = "vfat";
options = [
"fmask=0137"
"dmask=0027"
];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@root" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
fileSystems."/var/cache" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_cache" ];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_log" ];
};
fileSystems."/var/spool" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_spool" ];
};
fileSystems."/var/tmp" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_tmp" ];
};
fileSystems."/var/lib/machines" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_lib_machines" ];
};
fileSystems."/var/lib/portables" = {
device = "/dev/disk/by-uuid/${cryptroot}";
fsType = "btrfs";
options = [ "subvol=@var_lib_portables" ];
};
swapDevices = [ ];
}
];
}

37
modules/nixos/fonts.nix Normal file
View file

@ -0,0 +1,37 @@
{ lib, pkgs, ... }:
let
inherit (lib) mkMerge;
in
{
config = mkMerge [
{
fonts.fontconfig = {
enable = true;
antialias = true;
hinting = {
enable = true;
style = "slight";
};
subpixel = {
rgba = "rgb";
lcdfilter = "default";
};
defaultFonts = {
serif = [
"SF Pro"
"DejaVu Serif"
];
sansSerif = [
"SF Pro"
"DejaVu Sans"
];
monospace = [
"Iosevka Cavalier"
"DejaVu Sans Mono"
];
emoji = [ "Noto Color Emoji" ];
};
};
}
];
}

View file

@ -0,0 +1,27 @@
{
config,
lib,
modulesPath,
pkgs,
...
}:
let
inherit (lib) mkDefault mkMerge;
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
config = mkMerge [
{
hardware.cpu.intel.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware;
hardware.bluetooth = {
settings = {
General.Experimental = true;
};
};
}
];
}

View file

@ -0,0 +1,37 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkDefault mkMerge optionalString;
in
{
config = mkMerge [
{
networking.dhcpcd = {
enable = config.networking.wireless.iwd.enable;
extraConfig = ''
${optionalString config.services.resolved.enable "nohook resolv.conf"}
'';
};
networking.hostName = "${config.machine.hostName}";
networking.resolvconf.enable = !config.services.resolved.enable;
networking.useDHCP = mkDefault true;
networking.wireless.iwd = {
settings = {
General = {
EnableNetworkConfiguration = !config.services.resolved.enable;
};
Network = {
EnableIPv6 = true;
NameResolvingService = "systemd";
};
};
};
}
];
}

View file

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkForce
mkIf
mkMerge
optionalAttrs
;
in
{
config = mkMerge [
{
programs.dconf.enable = config.programs.niri.enable;
programs.firefox = {
enable = true;
nativeMessagingHosts.packages = with pkgs; [ vdhcoapp ];
};
programs.niri.enable = true;
programs.regreet = {
enable = config.programs.niri.enable;
font.name = "SF Pro";
font.size = 16;
font.package = pkgs.apple-fonts.sf-pro;
settings = {
GTK = {
font_name = mkForce "SF Pro 16";
};
};
};
}
(mkIf config.programs._1password.enable {
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "pml" ];
};
})
];
}

View file

@ -0,0 +1,17 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkMerge;
in
{
config = mkMerge [
{
security.polkit.enable = config.programs.niri.enable;
security.rtkit.enable = config.services.pipewire.enable;
}
];
}

View file

@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkMerge optionalAttrs;
in
{
config = mkMerge [
{
services.avahi.enable = true;
services.openssh.enable = true;
services.pipewire = {
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
services.resolved = {
enable = true;
dnssec = "true";
domains = [ "~." ];
fallbackDns = [
"9.9.9.9#dns.quad9.net"
"149.112.112.112#dns.quad9.net"
"2620:fe::fe#dns.quad9.net"
"2620:fe::9#dns.quad9.net"
];
extraConfig = ''
DNSOverTLS=yes
'';
};
}
];
}

20
modules/nixos/system.nix Normal file
View file

@ -0,0 +1,20 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkIf mkMerge;
in
{
config = mkMerge [
(mkIf config.services.hardware.openrgb.enable {
system.activationScripts.openrgbOff = ''
mkdir -p /var/lib/OpenRGB
cp ${../../config/openrgb/off.orp} /var/lib/OpenRGB/off.orp
chmod 0644 /var/lib/OpenRGB/off.orp
'';
})
];
}