Switch to snowfall flake configuration

This commit is contained in:
jopejoe1 2023-02-23 20:34:35 +01:00
parent bc0766220d
commit d322a4f0a8
26 changed files with 1042 additions and 465 deletions

View file

@ -0,0 +1,36 @@
{ options, config, lib, pkgs, ... }:
with lib;
#with lib.internal;
let
cfg = config.custom.desktop.plasma;
in
{
options.custom.desktop.plasma = with types; {
enable = mkBoolOpt false "Whether or not to use KDE plasma as the desktop environment.";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
libinput.enable = true;
displayManager.sddm = {
enable = true;
enableHidpi = true;
};
desktopManager.plasma5 = {
enable = true;
useQtScaling = true;
supportDDC = true;
};
};
programs.kdeconnect = {
enable = true;
package = pkgs.plasma5Packages.kdeconnect-kde;
};
};
}

View file

@ -0,0 +1,76 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.hardware.audio;
in
{
options.custom.hardware.audio = with types; {
enable = mkBoolOpt false "Whether or not to enable audio support.";
alsa-monitor = mkOpt attrs { } "Alsa configuration.";
nodes = mkOpt (listOf attrs) [ ]
"Audio nodes to pass to Pipewire as `context.objects`.";
modules = mkOpt (listOf attrs) [ ]
"Audio modules to pass to Pipewire as `context.modules`.";
extra-packages = mkOpt (listOf package) [
pkgs.qjackctl
pkgs.easyeffects
] "Additional packages to install.";
};
config = mkIf cfg.enable {
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
wireplumber.enable = false;
media-session.enable = true;
media-session.config.alsa-monitor =
mkAliasDefinitions options.custom.hardware.audio.alsa-monitor;
config.pipewire = {
"context.objects" = cfg.nodes ++ [ ];
"context.modules" = [
{
name = "libpipewire-module-rtkit";
args = { };
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-profiler"; }
{ name = "libpipewire-module-metadata"; }
{ name = "libpipewire-module-spa-device-factory"; }
{ name = "libpipewire-module-spa-node-factory"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-client-device"; }
{
name = "libpipewire-module-portal";
flags = [ "ifexists" "nofail" ];
}
{
name = "libpipewire-module-access";
args = { };
}
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-link-factory"; }
{ name = "libpipewire-module-session-manager"; }
] ++ cfg.modules;
};
};
hardware.pulseaudio.enable = mkForce false;
environment.systemPackages = with pkgs; [
pulsemixer
pavucontrol
] ++ cfg.extra-packages;
};
}

View file

@ -0,0 +1,39 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.hardware.printing;
in
{
options.custom.hardware.printing = with types; {
enable = mkBoolOpt false "Whether or not to enable printing and scaning";
printers = mkOpt (listOf package) [ ] "Custom printing backend packages to install.";
};
config = mkIf cfg.enable {
services.printing = {
enable = true;
webInterface = true;
drivers = with pkgs; [
hplipWithPlugin
] ++ cfg.printers;
};
hardware = {
sane = {
enable = true;
extraBackends = with pkgs; [
sane-airscan
hplipWithPlugin
] ++ cfg.printers;
};
};
services.avahi = {
enable = true;
nssmdns = true;
openFirewall = true;
};
};
}

53
modules/nix/default.nix Normal file
View file

@ -0,0 +1,53 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.nix;
in
{
options.custom.nix = with types; {
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
package = mkOpt package pkgs.nix "Which nix package to use.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
deploy-rs
nixfmt
nix-index
nix-prefetch-git
nixpkgs-review
nurl
nix-init
];
nix = {
package = cfg.package;
settings = {
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://prismlauncher.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"prismlauncher.cachix.org-1:GhJfjdP1RFKtFSH3gXTIQCvZwsb2cioisOf91y/bK0w="
];
trusted-users = [ "root" ];
sandbox = true;
require-sigs = true;
max-jobs = "auto";
auto-optimise-store = true;
allowed-users = [ "*" ];
experimental-features = [ "nix-command" "flakes" ];
warn-dirty = false;
};
# flake-utils-plus
generateRegistryFromInputs = true;
generateNixPathFromInputs = true;
linkInputs = true;
};
};
}

View file

@ -0,0 +1,23 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.system.boot.uboot;
in
{
options.custom.system.boot.uboot = with types; {
enable = mkBoolOpt false "Whether or not to enable booting on uboot system.";
};
config = mkIf cfg.enable {
boot = {
# Boot loader configutation
loader = {
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
generic-extlinux-compatible.enable = true;
};
};
};
}

View file

@ -0,0 +1,22 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.system.boot.uefi;
in
{
options.custom.system.boot.uefi = with types; {
enable = mkBoolOpt false "Whether or not to enable booting on a uefi system.";
};
config = mkIf cfg.enable {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.systemd-boot.configurationLimit = 10;
# https://github.com/NixOS/nixpkgs/blob/c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix#L66
boot.loader.systemd-boot.editor = false;
};
}

View file

@ -0,0 +1,30 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.system.fonts;
in
{
options.custom.system.fonts = with types; {
enable = mkBoolOpt false "Whether or not to manage fonts.";
fonts = mkOpt (listOf package) [ ] "Custom font packages to install.";
};
config = mkIf cfg.enable {
environment.variables = {
# Enable icons in tooling since we have nerdfonts.
LOG_ICONS = "true";
};
fonts.fontDir.enable = true;
fonts.fonts = with pkgs;
[
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
(nerdfonts.override { fonts = [ "Hack" ]; })
] ++ cfg.fonts;
};
}

View file

@ -0,0 +1,40 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.system.locale;
in
{
options.custom.system.locale = with types; {
enable = mkBoolOpt false "Whether or not to manage locale settings.";
layout = mkOpt str "de" "The Keyboard layout to use.";
};
config = mkIf cfg.enable {
i18n = {
defaultLocale = "en_NZ.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
LC_CTYPE = "de_DE.UTF-8";
LC_COLLATE = "de_DE.UTF-8";
LC_MESSAGES = "en_NZ.UTF-8";
};
};
console = {
enable = true;
keyMap = mkForce cfg.layout;
};
services.xserver = {
layout = cfg.layout;
};
};
}

View file

@ -0,0 +1,25 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.system.xdg;
in
{
options.custom.system.xdg = with types; {
enable = mkBoolOpt false "Whether or not to enable xdg.";
};
config = mkIf cfg.enable {
xdg = {
sounds.enable = true;
mime.enable = true;
menus.enable = true;
icons.enable = true;
autostart.enable = true;
portal = {
enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal ];
};
};
};
}

View file

@ -0,0 +1,31 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.user.jopejoe1;
in
{
options.custom.user.jopejoe1 = with types; {
enable = mkBoolOpt false "Enable the user jopejoe1";
};
config = mkIf cfg.enable {
users.users.jopejoe1 = {
isNormalUser = true;
description = "jopejoe1 🚫";
initialPassword = "password";
extraGroups = [ "wheel"]
++ lib.optionals config.custom.hardware.printing.enable [ "scanner" "lp"]
++ lib.optional config.networking.networkmanager.enable "networkmanger";
packages = with pkgs; [
kate
carla
xdg-ninja
prismlauncher
ark
];
};
home-manager.users.jopejoe1 = import ./home.nix;
};
}

View file

@ -0,0 +1,248 @@
{ config, pkgs, ... }:
{
home = {
# Basic information for home-manager
username = "jopejoe1";
homeDirectory = "/home/${config.home.username}";
# Enviroment variables
sessionVariables = {
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompos";
XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
};
# Do not change this version unless 100% sure updatet evrything to the new version
stateVersion = "23.05";
};
accounts.email.accounts = {
main = {
address = "johannes@joens.email";
flavor = "gmail.com";
primary = true;
realName = "Johannes Joens";
thunderbird.enable = true;
};
};
# XDG base dirs
xdg = {
enable = true;
mime.enable = true;
cacheHome = "${config.home.homeDirectory}/.cache";
configHome = "${config.home.homeDirectory}/.config";
dataHome = "${config.home.homeDirectory}/.local/share";
stateHome = "${config.home.homeDirectory}/.local/state";
userDirs = {
enable = true;
createDirectories = false;
desktop = "${config.home.homeDirectory}/Desktop";
documents = "${config.home.homeDirectory}/Documents";
download = "${config.home.homeDirectory}/Downloads";
music = "${config.home.homeDirectory}/Music";
pictures = "${config.home.homeDirectory}/Pictures";
publicShare = "${config.home.homeDirectory}/Public";
templates = "${config.home.homeDirectory}/Templates";
videos = "${config.home.homeDirectory}/Videos";
};
};
gtk = {
enable = true;
gtk2 = {
configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
};
gtk3 = {
extraConfig = {
gtk-application-prefer-dark-theme = true;
gtk-button-images = true;
gtk-decoration-layout = "icon:minimize,maximize,close";
gtk-enable-animations = true;
gtk-menu-images = true;
gtk-modules = "colorreload-gtk-module";
gtk-primary-button-warps-slider = false;
gtk-toolbar-style = 3;
};
};
gtk4 = {
extraConfig = {
gtk-application-prefer-dark-theme = true;
gtk-decoration-layout = "icon:minimize,maximize,close";
gtk-enable-animations = true;
gtk-primary-button-warps-slider = false;
};
};
cursorTheme = {
package = pkgs.libsForQt5.breeze-icons;
name = "breeze_cursors";
size = 24;
};
font = {
package = pkgs.noto-fonts;
name = "Noto Sans";
size = 10;
};
theme = {
package = pkgs.libsForQt5.breeze-gtk;
name = "breeze-dark";
};
iconTheme = {
package = pkgs.tela-icon-theme;
name = "Tela-purple";
};
};
# Let Home Manager install and manage itself.
programs = {
home-manager.enable = true;
git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userEmail = "johannes@joens.email";
userName = "jopejoe1";
};
bash = {
enable = true;
historyFile = "${config.xdg.stateHome}/bash/history";
shellAliases = {
gc = "sudo nix store gc";
rb = "sudo git -C /etc/nixos pull && sudo nix flake update /etc/nixos/ && sudo nixos-rebuild switch && sudo git -C /etc/nixos add . && sudo git -C /etc/nixos commit -m 'Updated flake.lock' && sudo git -C /etc/nixos push";
};
};
zsh = {
enable = true;
shellAliases = config.programs.bash.shellAliases;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
enableVteIntegration = true;
dotDir = ".config/zsh";
};
fish.shellAbbrs = config.programs.bash.shellAliases;
thunderbird = {
enable = false;
profiles = {
default = {
isDefault = true;
};
};
};
firefox = {
enable = true;
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
extraPolicies = {
AppAutoUpdate = false;
BackgroundAppUpdate = false;
DisableAppUpdate = true;
CaptivePortal = false;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
DisableFirefoxAccounts = true;
DisableFormHistory = true;
DefaultDownloadDirectory = "${config.xdg.userDirs.download}";
DontCheckDefaultBrowser = true;
ExtensionUpdate = false;
NoDefaultBookmarks = true;
PasswordManagerEnabled = false;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
EnableTrackingProtection = {
Value = true;
Cryptomining = true;
Fingerprinting = true;
};
FirefoxHome = {
Search = true;
Pocket = false;
SponsoredPocket = false;
Snippets = false;
TopSites = true;
SponsoredTopSites = false;
Highlights = false;
};
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
};
};
};
profiles = {
default = {
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
privacy-badger
bitwarden
clearurls
decentraleyes
duckduckgo-privacy-essentials
ghostery
libredirect
privacy-badger
languagetool
fastforward
return-youtube-dislikes
sponsorblock
augmented-steam
steam-database
refined-github
plasma-integration
#bypass-paywalls-clean
lovely-forks
search-by-image
skip-redirect
terms-of-service-didnt-read
unpaywall
wappalyzer
wayback-machine
modrinthify
];
id = 0;
isDefault = true;
name = "default";
search = {
default = "DuckDuckGo";
force = true;
engines = {
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"NixOS Wiki" = {
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }];
icon = "${config.programs.firefox.profiles.default.search.engines."Nix Packages".icon}";
definedAliases = [ "@nw" ];
};
"Bing".metaData.hidden = true;
"Google".metaData.hidden = true;
"eBay".metaData.hidden = true;
"Amazon.de".metaData.hidden = true;
"Wikipedia (en)".metaData.alias = "@wiki";
};
};
settings = {
"privacy.resistFingerprinting" = true;
"privacy.trackingprotection.fingerprinting.enabled" = true;
"privacy.trackingprotection.cryptomining.enabled" = true;
"dom.event.clipboardevents.enabled" = false;
"dom.battery.enabled" = false;
"browser.safebrowsing.phishing.enabled" = false;
"browser.safebrowsing.malware.enabled" = false;
"browser.zoom.siteSpecific" = true;
"config.trim_on_minimize" = true;
"pdfjs.annotationEditorMode" = 0;
"pdfjs.annotationmode" = 2;
};
};
};
};
};
}

View file

@ -0,0 +1,16 @@
{ options, config, pkgs, lib, ... }:
with lib;
#with lib.internal;
let cfg = config.custom.user.root;
in
{
options.custom.user.root = with types; {
enable = mkBoolOpt false "Enable the user root";
};
config = mkIf cfg.enable {
home-manager.users.root = import ./home.nix;
};
}

View file

@ -0,0 +1,59 @@
{ config, pkgs, ... }:
{
home = {
# Basic information for home-manager
username = "root";
homeDirectory = "/${config.home.username}";
# Enviroment variables
sessionVariables = {
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompos";
XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
};
# Do not change this version unless 100% sure updatet evrything to the new version
stateVersion = "23.05";
};
xdg = {
enable = true;
mime.enable = true;
cacheHome = "${config.home.homeDirectory}/.cache";
configHome = "${config.home.homeDirectory}/.config";
dataHome = "${config.home.homeDirectory}/.local/share";
stateHome = "${config.home.homeDirectory}/.local/state";
userDirs = {
enable = true;
createDirectories = false;
desktop = "${config.home.homeDirectory}/Desktop";
documents = "${config.home.homeDirectory}/Documents";
download = "${config.home.homeDirectory}/Downloads";
music = "${config.home.homeDirectory}/Music";
pictures = "${config.home.homeDirectory}/Pictures";
publicShare = "${config.home.homeDirectory}/Public";
templates = "${config.home.homeDirectory}/Templates";
videos = "${config.home.homeDirectory}/Videos";
};
};
programs = {
home-manager.enable = true;
git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userEmail = "johannes@joens.email";
userName = "jopejoe1";
};
bash = {
enable = true;
historyFile = "${config.xdg.stateHome}/bash/history";
shellAliases = {
gc = "sudo nix store gc";
rb = "sudo nix flake update /etc/nixos/ && sudo nixos-rebuild switch";
};
};
zsh.shellAliases = config.programs.bash.shellAliases;
fish.shellAbbrs = config.programs.bash.shellAliases;
};
}