new formatter (#7)

This commit is contained in:
Christoph Hollizeck 2024-04-04 19:39:24 +02:00 committed by GitHub
commit 1817abe793
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 438 additions and 353 deletions

View file

@ -37,25 +37,29 @@
}; };
}; };
outputs = inputs: let outputs =
lib = inputs.snowfall-lib.mkLib { inputs:
inherit inputs; let
src = ./.; lib = inputs.snowfall-lib.mkLib {
inherit inputs;
src = ./.;
snowfall = { snowfall = {
meta = { meta = {
name = "wyrdgard"; name = "wyrdgard";
title = "Wyrdgard"; title = "Wyrdgard";
};
namespace = "wyrdgard";
}; };
namespace = "wyrdgard";
}; };
}; in
in
lib.mkFlake { lib.mkFlake {
channels-config = {allowUnfree = true;}; channels-config = {
allowUnfree = true;
};
outputs-builder = channels: {formatter = channels.nixpkgs.alejandra;}; outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; };
overlays = with inputs; [ overlays = with inputs; [
snowfall-flake.overlays.default snowfall-flake.overlays.default

View file

@ -2,11 +2,12 @@
lib, lib,
pkgs, pkgs,
config, config,
osConfig ? {}, osConfig ? { },
format ? "unknown", format ? "unknown",
... ...
}: }:
with lib.wyrdgard; { with lib.wyrdgard;
{
wyrdgard = { wyrdgard = {
apps = { apps = {
kitty = enabled; kitty = enabled;

View file

@ -2,11 +2,12 @@
lib, lib,
pkgs, pkgs,
config, config,
osConfig ? {}, osConfig ? { },
format ? "unknown", format ? "unknown",
... ...
}: }:
with lib.wyrdgard; { with lib.wyrdgard;
{
wyrdgard = { wyrdgard = {
apps = { apps = {
kitty = enabled; kitty = enabled;

View file

@ -1,5 +1,6 @@
{lib, ...}: { lib, ... }:
with lib; rec { with lib;
rec {
## Create a NixOS module option. ## Create a NixOS module option.
## ##
## ```nix ## ```nix
@ -7,8 +8,9 @@ with lib; rec {
## ``` ## ```
## ##
#@ Type -> Any -> String #@ Type -> Any -> String
mkOpt = type: default: description: mkOpt =
mkOption {inherit type default description;}; type: default: description:
mkOption { inherit type default description; };
## Create a NixOS module option without a description. ## Create a NixOS module option without a description.
## ##

View file

@ -6,44 +6,43 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.fish; cfg = config.wyrdgard.apps.cli-apps.fish;
in { in
{
options.wyrdgard.apps.cli-apps.fish = with types; { options.wyrdgard.apps.cli-apps.fish = with types; {
enable = mkBoolOpt true "Whether or not to enable the fish shell"; enable = mkBoolOpt true "Whether or not to enable the fish shell";
}; };
config = config = mkIf cfg.enable {
mkIf cfg.enable { home.packages = with pkgs.fishPlugins; [
home.packages = with pkgs.fishPlugins; [ forgit
forgit sponge
sponge ];
];
programs = { programs = {
fish = { fish = {
enable = true; enable = true;
shellInit = " shellInit = "
zoxide init fish | source zoxide init fish | source
direnv hook fish | source direnv hook fish | source
source ~/.config/op/plugins.sh source ~/.config/op/plugins.sh
"; ";
shellAliases = { shellAliases = {
vim = "nvim"; vim = "nvim";
ls = "colorls --gs"; ls = "colorls --gs";
l = "ls -l"; l = "ls -l";
la = "ls -a"; la = "ls -a";
lla = "ls -la"; lla = "ls -la";
lt = "ls --tree"; lt = "ls --tree";
};
};
zoxide = {
enable = true;
options = [
"--cmd cd"
];
}; };
}; };
zoxide = {
enable = true;
options = [ "--cmd cd" ];
};
}; };
};
} }

View file

@ -1,17 +1,13 @@
{ { lib, config, ... }:
lib,
config,
...
}:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.home-manager; cfg = config.wyrdgard.apps.cli-apps.home-manager;
in { in
{
options.wyrdgard.apps.cli-apps.home-manager = { options.wyrdgard.apps.cli-apps.home-manager = {
enable = mkBoolOpt true "Enable home-manager"; enable = mkBoolOpt true "Enable home-manager";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable { programs.home-manager = enabled; };
programs.home-manager = enabled;
};
} }

View file

@ -6,69 +6,69 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.starship; cfg = config.wyrdgard.apps.cli-apps.starship;
in { in
{
options.wyrdgard.apps.cli-apps.starship = with types; { options.wyrdgard.apps.cli-apps.starship = with types; {
enable = mkBoolOpt true "Whether or not to enable starship shell"; enable = mkBoolOpt true "Whether or not to enable starship shell";
}; };
config = config = mkIf cfg.enable {
mkIf cfg.enable { programs = {
programs = { fish.shellInit = "
fish.shellInit = "
starship init fish | source starship init fish | source
"; ";
starship = { starship = {
enable = true; enable = true;
enableTransience = true; enableTransience = true;
settings = { settings = {
character = { character = {
error_symbol = "[ ](bold red)"; error_symbol = "[ ](bold red)";
}; };
time = { time = {
disabled = false; disabled = false;
time_format = "%T"; time_format = "%T";
utc_time_offset = "+1"; utc_time_offset = "+1";
}; };
username = { username = {
style_user = "#00de00"; style_user = "#00de00";
style_root = "red"; style_root = "red";
format = "[$user]($style) "; format = "[$user]($style) ";
disabled = false; disabled = false;
show_always = true; show_always = true;
}; };
hostname = { hostname = {
ssh_only = false; ssh_only = false;
format = "@ [$hostname](bold yellow) "; format = "@ [$hostname](bold yellow) ";
disabled = false; disabled = false;
}; };
directory = { directory = {
home_symbol = "󰋞 ~"; home_symbol = "󰋞 ~";
read_only_style = "197"; read_only_style = "197";
read_only = " "; read_only = " ";
format = "at [$path]($style)[$read_only]($read_only_style) "; format = "at [$path]($style)[$read_only]($read_only_style) ";
}; };
git_metrics = { git_metrics = {
disabled = false; disabled = false;
added_style = "bold blue"; added_style = "bold blue";
format = "[+$added]($added_style)/[-$deleted]($deleted_style) "; format = "[+$added]($added_style)/[-$deleted]($deleted_style) ";
}; };
git_status = { git_status = {
format = "([$all_status$ahead_behind]($style) )"; format = "([$all_status$ahead_behind]($style) )";
ahead = "[$count](bold green)"; ahead = "[$count](bold green)";
behind = "[$count](bold red)"; behind = "[$count](bold red)";
diverged = "[$ahead_count$behind_count](red)"; diverged = "[$ahead_count$behind_count](red)";
deleted = "[$count](red) "; deleted = "[$count](red) ";
modified = "[!$count](yellow) "; modified = "[!$count](yellow) ";
staged = "[+$count](green) "; staged = "[+$count](green) ";
renamed = "[$count](green) "; renamed = "[$count](green) ";
untracked = "[?$count](blue) "; untracked = "[?$count](blue) ";
};
}; };
}; };
}; };
}; };
};
} }

View file

@ -5,17 +5,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.graphviz; cfg = config.wyrdgard.apps.graphviz;
in { in
{
options.wyrdgard.apps.graphviz = { options.wyrdgard.apps.graphviz = {
enable = mkBoolOpt true "Whether or not you want to install graphviz"; enable = mkBoolOpt true "Whether or not you want to install graphviz";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [ graphviz ];
graphviz
];
home.shellAliases = { home.shellAliases = {
nixsize = "nix-du -n=50 | dot -Tsvg > ~/Pictures/store.svg"; nixsize = "nix-du -n=50 | dot -Tsvg > ~/Pictures/store.svg";

View file

@ -5,17 +5,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.kitty; cfg = config.wyrdgard.apps.kitty;
in { in
{
options.wyrdgard.apps.kitty = { options.wyrdgard.apps.kitty = {
enable = mkEnableOption "Kity"; enable = mkEnableOption "Kity";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [ kitty ];
kitty
];
programs.kitty = { programs.kitty = {
enable = true; enable = true;

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.direnv; cfg = config.wyrdgard.tools.direnv;
in { in
{
options.wyrdgard.tools.direnv = with types; { options.wyrdgard.tools.direnv = with types; {
enable = mkBoolOpt false "Whether or not to enable direnv."; enable = mkBoolOpt false "Whether or not to enable direnv.";
}; };

View file

@ -6,10 +6,12 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.git; cfg = config.wyrdgard.tools.git;
user = config.wyrdgard.user; user = config.wyrdgard.user;
in { in
{
options.wyrdgard.tools.git = { options.wyrdgard.tools.git = {
enable = mkBoolOpt true "Enable Git (Default true)"; enable = mkBoolOpt true "Enable Git (Default true)";
userName = mkOpt types.str user.fullName "The name to configure git with."; userName = mkOpt types.str user.fullName "The name to configure git with.";
@ -22,9 +24,15 @@ in {
inherit (cfg) userName userEmail; inherit (cfg) userName userEmail;
lfs = enabled; lfs = enabled;
extraConfig = { extraConfig = {
init = {defaultBranch = "main";}; init = {
pull = {rebase = false;}; defaultBranch = "main";
push = {autoSetupRemote = true;}; };
pull = {
rebase = false;
};
push = {
autoSetupRemote = true;
};
}; };
}; };
}; };

View file

@ -2,10 +2,16 @@
lib, lib,
config, config,
pkgs, pkgs,
osConfig ? {}, osConfig ? { },
... ...
}: let }:
inherit (lib) types mkIf mkDefault mkMerge; let
inherit (lib)
types
mkIf
mkDefault
mkMerge
;
inherit (lib.wyrdgard) mkOpt; inherit (lib.wyrdgard) mkOpt;
cfg = config.wyrdgard.user; cfg = config.wyrdgard.user;
@ -14,15 +20,18 @@
is-darwin = pkgs.stdenv.isDarwin; is-darwin = pkgs.stdenv.isDarwin;
home-directory = home-directory =
if cfg.name == null if cfg.name == null then
then null null
else if is-darwin else if is-darwin then
then "/Users/${cfg.name}" "/Users/${cfg.name}"
else "/home/${cfg.name}"; else
in { "/home/${cfg.name}";
in
{
options.wyrdgard.user = { options.wyrdgard.user = {
enable = mkOpt types.bool true "Whether to configure the user account."; enable = mkOpt types.bool true "Whether to configure the user account.";
name = mkOpt (types.nullOr types.str) (config.snowfallorg.user.name or "cholli") "The user account."; name = mkOpt (types.nullOr types.str) (config.snowfallorg.user.name or "cholli"
) "The user account.";
fullName = mkOpt types.str "Christoph Hollizeck" "The full name of the user."; fullName = mkOpt types.str "Christoph Hollizeck" "The full name of the user.";
email = mkOpt types.str "christoph.hollizeck@hey.com" "The email of the user."; email = mkOpt types.str "christoph.hollizeck@hey.com" "The email of the user.";

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps._1password; cfg = config.wyrdgard.apps._1password;
in { in
{
options.wyrdgard.apps._1password = with types; { options.wyrdgard.apps._1password = with types; {
enable = mkBoolOpt true "Enable 1Password"; enable = mkBoolOpt true "Enable 1Password";
}; };
@ -18,7 +20,7 @@ in {
_1password.enable = true; _1password.enable = true;
_1password-gui = { _1password-gui = {
enable = true; enable = true;
polkitPolicyOwners = [config.wyrdgard.user.name]; polkitPolicyOwners = [ config.wyrdgard.user.name ];
}; };
}; };
}; };

View file

@ -6,14 +6,19 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.nixvim; cfg = config.wyrdgard.apps.cli-apps.nixvim;
in { in
{
options.wyrdgard.apps.cli-apps.nixvim = with types; { options.wyrdgard.apps.cli-apps.nixvim = with types; {
enable = mkBoolOpt true "Whether to enable nixvim or not (Default true)"; enable = mkBoolOpt true "Whether to enable nixvim or not (Default true)";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [less wyrdgard.neovim]; environment.systemPackages = with pkgs; [
less
wyrdgard.neovim
];
}; };
} }

View file

@ -6,16 +6,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.discord; cfg = config.wyrdgard.apps.discord;
in { in
{
options.wyrdgard.apps.discord = with types; { options.wyrdgard.apps.discord = with types; {
enable = mkBoolOpt false "Whether or not to enable basic configuration"; enable = mkBoolOpt false "Whether or not to enable basic configuration";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ discord ]; };
environment.systemPackages = with pkgs; [
discord
];
};
} }

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.steam; cfg = config.wyrdgard.apps.steam;
in { in
{
options.wyrdgard.apps.steam = with types; { options.wyrdgard.apps.steam = with types; {
enable = mkBoolOpt false "Whether or not to enable support for Steam."; enable = mkBoolOpt false "Whether or not to enable support for Steam.";
}; };
@ -17,8 +19,6 @@ in {
programs.steam.enable = true; programs.steam.enable = true;
programs.steam.remotePlay.openFirewall = true; programs.steam.remotePlay.openFirewall = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ steam ];
steam
];
}; };
} }

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.vivaldi; cfg = config.wyrdgard.apps.vivaldi;
in { in
{
options.wyrdgard.apps.vivaldi = with types; { options.wyrdgard.apps.vivaldi = with types; {
enable = mkBoolOpt false "Whether or not to enable vivaldi browser"; enable = mkBoolOpt false "Whether or not to enable vivaldi browser";
}; };

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.archetypes.gaming; cfg = config.wyrdgard.archetypes.gaming;
in { in
{
options.wyrdgard.archetypes.gaming = with types; { options.wyrdgard.archetypes.gaming = with types; {
enable = mkBoolOpt false "Whether or not to enable the gaming archetype."; enable = mkBoolOpt false "Whether or not to enable the gaming archetype.";
}; };

View file

@ -7,17 +7,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.home; cfg = config.wyrdgard.home;
in { in
{
options.wyrdgard.home = with types; { options.wyrdgard.home = with types; {
file = file = mkOpt attrs { } (mdDoc "A set of files to be managed by home-manager's `home.file`.");
mkOpt attrs {} configFile = mkOpt attrs { } (
(mdDoc "A set of files to be managed by home-manager's `home.file`."); mdDoc "A set of files to be managed by home-manager's `xdg.configFile`."
configFile = );
mkOpt attrs {} extraOptions = mkOpt attrs { } "Options to pass directly to home-manager.";
(mdDoc "A set of files to be managed by home-manager's `xdg.configFile`.");
extraOptions = mkOpt attrs {} "Options to pass directly to home-manager.";
}; };
config = { config = {

View file

@ -7,35 +7,39 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.nix; cfg = config.wyrdgard.nix;
substituters-submodule = types.submodule ({name, ...}: { substituters-submodule = types.submodule (
options = with types; { { name, ... }:
key = mkOpt (nullOr str) null "The trusted public key for this substituter."; {
}; options = with types; {
}); key = mkOpt (nullOr str) null "The trusted public key for this substituter.";
in { };
}
);
in
{
options.wyrdgard.nix = with types; { options.wyrdgard.nix = with types; {
enable = mkBoolOpt true "Whether or not to manage nix configuration."; enable = mkBoolOpt true "Whether or not to manage nix configuration.";
package = mkOpt package pkgs.nixUnstable "Which nix package to use."; package = mkOpt package pkgs.nixUnstable "Which nix package to use.";
default-substituter = { default-substituter = {
url = mkOpt str "https://cache.nixos.org" "The url for the substituter."; url = mkOpt str "https://cache.nixos.org" "The url for the substituter.";
key = mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "The trusted public key for the substituter."; key =
mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"The trusted public key for the substituter.";
}; };
extra-substituters = mkOpt (attrsOf substituters-submodule) {} "Extra substituters to configure."; extra-substituters = mkOpt (attrsOf substituters-submodule) { } "Extra substituters to configure.";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = assertions = mapAttrsToList (name: value: {
mapAttrsToList assertion = value.key != null;
(name: value: { message = "wyrdgard.nix.extra-substituters.${name}.key must be set";
assertion = value.key != null; }) cfg.extra-substituters;
message = "wyrdgard.nix.extra-substituters.${name}.key must be set";
})
cfg.extra-substituters;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
snowfallorg.flake snowfallorg.flake
@ -44,46 +48,49 @@ in {
nix-du nix-du
]; ];
nix = let nix =
users = let
["root" config.wyrdgard.user.name] users = [
++ optional config.services.hydra.enable "hydra"; "root"
in { config.wyrdgard.user.name
package = cfg.package; ] ++ optional config.services.hydra.enable "hydra";
in
{
package = cfg.package;
settings = settings =
{ {
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
http-connections = 50; http-connections = 50;
warn-dirty = false; warn-dirty = false;
log-lines = 50; log-lines = 50;
sandbox = "relaxed"; sandbox = "relaxed";
auto-optimise-store = true; auto-optimise-store = true;
trusted-users = users; trusted-users = users;
allowed-users = users; allowed-users = users;
substituters = substituters = [
[cfg.default-substituter.url] cfg.default-substituter.url
++ (mapAttrsToList (name: value: name) cfg.extra-substituters); ] ++ (mapAttrsToList (name: value: name) cfg.extra-substituters);
trusted-public-keys = trusted-public-keys = [
[cfg.default-substituter.key] cfg.default-substituter.key
++ (mapAttrsToList (name: value: value.key) cfg.extra-substituters); ] ++ (mapAttrsToList (name: value: value.key) cfg.extra-substituters);
} }
// (lib.optionalAttrs config.wyrdgard.tools.direnv.enable { // (lib.optionalAttrs config.wyrdgard.tools.direnv.enable {
keep-outputs = true; keep-outputs = true;
keep-derivations = true; keep-derivations = true;
}); });
gc = { gc = {
automatic = true; automatic = true;
dates = "daily"; dates = "daily";
options = "--delete-older-than 7d"; options = "--delete-older-than 7d";
};
# flake-utils-plus
generateRegistryFromInputs = true;
generateNixPathFromInputs = true;
linkInputs = true;
}; };
# flake-utils-plus
generateRegistryFromInputs = true;
generateNixPathFromInputs = true;
linkInputs = true;
};
}; };
} }

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.submodules.basics; cfg = config.wyrdgard.submodules.basics;
in { in
{
options.wyrdgard.submodules.basics = with types; { options.wyrdgard.submodules.basics = with types; {
enable = mkBoolOpt false "Whether or not to enable basic configuration."; enable = mkBoolOpt false "Whether or not to enable basic configuration.";
}; };

View file

@ -6,17 +6,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.submodules.games; cfg = config.wyrdgard.submodules.games;
in { in
{
options.wyrdgard.submodules.games = with types; { options.wyrdgard.submodules.games = with types; {
enable = mkBoolOpt false "Whether or not you want to enable steam and other games"; enable = mkBoolOpt false "Whether or not you want to enable steam and other games";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ prismlauncher ];
prismlauncher
];
wyrdgard = { wyrdgard = {
apps = { apps = {

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.submodules.graphical-interface; cfg = config.wyrdgard.submodules.graphical-interface;
in { in
{
options.wyrdgard.submodules.graphical-interface = with types; { options.wyrdgard.submodules.graphical-interface = with types; {
enable = mkBoolOpt false "Whether to enable a graphical interface"; enable = mkBoolOpt false "Whether to enable a graphical interface";
}; };

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.submodules.socials; cfg = config.wyrdgard.submodules.socials;
in { in
{
options.wyrdgard.submodules.socials = with types; { options.wyrdgard.submodules.socials = with types; {
enable = mkBoolOpt false "Whether to enable social apps"; enable = mkBoolOpt false "Whether to enable social apps";
}; };

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.boot; cfg = config.wyrdgard.system.boot;
in { in
{
options.wyrdgard.system.boot = with types; { options.wyrdgard.system.boot = with types; {
enable = mkBoolOpt false "Whether or not to enable booting."; enable = mkBoolOpt false "Whether or not to enable booting.";
}; };

View file

@ -6,12 +6,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.fonts; cfg = config.wyrdgard.system.fonts;
in { in
{
options.wyrdgard.system.fonts = with types; { options.wyrdgard.system.fonts = with types; {
enable = mkBoolOpt false "Whether or not to manage fonts."; enable = mkBoolOpt false "Whether or not to manage fonts.";
fonts = mkOpt (listOf package) [] "Custom font packages to install."; fonts = mkOpt (listOf package) [ ] "Custom font packages to install.";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -20,13 +22,17 @@ in {
LOG_ICONS = "true"; LOG_ICONS = "true";
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ font-manager ];
font-manager
];
fonts.packages = with pkgs; fonts.packages =
with pkgs;
[ [
(nerdfonts.override {fonts = ["CodeNewRoman" "NerdFontsSymbolsOnly"];}) (nerdfonts.override {
fonts = [
"CodeNewRoman"
"NerdFontsSymbolsOnly"
];
})
font-awesome font-awesome
powerline-fonts powerline-fonts
powerline-symbols powerline-symbols

View file

@ -6,17 +6,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.hardware.audio; cfg = config.wyrdgard.system.hardware.audio;
in { in
{
options.wyrdgard.system.hardware.audio = with types; { options.wyrdgard.system.hardware.audio = with types; {
enable = mkBoolOpt false "Whether or not to enable audio"; enable = mkBoolOpt false "Whether or not to enable audio";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ noisetorch ];
noisetorch
];
programs.noisetorch.enable = true; programs.noisetorch.enable = true;

View file

@ -6,17 +6,17 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.hardware.bluetooth; cfg = config.wyrdgard.system.hardware.bluetooth;
in { in
{
options.wyrdgard.system.hardware.bluetooth = with types; { options.wyrdgard.system.hardware.bluetooth = with types; {
enable = mkBoolOpt false "Whether or not to enable bluetooth"; enable = mkBoolOpt false "Whether or not to enable bluetooth";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ libsForQt5.bluez-qt ];
libsForQt5.bluez-qt
];
hardware.bluetooth = { hardware.bluetooth = {
enable = true; enable = true;
@ -31,7 +31,11 @@ in {
fileSystems."/var/lib/bluetooth" = { fileSystems."/var/lib/bluetooth" = {
device = "/persist/var/lib/bluetooth"; device = "/persist/var/lib/bluetooth";
options = ["bind" "noauto" "x-systemd.automount"]; options = [
"bind"
"noauto"
"x-systemd.automount"
];
noCheck = true; noCheck = true;
}; };

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.hardware.gpu.nvidia; cfg = config.wyrdgard.system.hardware.gpu.nvidia;
in { in
{
options.wyrdgard.system.hardware.gpu.nvidia = with types; { options.wyrdgard.system.hardware.gpu.nvidia = with types; {
enable = mkEnableOption "Enable Nvidia GPU"; enable = mkEnableOption "Enable Nvidia GPU";
}; };
@ -29,7 +31,7 @@ in {
package = config.boot.kernelPackages.nvidiaPackages.beta; # stable, beta package = config.boot.kernelPackages.nvidiaPackages.beta; # stable, beta
}; };
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = [ "nvidia" ];
services.xserver.displayManager.sddm.wayland.enable = lib.mkForce false; services.xserver.displayManager.sddm.wayland.enable = lib.mkForce false;
}; };
} }

View file

@ -6,14 +6,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.hardware.networking; cfg = config.wyrdgard.system.hardware.networking;
in { in
{
options.wyrdgard.system.hardware.networking = with types; { options.wyrdgard.system.hardware.networking = with types; {
enable = mkBoolOpt false "Whether or not to enable networking"; enable = mkBoolOpt false "Whether or not to enable networking";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable { networking.networkmanager.enable = true; };
networking.networkmanager.enable = true;
};
} }

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.locale; cfg = config.wyrdgard.system.locale;
in { in
{
options.wyrdgard.system.locale = with types; { options.wyrdgard.system.locale = with types; {
enable = mkBoolOpt false "Whether or not to manage locale settings."; enable = mkBoolOpt false "Whether or not to manage locale settings.";
}; };

View file

@ -6,15 +6,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.time; cfg = config.wyrdgard.system.time;
in { in
{
options.wyrdgard.system.time = with types; { options.wyrdgard.system.time = with types; {
enable = enable = mkBoolOpt false "Whether or not to configure timezone information.";
mkBoolOpt false "Whether or not to configure timezone information.";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable { time.timeZone = "Europe/Berlin"; };
time.timeZone = "Europe/Berlin";
};
} }

View file

@ -5,9 +5,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.system.xkb; cfg = config.wyrdgard.system.xkb;
in { in
{
options.wyrdgard.system.xkb = with types; { options.wyrdgard.system.xkb = with types; {
enable = mkBoolOpt false "Whether or not to configure xkb."; enable = mkBoolOpt false "Whether or not to configure xkb.";
}; };

View file

@ -6,9 +6,11 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.direnv; cfg = config.wyrdgard.tools.direnv;
in { in
{
options.wyrdgard.tools.direnv = with types; { options.wyrdgard.tools.direnv = with types; {
enable = mkBoolOpt false "Whether or not to enable direnv."; enable = mkBoolOpt false "Whether or not to enable direnv.";
}; };

View file

@ -6,10 +6,12 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.git; cfg = config.wyrdgard.tools.git;
user = config.wyrdgard.user; user = config.wyrdgard.user;
in { in
{
options.wyrdgard.tools.git = with types; { options.wyrdgard.tools.git = with types; {
enable = mkBoolOpt true "Wether or not to enable git (Default enabled)"; enable = mkBoolOpt true "Wether or not to enable git (Default enabled)";
userName = mkOpt types.str user.fullName "The name to use git with"; userName = mkOpt types.str user.fullName "The name to use git with";
@ -26,9 +28,15 @@ in {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;
config = { config = {
init = {defaultBranch = "main";}; init = {
pull = {rebase = false;}; defaultBranch = "main";
push = {autoSetupRemote = true;}; };
pull = {
rebase = false;
};
push = {
autoSetupRemote = true;
};
}; };
}; };
}; };

View file

@ -6,14 +6,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.nix-ld; cfg = config.wyrdgard.tools.nix-ld;
in { in
{
options.wyrdgard.tools.nix-ld = with types; { options.wyrdgard.tools.nix-ld = with types; {
enable = mkBoolOpt false "Wether or not to enable nix-ld"; enable = mkBoolOpt false "Wether or not to enable nix-ld";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable { programs.nix-ld.enable = true; };
programs.nix-ld.enable = true;
};
} }

View file

@ -6,7 +6,8 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; let with lib.wyrdgard;
let
cfg = config.wyrdgard.user; cfg = config.wyrdgard.user;
defaultIconFileName = "profile.png"; defaultIconFileName = "profile.png";
defaultIcon = pkgs.stdenvNoCC.mkDerivation { defaultIcon = pkgs.stdenvNoCC.mkDerivation {
@ -19,37 +20,37 @@ with lib.wyrdgard; let
cp $src $out cp $src $out
''; '';
passthru = {fileName = defaultIconFileName;}; passthru = {
fileName = defaultIconFileName;
};
}; };
propagatedIcon = propagatedIcon =
pkgs.runCommandNoCC "propagated-icon" pkgs.runCommandNoCC "propagated-icon"
{passthru = {fileName = cfg.icon.fileName;};} {
'' passthru = {
local target="$out/share/wyrdgard-icons/user/${cfg.name}" fileName = cfg.icon.fileName;
mkdir -p "$target" };
}
''
local target="$out/share/wyrdgard-icons/user/${cfg.name}"
mkdir -p "$target"
cp ${cfg.icon} "$target/${cfg.icon.fileName}" cp ${cfg.icon} "$target/${cfg.icon.fileName}"
''; '';
in { in
{
options.wyrdgard.user = with types; { options.wyrdgard.user = with types; {
name = mkOpt str "cholli" "The name to use for the user account."; name = mkOpt str "cholli" "The name to use for the user account.";
fullName = mkOpt str "Christoph Hollizeck" "The full name of the user."; fullName = mkOpt str "Christoph Hollizeck" "The full name of the user.";
email = mkOpt str "christoph.hollizeck@hey.com" "The email of the user."; email = mkOpt str "christoph.hollizeck@hey.com" "The email of the user.";
initialPassword = initialPassword = mkOpt str "asdf" "The initial password to use when the user is first created.";
mkOpt str "asdf" icon = mkOpt (nullOr package) defaultIcon "The profile picture to use for the user.";
"The initial password to use when the user is first created."; extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
icon = extraOptions = mkOpt attrs { } (mdDoc "Extra options passed to `users.users.<name>`.");
mkOpt (nullOr package) defaultIcon
"The profile picture to use for the user.";
extraGroups = mkOpt (listOf str) [] "Groups for the user to be assigned.";
extraOptions =
mkOpt attrs {}
(mdDoc "Extra options passed to `users.users.<name>`.");
}; };
config = { config = {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ ];
];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -67,33 +68,28 @@ in {
"Videos/.keep".text = ""; "Videos/.keep".text = "";
"projects/.keep".text = ""; "projects/.keep".text = "";
".face".source = cfg.icon; ".face".source = cfg.icon;
"Pictures/${ "Pictures/${cfg.icon.fileName or (builtins.baseNameOf cfg.icon)}".source = cfg.icon;
cfg.icon.fileName or (builtins.baseNameOf cfg.icon)
}".source =
cfg.icon;
}; };
}; };
users.users.${cfg.name} = users.users.${cfg.name} = {
{ isNormalUser = true;
isNormalUser = true;
inherit (cfg) name initialPassword; inherit (cfg) name initialPassword;
home = "/home/${cfg.name}"; home = "/home/${cfg.name}";
group = "users"; group = "users";
shell = pkgs.zsh; shell = pkgs.zsh;
# Arbitrary user ID to use for the user. Since I only # Arbitrary user ID to use for the user. Since I only
# have a single user on my machines this won't ever collide. # have a single user on my machines this won't ever collide.
# However, if you add multiple users you'll need to change this # However, if you add multiple users you'll need to change this
# so each user has their own unique uid (or leave it out for the # so each user has their own unique uid (or leave it out for the
# system to select). # system to select).
uid = 1000; uid = 1000;
extraGroups = ["steamcmd"] ++ cfg.extraGroups; extraGroups = [ "steamcmd" ] ++ cfg.extraGroups;
} } // cfg.extraOptions;
// cfg.extraOptions;
}; };
} }

View file

@ -0,0 +1,5 @@
{ channels, ... }:
final: prev: {
vivaldi = prev.vivaldi.override { commandLineArgs = "--disable-features=AllowQt"; };
}

View file

@ -5,14 +5,14 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; { with lib.wyrdgard;
imports = [./hardware.nix]; {
imports = [ ./hardware.nix ];
boot.blacklistedKernelModules = ["hyperv-fb"]; boot.blacklistedKernelModules = [ "hyperv-fb" ];
virtualisation.hypervGuest.videoMode = "1920x1080"; virtualisation.hypervGuest.videoMode = "1920x1080";
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ ];
];
environment.variables.EDITOR = "nvim"; environment.variables.EDITOR = "nvim";
environment.variables.SUDOEDITOR = "nvim"; environment.variables.SUDOEDITOR = "nvim";

View file

@ -7,13 +7,17 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
imports = []; {
imports = [ ];
boot.initrd.availableKernelModules = ["sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "sd_mod"
boot.kernelModules = []; "sr_mod"
boot.extraModulePackages = []; ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/c58c66b3-4e0f-4393-8d7b-871d934856e3"; device = "/dev/disk/by-uuid/c58c66b3-4e0f-4393-8d7b-871d934856e3";
@ -25,7 +29,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = []; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -5,13 +5,13 @@
... ...
}: }:
with lib; with lib;
with lib.wyrdgard; { with lib.wyrdgard;
imports = [./hardware.nix]; {
imports = [ ./hardware.nix ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ ];
];
environment.pathsToLink = ["/libexec"]; environment.pathsToLink = [ "/libexec" ];
wyrdgard = { wyrdgard = {
archetypes = { archetypes = {

View file

@ -7,15 +7,24 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
imports = [ {
(modulesPath + "/installer/scan/not-detected.nix") imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "nvme"
boot.kernelModules = ["kvm-amd" "btusb"]; "xhci_pci"
boot.extraModulePackages = []; "ahci"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [
"kvm-amd"
"btusb"
];
boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/444a9216-59d1-46e0-9643-0b716a42ba0b"; device = "/dev/disk/by-uuid/444a9216-59d1-46e0-9643-0b716a42ba0b";
@ -27,7 +36,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = []; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's