refactor: lib, flake.nix

This commit is contained in:
Leon Schwarzäugl 2024-12-28 23:59:43 +01:00
parent a0f4384034
commit b71bb5794a
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
27 changed files with 540 additions and 706 deletions

View file

@ -1,3 +1,4 @@
{ lib, ... }:
let
moduleNames = [
"laptop"
@ -12,13 +13,5 @@ let
"filesystem"
"firefox"
];
mkImports = names: builtins.listToAttrs (map
(name: {
inherit name;
value = import ./${name}.nix;
})
names);
in
mkImports moduleNames
lib.swarselsystems.mkModules moduleNames "home"

View file

@ -1,5 +1,4 @@
{ lib, ... }:
{
options.swarselsystems.isBtrfs = lib.mkEnableOption "use btrfs filesystem";
}

View file

@ -1,5 +1,4 @@
{ lib, ... }:
{
options.swarselsystems.cpuCount = lib.mkOption {
type = lib.types.int;

View file

@ -1,14 +1,11 @@
{ lib, config, ... }:
let
inherit (lib) mkOption types;
in
{
options.swarselsystems.inputs = mkOption {
type = types.attrsOf (types.attrsOf types.str);
options.swarselsystems.inputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { };
};
options.swarselsystems.kyria = mkOption {
type = types.attrsOf (types.attrsOf types.str);
options.swarselsystems.kyria = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = {
"36125:53060:splitkb.com_splitkb.com_Kyria_rev3" = {
xkb_layout = "us";
@ -20,21 +17,21 @@ in
};
};
};
options.swarselsystems.touchpad = mkOption {
type = types.attrsOf (types.attrsOf types.str);
options.swarselsystems.touchpad = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { };
};
options.swarselsystems.standardinputs = mkOption {
type = types.attrsOf (types.attrsOf types.str);
options.swarselsystems.standardinputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = lib.recursiveUpdate (lib.recursiveUpdate config.swarselsystems.touchpad config.swarselsystems.kyria) config.swarselsystems.inputs;
internal = true;
};
options.swarselsystems.keybindings = mkOption {
type = types.attrsOf types.str;
options.swarselsystems.keybindings = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
options.swarselsystems.shellAliases = mkOption {
type = types.attrsOf types.str;
options.swarselsystems.shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
}

View file

@ -1,22 +1,19 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.swarselsystems.monitors = mkOption {
type = types.attrsOf (types.attrsOf types.str);
options.swarselsystems.monitors = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { };
};
options.swarselsystems.sharescreen = mkOption {
type = types.str;
options.swarselsystems.sharescreen = lib.mkOption {
type = lib.types.str;
default = "";
};
options.swarselsystems.lowResolution = mkOption {
type = types.str;
options.swarselsystems.lowResolution = lib.mkOption {
type = lib.types.str;
default = "";
};
options.swarselsystems.highResolution = mkOption {
type = types.str;
options.swarselsystems.highResolution = lib.mkOption {
type = lib.types.str;
default = "";
};
}

View file

@ -7,9 +7,7 @@
options.swarselsystems.isNixos = lib.mkEnableOption "nixos host";
options.swarselsystems.isPublic = lib.mkEnableOption "is a public machine (no secrets)";
config.swarselsystems.startup = lib.mkIf (!config.swarselsystems.isNixos) [
{
command = "sleep 60 && nixGL nextcloud --background";
}
{ command = "sleep 60 && nixGL nextcloud --background"; }
{ command = "sleep 60 && nixGL vesktop --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki"; }
@ -17,6 +15,7 @@
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
];
options.swarselsystems.swayfxConfig = lib.mkOption {
type = lib.types.str;
default = "

View file

@ -1,11 +1,7 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.swarselsystems.startup = mkOption {
type = types.listOf (types.attrsOf types.str);
options.swarselsystems.startup = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [
{ command = "nextcloud --background"; }
{ command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; }

View file

@ -1,5 +1,4 @@
{ lib, ... }:
{
options.swarselsystems.wallpaper = lib.mkOption {
type = lib.types.path;

View file

@ -1,5 +1,4 @@
{ lib, config, ... }:
let
generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1)));
in

View file

@ -1,3 +1,4 @@
{ lib, ... }:
let
moduleNames = [
"wallpaper"
@ -6,13 +7,5 @@ let
"server"
"input"
];
mkImports = names: builtins.listToAttrs (map
(name: {
inherit name;
value = import ./${name}.nix;
})
names);
in
mkImports moduleNames
lib.swarselsystems.mkModules moduleNames "nixos"

View file

@ -1,10 +1,7 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.swarselsystems.shellAliases = mkOption {
type = types.attrsOf types.str;
options.swarselsystems.shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
}