190 lines
5.9 KiB
Nix
190 lines
5.9 KiB
Nix
{ pkgs, lib, systemSettings, userSettings, ... }:
|
|
{
|
|
imports =
|
|
[ ../../system/hardware-configuration.nix
|
|
../../system/hardware/systemd.nix # systemd config
|
|
../../system/hardware/kernel.nix # Kernel config
|
|
../../system/hardware/power.nix # Power management
|
|
../../system/hardware/time.nix # Network time sync
|
|
../../system/hardware/opengl.nix
|
|
../../system/hardware/printing.nix
|
|
../../system/hardware/bluetooth.nix
|
|
(./. + "../../../system/wm"+("/"+userSettings.wm)+".nix") # My window manager
|
|
#../../system/app/flatpak.nix
|
|
../../system/app/virtualization.nix
|
|
( import ../../system/app/docker.nix {storageDriver = null; inherit pkgs userSettings lib;} )
|
|
../../system/security/doas.nix
|
|
../../system/security/gpg.nix
|
|
../../system/security/blocklist.nix
|
|
../../system/security/firewall.nix
|
|
../../system/security/firejail.nix
|
|
../../system/security/openvpn.nix
|
|
../../system/security/automount.nix
|
|
../../system/style/stylix.nix
|
|
];
|
|
|
|
# Fix nix path
|
|
nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
|
|
"nixos-config=$HOME/dotfiles/system/configuration.nix"
|
|
"/nix/var/nix/profiles/per-user/root/channels"
|
|
];
|
|
|
|
# Ensure nix flakes are enabled
|
|
nix.extraOptions = ''
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
|
|
# Substituters
|
|
nix.settings = {
|
|
substituters = [
|
|
"https://cache.nixos.org"
|
|
"https://hyprland.cachix.org"
|
|
"https://nix-community.cachix.org"
|
|
];
|
|
trusted-public-keys = [
|
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
];
|
|
};
|
|
|
|
nixpkgs.overlays = [
|
|
(
|
|
final: prev: {
|
|
logseq = prev.logseq.overrideAttrs (oldAttrs: {
|
|
postFixup = ''
|
|
makeWrapper ${prev.electron_27}/bin/electron $out/bin/${oldAttrs.pname} \
|
|
--set "LOCAL_GIT_DIRECTORY" ${prev.git} \
|
|
--add-flags $out/share/${oldAttrs.pname}/resources/app \
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
--prefix LD_LIBRARY_PATH : "${prev.lib.makeLibraryPath [ prev.stdenv.cc.cc.lib ]}"
|
|
'';
|
|
});
|
|
}
|
|
)
|
|
];
|
|
|
|
|
|
# logseq
|
|
nixpkgs.config.permittedInsecurePackages = [
|
|
"electron-27.3.11"
|
|
];
|
|
|
|
# wheel group gets trusted access to nix daemon
|
|
nix.settings.trusted-users = [ "@wheel" ];
|
|
|
|
# I'm sorry Stallman-taichou
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
# Kernel modules
|
|
boot.kernelModules = [ "i2c-dev" "i2c-piix4" "cpufreq_powersave" ];
|
|
|
|
# Bootloader
|
|
# Use systemd-boot if uefi, default to grub otherwise
|
|
boot.loader.systemd-boot.enable = if (systemSettings.bootMode == "uefi") then true else false;
|
|
boot.loader.systemd-boot.editor = false;
|
|
boot.loader.efi.canTouchEfiVariables = if (systemSettings.bootMode == "uefi") then true else false;
|
|
boot.loader.efi.efiSysMountPoint = systemSettings.bootMountPath; # does nothing if running bios rather than uefi
|
|
boot.loader.grub.enable = if (systemSettings.bootMode == "uefi") then false else true;
|
|
boot.loader.grub.device = systemSettings.grubDevice; # does nothing if running uefi rather than bios
|
|
|
|
# Silent Boot
|
|
# https://wiki.archlinux.org/title/Silent_boot
|
|
boot.kernelParams = [
|
|
"quiet"
|
|
"splash"
|
|
"vga=current"
|
|
"rd.systemd.show_status=false"
|
|
"rd.udev.log_level=3"
|
|
"udev.log_priority=3"
|
|
];
|
|
boot.consoleLogLevel = 0;
|
|
boot.initrd.systemd.enable = true;
|
|
# https://github.com/NixOS/nixpkgs/pull/108294
|
|
boot.initrd.verbose = false;
|
|
|
|
boot.plymouth.enable = true;
|
|
#boot.plymouth.themePackages = with pkgs; [ nixos-bgrt-plymouth ];
|
|
#boot.plymouth.theme = "NixOS BGRT";
|
|
|
|
# Networking
|
|
networking.hostName = systemSettings.hostname; # Define your hostname.
|
|
networking.networkmanager.enable = true; # Use networkmanager
|
|
|
|
# Timezone and locale
|
|
time.timeZone = systemSettings.timezone; # time zone
|
|
i18n.defaultLocale = systemSettings.locale;
|
|
i18n.extraLocaleSettings = {
|
|
LC_ADDRESS = systemSettings.locale;
|
|
LC_IDENTIFICATION = systemSettings.locale;
|
|
LC_MEASUREMENT = systemSettings.locale;
|
|
LC_MONETARY = systemSettings.locale;
|
|
LC_NAME = systemSettings.locale;
|
|
LC_NUMERIC = systemSettings.locale;
|
|
LC_PAPER = systemSettings.locale;
|
|
LC_TELEPHONE = systemSettings.locale;
|
|
LC_TIME = systemSettings.locale;
|
|
};
|
|
|
|
# User account
|
|
users.users.${userSettings.username} = {
|
|
isNormalUser = true;
|
|
description = userSettings.name;
|
|
extraGroups = [ "networkmanager" "wheel" "input" "dialout" "video" "render" ];
|
|
packages = [];
|
|
uid = 1000;
|
|
};
|
|
|
|
# System packages
|
|
environment.systemPackages = with pkgs; [
|
|
vim
|
|
logseq
|
|
wget
|
|
zsh
|
|
git
|
|
cryptsetup
|
|
home-manager
|
|
wpa_supplicant
|
|
attic-client
|
|
(pkgs.writeScriptBin "comma" ''
|
|
if [ "$#" = 0 ]; then
|
|
echo "usage: comma PKGNAME... [EXECUTABLE]";
|
|
elif [ "$#" = 1 ]; then
|
|
nix-shell -p $1 --run $1;
|
|
elif [ "$#" = 2 ]; then
|
|
nix-shell -p $1 --run $2;
|
|
else
|
|
echo "error: too many arguments";
|
|
echo "usage: comma PKGNAME... [EXECUTABLE]";
|
|
fi
|
|
'')
|
|
(pkgs.writeScriptBin "comma-shell" ''
|
|
if [ "$#" = 0 ]; then
|
|
echo "usage: comma-shell PKGNAME1 [PKGNAME2 PKGNAME3...]";
|
|
else
|
|
nix-shell -p $@
|
|
fi
|
|
'')
|
|
|
|
];
|
|
|
|
# I use zsh btw
|
|
environment.shells = with pkgs; [ zsh ];
|
|
users.defaultUserShell = pkgs.zsh;
|
|
programs.zsh.enable = true;
|
|
|
|
fonts.fontDir.enable = true;
|
|
|
|
xdg.portal = {
|
|
enable = true;
|
|
extraPortals = [
|
|
pkgs.xdg-desktop-portal
|
|
pkgs.xdg-desktop-portal-gtk
|
|
];
|
|
};
|
|
|
|
# It is ok to leave this unchanged for compatibility purposes
|
|
system.stateVersion = "22.11";
|
|
|
|
}
|