Kieran's opinionated (and probably slightly dumb) nix config

feat: move to nixos module config

dunkirk.sh d9d75bb3 fb529424

verified
+1 -1
flake.nix
···
inputs.disko.nixosModules.disko
{ disko.devices.disk.disk1.device = "/dev/vda"; }
agenix.nixosModules.default
-
./moonlark/configuration.nix
unstable-overlays
];
};
···
inputs.disko.nixosModules.disko
{ disko.devices.disk.disk1.device = "/dev/vda"; }
agenix.nixosModules.default
+
./nixos/machines/moonlark/configuration.nix
unstable-overlays
];
};
-796
moonlark/configuration.nix
···
-
# This is your system's configuration file.
-
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
-
{
-
inputs,
-
lib,
-
config,
-
pkgs,
-
...
-
}:
-
{
-
# You can import other NixOS modules here
-
imports = [
-
# If you want to use modules from other flakes (such as nixos-hardware):
-
inputs.hardware.nixosModules.framework-11th-gen-intel
-
-
# Import your generated (nixos-generate-config) hardware configuration
-
./hardware-configuration.nix
-
-
# Import home-manager's configuration
-
./home-manager.nix
-
-
# Import disko's configuration
-
./disk-config.nix
-
-
./pam.nix
-
-
# tuigreet
-
./greetd.nix
-
];
-
-
nixpkgs = {
-
# Configure your nixpkgs instance
-
config = {
-
# Disable if you don't want unfree packages
-
allowUnfree = true;
-
};
-
};
-
-
nix =
-
let
-
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
-
in
-
{
-
settings = {
-
# Enable flakes and new 'nix' command
-
experimental-features = "nix-command flakes";
-
# Opinionated: disable global registry
-
flake-registry = "";
-
# Workaround for https://github.com/NixOS/nix/issues/9574
-
nix-path = config.nix.nixPath;
-
trusted-users = [
-
"kierank"
-
];
-
};
-
# Opinionated: disable channels
-
channel.enable = false;
-
-
optimise.automatic = true;
-
-
# Opinionated: make flake registry and nix path match flake inputs
-
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
-
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
-
};
-
-
time.timeZone = "America/New_York";
-
-
environment.systemPackages = map lib.lowPrio [
-
pkgs.curl
-
pkgs.wget
-
pkgs.dogdns
-
inputs.agenix.packages.x86_64-linux.default
-
pkgs.overskride
-
pkgs.alacritty
-
pkgs.zsh
-
pkgs.starship
-
pkgs.gh
-
pkgs.swww
-
pkgs.wluma
-
pkgs.brightnessctl
-
inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
-
pkgs.mako
-
pkgs.unstable.hyprpicker
-
pkgs.notify-desktop
-
pkgs.bc
-
pkgs.wl-clipboard
-
pkgs.psmisc
-
pkgs.jq
-
pkgs.playerctl
-
pkgs.firefox
-
pkgs.slack
-
pkgs.nautilus
-
pkgs.totem
-
pkgs.loupe
-
pkgs.simple-scan
-
pkgs.file-roller
-
pkgs.polkit_gnome
-
pkgs.fprintd
-
pkgs.gitMinimal
-
pkgs.udiskie
-
pkgs.neofetch
-
pkgs.cava
-
pkgs.go
-
pkgs.gopls
-
pkgs.gotools
-
pkgs.go-tools
-
pkgs.unstable.bun
-
pkgs.pitivi
-
pkgs.unstable.arduino-ide
-
pkgs.unstable.arduino-cli
-
pkgs.gitui
-
pkgs.vhs
-
pkgs.video-trimmer
-
pkgs.ffmpeg
-
pkgs.ngrok
-
pkgs.openssl
-
pkgs.nodePackages_latest.prisma
-
pkgs.nodejs_22
-
pkgs.invoice
-
pkgs.pop
-
pkgs.gum
-
pkgs.unstable.kicad-testing
-
pkgs.unstable.mitmproxy
-
pkgs.glow
-
pkgs.gnome-online-accounts
-
pkgs.gnome-online-accounts-gtk
-
pkgs.zoom-us
-
pkgs.mods
-
(pkgs.chromium.override { enableWideVine = true; })
-
pkgs.python3
-
pkgs.qflipper
-
pkgs.inkscape
-
pkgs.jdk23
-
pkgs.unstable.zed-editor
-
pkgs.gnome-disk-utility
-
pkgs.torrential
-
pkgs.unstable.zola
-
pkgs.unstable.amberol
-
pkgs.unstable.apktool
-
pkgs.unstable.biome
-
pkgs.gcc
-
pkgs.love
-
pkgs.unstable.aseprite
-
pkgs.audacity
-
pkgs.imagemagick
-
pkgs.wtype
-
pkgs.rustc
-
pkgs.cargo
-
pkgs.gobang
-
pkgs.caido
-
inputs.ghostty.packages.x86_64-linux.default
-
pkgs.baobab
-
pkgs.nix-prefetch
-
inputs.frc-nix.packages.${pkgs.system}.elastic-dashboard
-
inputs.frc-nix.packages.${pkgs.system}.pathplanner
-
inputs.frc-nix.packages.${pkgs.system}.roborioteamnumbersetter
-
inputs.frc-nix.packages.${pkgs.system}.sysid
-
inputs.frc-nix.packages.${pkgs.system}.wpilib-utility
-
inputs.frc-nix.packages.${pkgs.system}.advantagescope
-
pkgs.hyprpaper
-
pkgs.lxde.lxsession
-
pkgs.godot_4
-
pkgs.bambu-studio
-
pkgs.unstable.orca-slicer
-
pkgs.exiftool
-
pkgs.zenity
-
pkgs.iodine
-
pkgs.libreoffice
-
pkgs.blender
-
pkgs.screen
-
pkgs.font-manager
-
pkgs.prismlauncher
-
pkgs.openboardview
-
pkgs.unstable.claude-code
-
pkgs.ruby
-
pkgs.unstable.kikit
-
pkgs.cmake
-
pkgs.unstable.zotero
-
pkgs.wl-screenrec
-
pkgs.libnotify
-
pkgs.coreutils
-
pkgs.grim
-
pkgs.jq
-
pkgs.slurp
-
pkgs.xdg-user-dirs
-
pkgs.hyprsunset
-
inputs.nixvim.packages.x86_64-linux.default
-
inputs.zed.packages.x86_64-linux.default
-
pkgs.unstable.ollama
-
pkgs.unstable.code-cursor
-
pkgs.direnv
-
pkgs.gpgme
-
pkgs.gnupg
-
pkgs.bat
-
pkgs.fd
-
pkgs.eza
-
pkgs.xh
-
pkgs.dust
-
pkgs.ripgrep-all
-
pkgs.ripgrep
-
inputs.terminal-wakatime.packages.x86_64-linux.default
-
pkgs.unstable.metasploit
-
pkgs.unstable.wakatime-cli
-
pkgs.nixd
-
pkgs.nil
-
pkgs.nixfmt-rfc-style
-
pkgs.networkmanagerapplet
-
pkgs.networkmanager-iodine
-
pkgs.mosh
-
pkgs.clipse
-
pkgs.lazygit
-
pkgs.gh-dash
-
pkgs.vesktop
-
pkgs.inetutils
-
pkgs.calc
-
pkgs.nix-output-monitor
-
pkgs.nixpkgs-review
-
inputs.flare.packages.x86_64-linux.default
-
];
-
-
programs.nh = {
-
enable = true;
-
clean.enable = true;
-
clean.extraArgs = "--keep-since 4d --keep 3";
-
flake = "/home/kierank/dots";
-
};
-
-
services.gnome.gnome-keyring.enable = true;
-
programs.dconf.enable = true;
-
-
systemd = {
-
user.services.polkit-gnome-authentication-agent-1 = {
-
description = "polkit-gnome-authentication-agent-1";
-
wantedBy = [ "graphical-session.target" ];
-
wants = [ "graphical-session.target" ];
-
after = [ "graphical-session.target" ];
-
serviceConfig = {
-
Type = "simple";
-
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
-
Restart = "on-failure";
-
RestartSec = 1;
-
TimeoutStopSec = 10;
-
};
-
};
-
};
-
-
fonts.packages =
-
with pkgs;
-
[
-
fira
-
comic-neue
-
]
-
++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
-
-
# import the secret
-
age.identityPaths = [
-
"/home/kierank/.ssh/id_rsa"
-
"/etc/ssh/id_rsa"
-
"/mnt/etc/ssh/id_rsa"
-
];
-
age.secrets = {
-
wifi = {
-
file = ../secrets/wifi.age;
-
owner = "kierank";
-
};
-
resend = {
-
file = ../secrets/resend.age;
-
owner = "kierank";
-
};
-
wakatime = {
-
file = ../secrets/wakatime.age;
-
path = "/home/kierank/.wakatime.cfg";
-
owner = "kierank";
-
};
-
bluesky = {
-
file = ../secrets/bluesky.age;
-
owner = "kierank";
-
};
-
iodine = {
-
file = ../secrets/iodine.age;
-
owner = "kierank";
-
};
-
};
-
-
environment.sessionVariables = {
-
XDG_CACHE_HOME = "$HOME/.cache";
-
XDG_CONFIG_HOME = "$HOME/.config";
-
XDG_DATA_HOME = "$HOME/.local/share";
-
XDG_STATE_HOME = "$HOME/.local/state";
-
NIXOS_OZONE_WL = "1";
-
PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
-
PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
-
PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine";
-
RESEND_API_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.resend.path})";
-
POP_FROM = "me@dunkirk.sh";
-
EDITOR = "nvim";
-
SYSTEMD_EDITOR = "nvim";
-
VISUAL = "nvim";
-
};
-
-
# setup the network
-
networking = {
-
networkmanager = {
-
enable = true;
-
dns = "none";
-
ensureProfiles = {
-
environmentFiles = [ config.age.secrets.wifi.path ];
-
profiles = {
-
"KlukasNet" = {
-
connection = {
-
id = "KlukasNet";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "KlukasNet";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_home";
-
};
-
};
-
"Everseen" = {
-
connection = {
-
id = "Everseen";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "Everseen";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_hotspot";
-
};
-
};
-
"SAAC Sanctuary" = {
-
connection = {
-
id = "SAAC Sanctuary";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "SAAC Sanctuary";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_church";
-
};
-
};
-
"MVNU-student" = {
-
connection = {
-
id = "MVNU-student";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "MVNU-student";
-
};
-
};
-
"Status Solutions Guest" = {
-
connection = {
-
id = "Status Solutions Guest";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "Status Solutions Guest";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_robotics";
-
};
-
};
-
"FRC-1317-CECE" = {
-
connection = {
-
id = "FRC-1317-CECE";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "FRC-1317-CECE";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "digitalfusion";
-
};
-
};
-
"1317-fortress-of-awesomeness" = {
-
connection = {
-
id = "1317-fortress-of-awesomeness";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "1317-fortress-of-awesomeness";
-
};
-
};
-
"PAST PD" = {
-
connection = {
-
id = "PAST PD";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "PAST PD";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_past";
-
};
-
};
-
"Heartland" = {
-
connection = {
-
id = "Heartland";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "Heartland";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "beourguest";
-
};
-
};
-
"WPL_Public_AccessII" = {
-
connection = {
-
id = "WPL_Public_AccessII";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "WPL_Public_AccessII";
-
};
-
};
-
"Yowzaford" = {
-
connection = {
-
id = "Yowzaford";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "Yowzaford";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "$psk_rhoda";
-
};
-
};
-
"cu-events" = {
-
connection = {
-
id = "cu-events";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "cu-events";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "freesmile82";
-
};
-
};
-
"QargoCoffee-Guest" = {
-
connection = {
-
id = "QargoCoffee-Guest";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "QargoCoffee-Guest";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "Lavazza@7";
-
};
-
};
-
"Fulton" = {
-
connection = {
-
id = "Fulton";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "Fulton";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "9064405930";
-
};
-
};
-
"TP-LINK_ECF0" = {
-
connection = {
-
id = "TP-LINK_ECF0";
-
type = "wifi";
-
};
-
ipv4 = {
-
method = "auto";
-
};
-
ipv6 = {
-
addr-gen-mode = "stable-privacy";
-
method = "auto";
-
};
-
wifi = {
-
mode = "infrastructure";
-
ssid = "TP-LINK_ECF0";
-
};
-
wifi-security = {
-
key-mgmt = "wpa-psk";
-
psk = "ad1066AD!";
-
};
-
};
-
};
-
};
-
};
-
hostName = "moonlark";
-
nameservers = [
-
"1.1.1.1"
-
"1.0.0.1"
-
"8.8.8.8"
-
"9.9.9.9"
-
];
-
useDHCP = false;
-
dhcpcd.enable = false;
-
};
-
-
services.iodine.clients = {
-
t1 = {
-
server = "t1.dunkirk.sh";
-
passwordFile = config.age.secrets.iodine.path;
-
};
-
};
-
-
virtualisation.libvirtd.enable = true;
-
virtualisation.virtualbox.host.enable = true;
-
virtualisation.virtualbox.host.enableExtensionPack = true;
-
virtualisation.docker.enable = true;
-
-
programs.nix-ld.enable = true;
-
-
programs.zsh.enable = true;
-
-
programs.direnv.enable = true;
-
-
services.postgresql = {
-
enable = true;
-
enableTCPIP = true;
-
authentication = pkgs.lib.mkOverride 10 ''
-
#type database DBuser origin-address auth-method
-
local all all trust
-
# ... other auth rules ...
-
-
# ipv4
-
host all all 127.0.0.1/32 trust
-
# ipv6
-
host all all ::1/128 trust
-
'';
-
};
-
-
# TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
-
users.users = {
-
kierank = {
-
# You can skip setting a root password by passing '--no-root-passwd' to nixos-install.
-
# Be sure to change it (using passwd) after rebooting!
-
initialPassword = "lolzthisaintsecure!";
-
isNormalUser = true;
-
shell = pkgs.zsh;
-
openssh.authorizedKeys.keys = [
-
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay"
-
];
-
extraGroups = [
-
"wheel"
-
"networkmanager"
-
"audio"
-
"video"
-
"docker"
-
"plugdev"
-
"input"
-
"dialout"
-
"docker"
-
"libvirtd"
-
"vboxusers"
-
];
-
};
-
root.openssh.authorizedKeys.keys = [
-
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay"
-
];
-
};
-
-
programs.steam = {
-
enable = true;
-
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
-
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
-
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
-
};
-
-
programs.hyprland.enable = true;
-
services.hypridle.enable = true;
-
-
programs.niri = {
-
enable = true;
-
};
-
-
programs.xwayland.enable = lib.mkForce true;
-
-
services.udev.packages = [
-
pkgs.qFlipper
-
pkgs.via
-
];
-
-
security.polkit.enable = true;
-
-
# enable cups
-
services.printing.enable = true;
-
services.avahi = {
-
enable = true;
-
nssmdns4 = true;
-
openFirewall = true;
-
};
-
-
# enable bluetooth
-
hardware.bluetooth.enable = true;
-
-
# enable pipewire
-
# rtkit is optional but recommended
-
security.rtkit.enable = true;
-
services.pipewire = {
-
enable = true;
-
alsa.enable = true;
-
alsa.support32Bit = true;
-
pulse.enable = true;
-
# If you want to use JACK applications, uncomment this
-
jack.enable = true;
-
};
-
-
# This setups a SSH server. Very important if you're setting up a headless system.
-
# Feel free to remove if you don't need it.
-
services.openssh = {
-
enable = true;
-
settings = {
-
# Opinionated: forbid root login through SSH.
-
PermitRootLogin = "no";
-
# Opinionated: use keys only.
-
# Remove if you want to SSH using passwords
-
PasswordAuthentication = false;
-
};
-
};
-
-
networking.firewall = {
-
enable = true;
-
allowedTCPPorts = [
-
4455
-
51820
-
];
-
allowedUDPPorts = [
-
4455
-
51820
-
];
-
};
-
-
services.tailscale = {
-
enable = true;
-
useRoutingFeatures = "client";
-
};
-
-
services.devmon.enable = true;
-
services.gvfs.enable = true;
-
services.udisks2.enable = true;
-
-
services.logind.extraConfig = ''
-
# don't shutdown when power button is short-pressed
-
HandlePowerKey=ignore
-
HandlePowerKeyLongPress=poweroff
-
'';
-
-
# Requires at least 5.16 for working wi-fi and bluetooth.
-
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
-
boot = {
-
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (
-
lib.mkDefault pkgs.linuxPackages_latest
-
);
-
loader.grub = {
-
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
-
device = "nodev";
-
efiSupport = true;
-
efiInstallAsRemovable = true;
-
};
-
supportedFilesystems = [ "ntfs" ];
-
extraModprobeConfig = ''
-
options kvm_intel nested=1
-
options kvm_intel emulate_invalid_guest_state=0
-
options kvm ignore_msrs=1
-
'';
-
};
-
-
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
-
system.stateVersion = "23.05";
-
}
···
moonlark/disk-config.nix nixos/machines/moonlark/disk-config.nix
-30
moonlark/greetd.nix
···
-
{ pkgs, ... }:
-
let
-
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
-
in
-
{
-
services.greetd = {
-
enable = true;
-
settings = {
-
default_session = {
-
command = "${tuigreet} --time -g 'WARNING: UNAUTHORIZED ACCESS WILL RESULT IN TERMINATION OF SESSION. IDENTIFY YOURSELF' --remember --cmd Hyprland";
-
user = "greeter";
-
};
-
};
-
};
-
-
# this is a life saver.
-
# literally no documentation about this anywhere.
-
# might be good to write about this...
-
# https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/
-
systemd.services.greetd.serviceConfig = {
-
Type = "idle";
-
StandardInput = "tty";
-
StandardOutput = "tty";
-
StandardError = "journal"; # Without this errors will spam on screen
-
# Without these bootlogs will spam on screen
-
TTYReset = true;
-
TTYVHangup = true;
-
TTYVTDisallocate = true;
-
};
-
}
···
moonlark/hardware-configuration.nix nixos/machines/moonlark/hardware-configuration.nix
+4 -2
moonlark/home-manager.nix nixos/machines/moonlark/home-manager.nix
···
];
home-manager = {
-
extraSpecialArgs = { inherit inputs outputs; };
users = {
# Import your home-manager configuration
-
kierank = import ../home-manager/machines/moonlark;
};
};
}
···
];
home-manager = {
+
extraSpecialArgs = {
+
inherit inputs outputs;
+
};
users = {
# Import your home-manager configuration
+
kierank = import ../../../home-manager/machines/moonlark;
};
};
}
-69
moonlark/pam.nix
···
-
{
-
lib,
-
config,
-
pkgs,
-
...
-
}:
-
{
-
services.fprintd.enable = true;
-
security.pam.services.hyprlock = lib.mkIf (config.services.fprintd.enable) {
-
text = ''
-
# Account management.
-
account required pam_unix.so # unix (order 10900)
-
-
# Authentication management.
-
auth sufficient pam_unix.so try_first_pass likeauth nullok
-
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
-
auth required pam_deny.so # deny
-
-
# Password management.
-
password sufficient pam_unix.so nullok yescrypt # unix
-
-
# Session management.
-
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
-
session required pam_unix.so # unix (order 10200)
-
'';
-
};
-
-
security.pam.services.sudo = lib.mkIf (config.services.fprintd.enable) {
-
text = ''
-
# Account management.
-
account required pam_unix.so # unix (order 10900)
-
-
# Authentication management.
-
auth sufficient pam_unix.so try_first_pass likeauth nullok
-
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
-
auth required pam_deny.so # deny
-
-
# Password management.
-
password sufficient pam_unix.so nullok yescrypt # unix
-
-
# Session management.
-
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
-
session required pam_unix.so # unix (order 10200)
-
'';
-
};
-
-
security.pam.services.su = lib.mkIf (config.services.fprintd.enable) {
-
text = ''
-
# Account management.
-
account required pam_unix.so # unix (order 10900)
-
-
# Authentication management.
-
auth sufficient pam_rootok.so # rootok (order 10200)
-
auth required pam_faillock.so # faillock (order 10400)
-
auth sufficient pam_unix.so try_first_pass likeauth nullok
-
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
-
auth required pam_deny.so # deny
-
-
# Password management.
-
password sufficient pam_unix.so nullok yescrypt # unix
-
-
# Session management.
-
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
-
session required pam_unix.so # unix (order 10200)
-
session required pam_unix.so # unix (order 10200)
-
session optional pam_xauth.so systemuser=99 xauthpath=${pkgs.xorg.xauth}/bin/xauth # xauth (order 12100)
-
'';
-
};
-
}
···
+506
nixos/machines/moonlark/configuration.nix
···
···
+
# This is your system's configuration file.
+
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
+
{
+
inputs,
+
lib,
+
config,
+
pkgs,
+
...
+
}:
+
{
+
imports = [
+
inputs.hardware.nixosModules.framework-11th-gen-intel
+
+
./hardware-configuration.nix
+
./home-manager.nix
+
./disk-config.nix
+
+
../../modules
+
];
+
+
nixpkgs = {
+
config = {
+
allowUnfree = true;
+
};
+
};
+
+
nix =
+
let
+
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
+
in
+
{
+
settings = {
+
# Enable flakes and new 'nix' command
+
experimental-features = "nix-command flakes";
+
# Opinionated: disable global registry
+
flake-registry = "";
+
# Workaround for https://github.com/NixOS/nix/issues/9574
+
nix-path = config.nix.nixPath;
+
trusted-users = [
+
"kierank"
+
];
+
};
+
# Opinionated: disable channels
+
channel.enable = false;
+
+
optimise.automatic = true;
+
+
# Opinionated: make flake registry and nix path match flake inputs
+
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
+
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
+
};
+
+
time.timeZone = "America/New_York";
+
+
# grouped for readability
+
environment.systemPackages = map lib.lowPrio (
+
let
+
core = [
+
pkgs.coreutils
+
pkgs.calc
+
pkgs.screen
+
pkgs.xdg-user-dirs
+
pkgs.libnotify
+
pkgs.notify-desktop
+
pkgs.bc
+
pkgs.jq
+
pkgs.psmisc
+
];
+
terminals = [
+
pkgs.alacritty
+
inputs.ghostty.packages.x86_64-linux.default
+
];
+
cli_utils = [
+
pkgs.bat
+
pkgs.fd
+
pkgs.eza
+
pkgs.xh
+
pkgs.dust
+
pkgs.ripgrep
+
pkgs.ripgrep-all
+
pkgs.glow
+
pkgs.gitui
+
pkgs.lazygit
+
pkgs.clipse
+
pkgs.direnv
+
pkgs.nix-output-monitor
+
pkgs.nixpkgs-review
+
pkgs.nix-prefetch
+
pkgs.arduino-cli
+
pkgs.zsh
+
pkgs.starship
+
pkgs.gum
+
pkgs.unstable.wakatime-cli
+
inputs.terminal-wakatime.packages.x86_64-linux.default
+
];
+
networking = [
+
pkgs.curl
+
pkgs.wget
+
pkgs.dogdns
+
pkgs.inetutils
+
pkgs.mosh
+
pkgs.ngrok
+
pkgs.networkmanagerapplet
+
pkgs.networkmanager-iodine
+
pkgs.iodine
+
];
+
nix_tools = [
+
inputs.nixvim.packages.x86_64-linux.default
+
pkgs.nixd
+
pkgs.nil
+
pkgs.nixfmt-rfc-style
+
inputs.agenix.packages.x86_64-linux.default
+
];
+
security = [
+
pkgs.openssl
+
pkgs.gpgme
+
pkgs.gnupg
+
pkgs.unstable.mitmproxy
+
pkgs.caido
+
];
+
editors = [
+
inputs.zed.packages.x86_64-linux.default
+
pkgs.unstable.zed-editor
+
pkgs.arduino-ide
+
];
+
browsers = [
+
pkgs.firefox
+
(pkgs.chromium.override { enableWideVine = true; })
+
];
+
wayland = [
+
pkgs.swww
+
pkgs.wluma
+
pkgs.brightnessctl
+
pkgs.hyprpaper
+
pkgs.hyprsunset
+
pkgs.wl-clipboard
+
pkgs.grim
+
pkgs.slurp
+
pkgs.wtype
+
pkgs.mako
+
pkgs.unstable.hyprpicker
+
pkgs.wl-screenrec
+
inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
+
pkgs.playerctl
+
pkgs.libnotify
+
pkgs.notify-desktop
+
pkgs.lxde.lxsession
+
];
+
gnome = [
+
pkgs.gnome-online-accounts
+
pkgs.gnome-online-accounts-gtk
+
pkgs.gnome-disk-utility
+
pkgs.baobab
+
pkgs.simple-scan
+
pkgs.file-roller
+
pkgs.font-manager
+
pkgs.nautilus
+
pkgs.loupe
+
pkgs.totem
+
pkgs.overskride
+
];
+
dev_langs = [
+
pkgs.nodejs_22
+
pkgs.unstable.bun
+
pkgs.python3
+
pkgs.go
+
pkgs.gopls
+
pkgs.gotools
+
pkgs.go-tools
+
pkgs.gcc
+
pkgs.rustc
+
pkgs.cargo
+
pkgs.jdk23
+
pkgs.ruby
+
pkgs.cmake
+
pkgs.unstable.biome
+
pkgs.unstable.apktool
+
pkgs.nodePackages_latest.prisma
+
pkgs.unstable.zola
+
];
+
media = [
+
pkgs.ffmpeg
+
pkgs.video-trimmer
+
pkgs.pitivi
+
pkgs.audacity
+
pkgs.unstable.amberol
+
pkgs.zoom-us
+
];
+
graphics = [
+
pkgs.imagemagick
+
pkgs.inkscape
+
pkgs.blender
+
pkgs.exiftool
+
pkgs.unstable.aseprite
+
pkgs.godot_4
+
pkgs.unstable.kikit
+
pkgs.openboardview
+
pkgs.bambu-studio
+
pkgs.unstable.orca-slicer
+
pkgs.qflipper
+
];
+
office = [
+
pkgs.slack
+
pkgs.libreoffice
+
pkgs.unstable.zotero
+
];
+
gaming = [
+
pkgs.prismlauncher
+
pkgs.vesktop
+
pkgs.cava
+
pkgs.gobang
+
pkgs.love
+
];
+
frc = [
+
inputs.frc-nix.packages.${pkgs.system}.elastic-dashboard
+
inputs.frc-nix.packages.${pkgs.system}.pathplanner
+
inputs.frc-nix.packages.${pkgs.system}.roborioteamnumbersetter
+
inputs.frc-nix.packages.${pkgs.system}.sysid
+
inputs.frc-nix.packages.${pkgs.system}.wpilib-utility
+
inputs.frc-nix.packages.${pkgs.system}.advantagescope
+
];
+
misc = [
+
pkgs.invoice
+
pkgs.pop
+
pkgs.vhs
+
pkgs.torrential
+
inputs.flare.packages.x86_64-linux.default
+
pkgs.unstable.ollama
+
pkgs.unstable.claude-code
+
pkgs.udiskie
+
pkgs.neofetch
+
pkgs.unstable.kicad-testing
+
pkgs.zenity
+
];
+
in
+
core
+
++ terminals
+
++ cli_utils
+
++ networking
+
++ nix_tools
+
++ security
+
++ editors
+
++ browsers
+
++ wayland
+
++ gnome
+
++ dev_langs
+
++ media
+
++ graphics
+
++ office
+
++ gaming
+
++ frc
+
++ misc
+
);
+
+
programs.nh = {
+
enable = true;
+
clean.enable = true;
+
clean.extraArgs = "--keep-since 4d --keep 3";
+
flake = "/home/kierank/dots";
+
};
+
+
fonts.packages =
+
with pkgs;
+
[
+
fira
+
comic-neue
+
]
+
++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
+
+
# import the secret
+
age.identityPaths = [
+
"/home/kierank/.ssh/id_rsa"
+
"/etc/ssh/id_rsa"
+
"/mnt/etc/ssh/id_rsa"
+
];
+
age.secrets = {
+
wifi = {
+
file = ../../../secrets/wifi.age;
+
owner = "kierank";
+
};
+
resend = {
+
file = ../../../secrets/resend.age;
+
owner = "kierank";
+
};
+
wakatime = {
+
file = ../../../secrets/wakatime.age;
+
path = "/home/kierank/.wakatime.cfg";
+
owner = "kierank";
+
};
+
bluesky = {
+
file = ../../../secrets/bluesky.age;
+
owner = "kierank";
+
};
+
iodine = {
+
file = ../../../secrets/iodine.age;
+
owner = "kierank";
+
};
+
};
+
+
environment.sessionVariables = {
+
XDG_CACHE_HOME = "$HOME/.cache";
+
XDG_CONFIG_HOME = "$HOME/.config";
+
XDG_DATA_HOME = "$HOME/.local/share";
+
XDG_STATE_HOME = "$HOME/.local/state";
+
NIXOS_OZONE_WL = "1";
+
PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
+
PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
+
PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine";
+
RESEND_API_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.resend.path})";
+
POP_FROM = "me@dunkirk.sh";
+
EDITOR = "nvim";
+
SYSTEMD_EDITOR = "nvim";
+
VISUAL = "nvim";
+
};
+
+
modules = {
+
authentication.enable = true;
+
apps.tuigreet = {
+
enable = true;
+
command = "Hyprland";
+
};
+
network.wifi = {
+
enable = true;
+
hostName = "moonlark";
+
nameservers = [
+
"1.1.1.1"
+
"1.0.0.1"
+
"8.8.8.8"
+
"9.9.9.9"
+
];
+
envFile = config.age.secrets.wifi.path;
+
profiles = {
+
"KlukasNet".pskVar = "psk_home";
+
"Everseen".pskVar = "psk_hotspot";
+
"SAAC Sanctuary".pskVar = "psk_church";
+
"MVNU-student" = { };
+
"Status Solutions Guest".pskVar = "psk_robotics";
+
"FRC-1317-CECE".psk = "digitalfusion";
+
"1317-fortress-of-awesomeness" = { };
+
"PAST PD".pskVar = "psk_past";
+
"Heartland".psk = "beourguest";
+
"WPL_Public_AccessII" = { };
+
"Yowzaford".pskVar = "psk_rhoda";
+
"cu-events".psk = "freesmile82";
+
"QargoCoffee-Guest".psk = "Lavazza@7";
+
"Fulton".psk = "9064405930";
+
"TP-LINK_ECF0".psk = "ad1066AD!";
+
};
+
};
+
};
+
+
services.iodine.clients = {
+
t1 = {
+
server = "t1.dunkirk.sh";
+
passwordFile = config.age.secrets.iodine.path;
+
};
+
};
+
+
virtualisation = {
+
libvirtd.enable = true;
+
virtualbox = {
+
host.enable = true;
+
host.enableExtensionPack = true;
+
};
+
docker.enable = true;
+
};
+
+
programs.nix-ld.enable = true;
+
+
programs.zsh.enable = true;
+
+
programs.direnv.enable = true;
+
+
# TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
+
users.users = {
+
kierank = {
+
# You can skip setting a root password by passing '--no-root-passwd' to nixos-install.
+
# Be sure to change it (using passwd) after rebooting!
+
initialPassword = "lolzthisaintsecure!";
+
isNormalUser = true;
+
shell = pkgs.zsh;
+
openssh.authorizedKeys.keys = [
+
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay"
+
];
+
extraGroups = [
+
"wheel"
+
"networkmanager"
+
"audio"
+
"video"
+
"docker"
+
"plugdev"
+
"input"
+
"dialout"
+
"docker"
+
"libvirtd"
+
"vboxusers"
+
];
+
};
+
root.openssh.authorizedKeys.keys = [
+
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay"
+
];
+
};
+
+
programs.steam = {
+
enable = true;
+
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
+
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
+
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
+
};
+
+
programs.hyprland.enable = true;
+
services.hypridle.enable = true;
+
+
programs.xwayland.enable = lib.mkForce true;
+
+
services.udev.packages = [
+
pkgs.qFlipper
+
pkgs.via
+
];
+
+
# enable cups
+
services.printing.enable = true;
+
services.avahi = {
+
enable = true;
+
nssmdns4 = true;
+
openFirewall = true;
+
};
+
+
# enable bluetooth
+
hardware.bluetooth.enable = true;
+
+
# enable pipewire
+
# rtkit is optional but recommended
+
security.rtkit.enable = true;
+
services.pipewire = {
+
enable = true;
+
alsa.enable = true;
+
alsa.support32Bit = true;
+
pulse.enable = true;
+
# If you want to use JACK applications, uncomment this
+
jack.enable = true;
+
};
+
+
# This setups a SSH server. Very important if you're setting up a headless system.
+
# Feel free to remove if you don't need it.
+
services.openssh = {
+
enable = true;
+
settings = {
+
# Opinionated: forbid root login through SSH.
+
PermitRootLogin = "no";
+
# Opinionated: use keys only.
+
# Remove if you want to SSH using passwords
+
PasswordAuthentication = false;
+
};
+
};
+
+
networking.firewall = {
+
enable = true;
+
allowedTCPPorts = [
+
4455
+
51820
+
];
+
allowedUDPPorts = [
+
4455
+
51820
+
];
+
};
+
+
services.tailscale = {
+
enable = true;
+
useRoutingFeatures = "client";
+
};
+
+
services.devmon.enable = true;
+
services.gvfs.enable = true;
+
services.udisks2.enable = true;
+
+
services.logind.extraConfig = ''
+
# don't shutdown when power button is short-pressed
+
HandlePowerKey=ignore
+
HandlePowerKeyLongPress=poweroff
+
'';
+
+
# Requires at least 5.16 for working wi-fi and bluetooth.
+
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
+
boot = {
+
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (
+
lib.mkDefault pkgs.linuxPackages_latest
+
);
+
loader.grub = {
+
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
+
device = "nodev";
+
efiSupport = true;
+
efiInstallAsRemovable = true;
+
};
+
supportedFilesystems = [ "ntfs" ];
+
extraModprobeConfig = ''
+
options kvm_intel nested=1
+
options kvm_intel emulate_invalid_guest_state=0
+
options kvm ignore_msrs=1
+
'';
+
};
+
+
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
+
system.stateVersion = "23.05";
+
}
+6
nixos/modules/apps/default.nix
···
···
+
{ ... }:
+
{
+
imports = [
+
./tuigreet.nix
+
];
+
}
+296
nixos/modules/apps/tuigreet.nix
···
···
+
{
+
lib,
+
config,
+
pkgs,
+
...
+
}:
+
let
+
cfg = config.modules.apps.tuigreet;
+
tuigreetBin = "${pkgs.greetd.tuigreet}/bin/tuigreet";
+
msg = cfg.greeting;
+
baseArgs =
+
[ ]
+
++ lib.optionals cfg.time [ "--time" ]
+
++ lib.optionals cfg.issue [ "--issue" ]
+
++ lib.optionals (msg != null && msg != "") [
+
"-g"
+
msg
+
]
+
++ lib.optionals (cfg.timeFormat != null) [
+
"--time-format"
+
cfg.timeFormat
+
]
+
++ lib.optionals (cfg.width != null) [
+
"--width"
+
(toString cfg.width)
+
]
+
++ lib.optionals (cfg.theme != null) [
+
"--theme"
+
cfg.theme
+
]
+
++ lib.optionals cfg.asterisks [ "--asterisks" ]
+
++ lib.optionals (cfg.asterisksChar != null) [
+
"--asterisks-char"
+
cfg.asterisksChar
+
]
+
++ lib.optionals (cfg.windowPadding != null) [
+
"--window-padding"
+
(toString cfg.windowPadding)
+
]
+
++ lib.optionals (cfg.containerPadding != null) [
+
"--container-padding"
+
(toString cfg.containerPadding)
+
]
+
++ lib.optionals (cfg.promptPadding != null) [
+
"--prompt-padding"
+
(toString cfg.promptPadding)
+
]
+
++ lib.optionals (cfg.greetAlign != null) [
+
"--greet-align"
+
cfg.greetAlign
+
]
+
++ lib.optionals cfg.remember [ "--remember" ]
+
++ lib.optionals cfg.rememberSession [ "--remember-session" ]
+
++ lib.optionals cfg.rememberUserSession [ "--remember-user-session" ]
+
++ lib.optionals cfg.userMenu [ "--user-menu" ]
+
++ lib.optionals (cfg.userMenuMinUid != null) [
+
"--user-menu-min-uid"
+
(toString cfg.userMenuMinUid)
+
]
+
++ lib.optionals (cfg.userMenuMaxUid != null) [
+
"--user-menu-max-uid"
+
(toString cfg.userMenuMaxUid)
+
]
+
++ lib.concatMap (e: [
+
"--env"
+
e
+
]) cfg.env
+
++ lib.optionals (cfg.sessions != null && cfg.sessions != [ ]) [
+
"--sessions"
+
(lib.concatStringsSep ":" cfg.sessions)
+
]
+
++ lib.optionals (cfg.xsessions != null && cfg.xsessions != [ ]) [
+
"--xsessions"
+
(lib.concatStringsSep ":" cfg.xsessions)
+
]
+
++ lib.optionals (cfg.sessionWrapper != null && cfg.sessionWrapper != [ ]) [
+
"--session-wrapper"
+
(lib.concatStringsSep " " cfg.sessionWrapper)
+
]
+
++ lib.optionals (cfg.xsessionWrapper != null && cfg.xsessionWrapper != [ ]) [
+
"--xsession-wrapper"
+
(lib.concatStringsSep " " cfg.xsessionWrapper)
+
]
+
++ lib.optionals cfg.noXsessionWrapper [ "--no-xsession-wrapper" ]
+
++ lib.optionals (cfg.powerShutdown != null && cfg.powerShutdown != [ ]) [
+
"--power-shutdown"
+
(lib.concatStringsSep " " cfg.powerShutdown)
+
]
+
++ lib.optionals (cfg.powerReboot != null && cfg.powerReboot != [ ]) [
+
"--power-reboot"
+
(lib.concatStringsSep " " cfg.powerReboot)
+
]
+
++ lib.optionals cfg.powerNoSetsid [ "--power-no-setsid" ]
+
++ lib.optionals (cfg.kbCommand != null) [
+
"--kb-command"
+
(toString cfg.kbCommand)
+
]
+
++ lib.optionals (cfg.kbSessions != null) [
+
"--kb-sessions"
+
(toString cfg.kbSessions)
+
]
+
++ lib.optionals (cfg.kbPower != null) [
+
"--kb-power"
+
(toString cfg.kbPower)
+
]
+
++ cfg.extraArgs;
+
cmd = lib.concatStringsSep " " (
+
[ tuigreetBin ]
+
++ baseArgs
+
++ [
+
"--cmd"
+
cfg.command
+
]
+
++ lib.optional (cfg.debugFile != null) ("--debug " + cfg.debugFile)
+
);
+
in
+
{
+
options.modules.apps.tuigreet = {
+
enable = lib.mkEnableOption "Enable greetd with tuigreet";
+
+
command = lib.mkOption {
+
type = lib.types.str;
+
default = "Hyprland";
+
description = "Command to launch after login (e.g., Hyprland, niri, sway, etc.)";
+
};
+
+
extraArgs = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
description = "Extra arguments passed to tuigreet (appended).";
+
};
+
+
greeting = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
+
default = "WARNING: UNAUTHORIZED ACCESS WILL RESULT IN TERMINATION OF SESSION. IDENTIFY YOURSELF";
+
description = "Greeting text shown above login prompt (-g/--greeting).";
+
};
+
+
time = lib.mkOption {
+
type = lib.types.bool;
+
default = true;
+
description = "Show time";
+
};
+
issue = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
description = "Show /etc/issue";
+
};
+
timeFormat = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
+
default = null;
+
};
+
width = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.positive;
+
default = null;
+
};
+
theme = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
+
default = null;
+
};
+
asterisks = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
asterisksChar = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
+
default = null;
+
};
+
windowPadding = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.unsigned;
+
default = null;
+
};
+
containerPadding = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.unsigned;
+
default = null;
+
};
+
promptPadding = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.unsigned;
+
default = null;
+
};
+
greetAlign = lib.mkOption {
+
type = lib.types.nullOr (
+
lib.types.enum [
+
"left"
+
"center"
+
"right"
+
]
+
);
+
default = null;
+
};
+
+
remember = lib.mkOption {
+
type = lib.types.bool;
+
default = true;
+
};
+
rememberSession = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
rememberUserSession = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
userMenu = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
userMenuMinUid = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.positive;
+
default = null;
+
};
+
userMenuMaxUid = lib.mkOption {
+
type = lib.types.nullOr lib.types.ints.positive;
+
default = null;
+
};
+
+
env = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
sessions = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
xsessions = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
+
sessionWrapper = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
xsessionWrapper = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
noXsessionWrapper = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
+
powerShutdown = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
powerReboot = lib.mkOption {
+
type = lib.types.listOf lib.types.str;
+
default = [ ];
+
};
+
powerNoSetsid = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
};
+
+
kbCommand = lib.mkOption {
+
type = lib.types.nullOr (lib.types.ints.between 1 12);
+
default = null;
+
};
+
kbSessions = lib.mkOption {
+
type = lib.types.nullOr (lib.types.ints.between 1 12);
+
default = null;
+
};
+
kbPower = lib.mkOption {
+
type = lib.types.nullOr (lib.types.ints.between 1 12);
+
default = null;
+
};
+
+
debugFile = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
+
default = null;
+
};
+
};
+
+
config = lib.mkIf cfg.enable {
+
services.greetd = {
+
enable = true;
+
settings = {
+
default_session = {
+
command = cmd;
+
user = "greeter";
+
};
+
};
+
};
+
+
systemd.services.greetd.serviceConfig = {
+
Type = "idle";
+
StandardInput = "tty";
+
StandardOutput = "tty";
+
StandardError = "journal";
+
TTYReset = true;
+
TTYVHangup = true;
+
TTYVTDisallocate = true;
+
};
+
};
+
}
+99
nixos/modules/authentication.nix
···
···
+
{
+
lib,
+
config,
+
pkgs,
+
...
+
}:
+
let
+
cfg = config.modules.authentication;
+
in
+
{
+
options.modules.authentication.enable = lib.mkEnableOption "Enable authentication stack (polkit, keyring, PAM with fprintd)";
+
+
config = lib.mkIf cfg.enable {
+
services.fprintd.enable = true;
+
security.polkit.enable = true;
+
services.gnome.gnome-keyring.enable = true;
+
programs.dconf.enable = true;
+
+
environment.systemPackages = [
+
pkgs.polkit_gnome
+
pkgs.fprintd
+
];
+
+
systemd.user.services.polkit-gnome-authentication-agent-1 = {
+
description = "polkit-gnome-authentication-agent-1";
+
wantedBy = [ "graphical-session.target" ];
+
wants = [ "graphical-session.target" ];
+
after = [ "graphical-session.target" ];
+
serviceConfig = {
+
Type = "simple";
+
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
+
Restart = "on-failure";
+
RestartSec = 1;
+
TimeoutStopSec = 10;
+
};
+
};
+
+
security.pam.services.hyprlock = lib.mkIf (config.services.fprintd.enable) {
+
text = ''
+
# Account management.
+
account required pam_unix.so # unix (order 10900)
+
+
# Authentication management.
+
auth sufficient pam_unix.so try_first_pass likeauth nullok
+
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
+
auth required pam_deny.so # deny
+
+
# Password management.
+
password sufficient pam_unix.so nullok yescrypt # unix
+
+
# Session management.
+
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
+
session required pam_unix.so # unix (order 10200)
+
'';
+
};
+
+
security.pam.services.sudo = lib.mkIf (config.services.fprintd.enable) {
+
text = ''
+
# Account management.
+
account required pam_unix.so # unix (order 10900)
+
+
# Authentication management.
+
auth sufficient pam_unix.so try_first_pass likeauth nullok
+
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
+
auth required pam_deny.so # deny
+
+
# Password management.
+
password sufficient pam_unix.so nullok yescrypt # unix
+
+
# Session management.
+
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
+
session required pam_unix.so # unix (order 10200)
+
'';
+
};
+
+
security.pam.services.su = lib.mkIf (config.services.fprintd.enable) {
+
text = ''
+
# Account management.
+
account required pam_unix.so # unix (order 10900)
+
+
# Authentication management.
+
auth sufficient pam_rootok.so # rootok (order 10200)
+
auth required pam_faillock.so # faillock (order 10400)
+
auth sufficient pam_unix.so try_first_pass likeauth nullok
+
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
+
auth required pam_deny.so # deny
+
+
# Password management.
+
password sufficient pam_unix.so nullok yescrypt # unix
+
+
# Session management.
+
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
+
session required pam_unix.so # unix (order 10200)
+
session required pam_unix.so # unix (order 10200)
+
session optional pam_xauth.so systemuser=99 xauthpath=${pkgs.xorg.xauth}/bin/xauth # xauth (order 12100)
+
'';
+
};
+
};
+
}
+8
nixos/modules/default.nix
···
···
+
{ ... }:
+
{
+
imports = [
+
./authentication.nix
+
./apps
+
./network/wifi.nix
+
];
+
}
+59
nixos/modules/network/wifi.nix
···
···
+
{ lib, config, pkgs, ... }:
+
let
+
cfg = config.modules.network.wifi;
+
mkProfile = name: p:
+
let
+
base = {
+
connection = { id = name; type = "wifi"; };
+
ipv4.method = "auto";
+
ipv6 = { addr-gen-mode = "stable-privacy"; method = "auto"; };
+
wifi = { mode = "infrastructure"; ssid = name; };
+
};
+
sec =
+
if (p ? pskVar && p.pskVar != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = "$${" + p.pskVar + "}"; }; }
+
else if (p ? psk && p.psk != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = p.psk; }; }
+
else if (p ? pskFile && p.pskFile != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = "$(" + pkgs.coreutils + "/bin/cat " + p.pskFile + ")"; }; }
+
else {};
+
in base // sec;
+
in
+
{
+
options.modules.network.wifi = {
+
enable = lib.mkEnableOption "Enable NetworkManager with simplified Wi-Fi profiles";
+
hostName = lib.mkOption { type = lib.types.str; default = config.networking.hostName or ""; };
+
nameservers = lib.mkOption { type = lib.types.listOf lib.types.str; default = []; };
+
envFile = lib.mkOption {
+
type = lib.types.nullOr lib.types.path;
+
default = null;
+
description = "Single environment file with PSK variables (used once).";
+
};
+
+
profiles = lib.mkOption {
+
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
+
options = {
+
pskVar = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = "Variable name in envFile providing PSK"; };
+
psk = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; };
+
pskFile = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; };
+
};
+
}));
+
default = {};
+
description = "Map of SSID -> { pskVar | psk | pskFile }.";
+
};
+
};
+
+
config = lib.mkIf cfg.enable {
+
networking = {
+
hostName = lib.mkIf (cfg.hostName != "") cfg.hostName;
+
nameservers = lib.mkIf (cfg.nameservers != []) cfg.nameservers;
+
useDHCP = false;
+
dhcpcd.enable = false;
+
networkmanager = {
+
enable = true;
+
dns = "none";
+
ensureProfiles = {
+
environmentFiles = lib.optional (cfg.envFile != null) cfg.envFile;
+
profiles = lib.mapAttrs mkProfile cfg.profiles;
+
};
+
};
+
};
+
};
+
}