nix fmt rfc

This commit is contained in:
Christoph Hollizeck 2024-04-04 19:31:55 +02:00
parent 3a8003e671
commit 56df50bdc1
Signed by: Daholli
GPG key ID: 249300664F2AF2C7
41 changed files with 430 additions and 351 deletions

View file

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

View file

@ -6,14 +6,19 @@
...
}:
with lib;
with lib.wyrdgard; let
with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.nixvim;
in {
in
{
options.wyrdgard.apps.cli-apps.nixvim = with types; {
enable = mkBoolOpt true "Whether to enable nixvim or not (Default true)";
};
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.wyrdgard; let
with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.discord;
in {
in
{
options.wyrdgard.apps.discord = with types; {
enable = mkBoolOpt false "Whether or not to enable basic configuration";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
discord
];
};
config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ discord ]; };
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,12 +6,14 @@
...
}:
with lib;
with lib.wyrdgard; let
with lib.wyrdgard;
let
cfg = config.wyrdgard.system.fonts;
in {
in
{
options.wyrdgard.system.fonts = with types; {
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 {
@ -20,13 +22,17 @@ in {
LOG_ICONS = "true";
};
environment.systemPackages = with pkgs; [
font-manager
];
environment.systemPackages = with pkgs; [ font-manager ];
fonts.packages = with pkgs;
fonts.packages =
with pkgs;
[
(nerdfonts.override {fonts = ["CodeNewRoman" "NerdFontsSymbolsOnly"];})
(nerdfonts.override {
fonts = [
"CodeNewRoman"
"NerdFontsSymbolsOnly"
];
})
font-awesome
powerline-fonts
powerline-symbols

View file

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

View file

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

View file

@ -6,9 +6,11 @@
...
}:
with lib;
with lib.wyrdgard; let
with lib.wyrdgard;
let
cfg = config.wyrdgard.system.hardware.gpu.nvidia;
in {
in
{
options.wyrdgard.system.hardware.gpu.nvidia = with types; {
enable = mkEnableOption "Enable Nvidia GPU";
};
@ -29,7 +31,7 @@ in {
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;
};
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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