Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
elythh committed Aug 29, 2024
1 parent a077096 commit 1cdcb90
Show file tree
Hide file tree
Showing 23 changed files with 601 additions and 41 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
homes.modules = with inputs; [
stylix.homeManagerModules.stylix
anyrun.homeManagerModules.default
spicetify-nix.homeManagerModules.default
spicetify.homeManagerModules.default
];

systems = {
Expand Down
8 changes: 0 additions & 8 deletions homes/x86_64-linux/gwen@grovetender/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ in
hyprland = {
enable = true;
# enableDebug = true;

appendConfig = # bash
''
exec-once = hyprctl setcursor ${config.${namespace}.theme.gtk.cursor.name} ${
builtins.toString config.${namespace}.theme.gtk.cursor.size
}
'';

};
};
};
Expand Down
40 changes: 40 additions & 0 deletions lib/module/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib, ... }:
with lib;
rec {
mkOpt =
type: default: description:
mkOption { inherit type default description; };

mkOpt' = type: default: mkOpt type default null;

mkBoolOpt = mkOpt types.bool;

mkBoolOpt' = mkOpt' types.bool;

enabled = {
enable = true;
};

disabled = {
enable = false;
};

capitalize =
s:
let
len = stringLength s;
in
if len == 0 then "" else (lib.toUpper (substring 0 1 s)) + (substring 1 len s);

# return an int (1/0) based on boolean value
# `boolToNum true` -> 1
boolToNum = bool: if bool then 1 else 0;

default-attrs = mapAttrs (_key: mkDefault);

force-attrs = mapAttrs (_key: mkForce);

nested-default-attrs = mapAttrs (_key: default-attrs);

nested-force-attrs = mapAttrs (_key: force-attrs);
}
43 changes: 43 additions & 0 deletions modules/nixos/displaymanager/sddm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib) mkIf getExe' stringAfter;
inherit (lib.${namespace}) mkBoolOpt enabled;

cfg = config.${namespace}.display-managers.sddm;
in
{
options.${namespace}.display-managers.sddm = {
enable = mkBoolOpt false "Whether or not to enable sddm.";
};

config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
catppuccin-sddm-corners
sddm
];

services = {
displayManager = {
sddm = {
inherit (cfg) enable;
theme = "catppuccin-sddm-corners";
wayland = enabled;
};
};
};

system.activationScripts.postInstallSddm =
stringAfter [ "users" ] # bash
''
echo "Setting sddm permissions for user icon"
${getExe' pkgs.acl "setfacl"} -m u:sddm:x /home/${config.${namespace}.user.name}
${getExe' pkgs.acl "setfacl"} -m u:sddm:r /home/${config.${namespace}.user.name}/.face.icon || true
'';
};
}
12 changes: 7 additions & 5 deletions modules/nixos/hardware/cpu/amd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ let
cfg = config.${namespace}.hardware.cpu.amd;
in
{
options.${namespace}.hardware.cpu = {
enable = mkBoolOpt false "No-op used for setting up hierarchy.";
};
options.${namespace}.hardware.cpu.amd = {
enable = mkBoolOpt false "Whether or not to enable support for amd cpu.";
options.${namespace}.hardware = {
cpu = {
enable = mkBoolOpt false "No-op used for setting up hierarchy.";
amd = {
enable = mkBoolOpt false "Whether or not to enable support for amd cpu.";
};
};
};

config = mkIf cfg.enable {
Expand Down
19 changes: 19 additions & 0 deletions modules/nixos/programs/graphical/addons/keyring/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
config,
lib,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.graphical.addons.keyring;
in
{
options.${namespace}.programs.graphical.addons.keyring = {
enable = mkBoolOpt false "Whether to enable the passwords application.";
};

config = mkIf cfg.enable { programs.seahorse.enable = true; };
}
50 changes: 50 additions & 0 deletions modules/nixos/programs/graphical/addons/noisetorch/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkOption
literalExpression
types
;

cfg = config.${namespace}.programs.graphical.addons.noisetorch;
in
{
options.${namespace}.programs.graphical.addons.noisetorch = {
enable = mkEnableOption "noisetorch service";
package = mkOption {
type = types.package;
default = pkgs.noisetorch;
defaultText = literalExpression "pkgs.noisetorch";
description = "Which package to use for noisetorch";
};
threshold = mkOption {
type = types.int;
default = -1;
description = "Voice activation threshold (default -1)";
};
device = mkOption {
type = types.str;
description = "Use the specified source/sink device ID";
};
deviceUnit = mkOption {
type = types.str;
description = "Systemd device unit which is providing the audio device";
};
};

config = mkIf cfg.enable {
programs.noisetorch = {
enable = true;

inherit (cfg) package;
};
};
}
72 changes: 72 additions & 0 deletions modules/nixos/programs/graphical/addons/xdg-portal/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
config,
inputs,
lib,
pkgs,
system,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
inherit (inputs) hyprland xdg-desktop-portal-hyprland;

cfg = config.${namespace}.programs.graphical.addons.xdg-portal;
in
{
options.${namespace}.programs.graphical.addons.xdg-portal = {
enable = mkBoolOpt false "Whether or not to add support for xdg portal.";
};

config = mkIf cfg.enable {
xdg = {
portal = {
enable = true;

configPackages = [ hyprland.packages.${system}.hyprland ];

config = {
hyprland = mkIf config.${namespace}.programs.graphical.wms.hyprland.enable {
default = [
"hyprland"
"gtk"
];
"org.freedesktop.impl.portal.Screencast" = "hyprland";
"org.freedesktop.impl.portal.Screenshot" = "hyprland";
};

common = {
default = [ "gtk" ];

"org.freedesktop.impl.portal.Screencast" = "gtk";
"org.freedesktop.impl.portal.Screenshot" = "gtk";
"org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ];
};
};

extraPortals =
with pkgs;
[ xdg-desktop-portal-gtk ]
++ (lib.optional config.${namespace}.programs.graphical.wms.hyprland.enable (
xdg-desktop-portal-hyprland.packages.${system}.xdg-desktop-portal-hyprland.override {
debug = true;
# TODO: use same package as home-manager
inherit (hyprland.packages.${system}) hyprland;
}
));
# xdgOpenUsePortal = true;

wlr = {
settings = {
screencast = {
max_fps = 30;
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
};
};
};
};
};
};
}
20 changes: 20 additions & 0 deletions modules/nixos/programs/graphical/apps/bitwarden/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib) mkEnableOption;

cfg = config.${namespace}.programs.graphical.apps.bitwarden;
in
{
options.${namespace}.programs.graphical.apps.bitwarden = {
enable = mkEnableOption "Wether or not to enable bitwarden";
};
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [ bitwarden ];
};
}
25 changes: 25 additions & 0 deletions modules/nixos/programs/graphical/apps/partitionmanager/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.graphical.apps.partitionmanager;
in
{
options.${namespace}.programs.graphical.apps.partitionmanager = {
enable = mkBoolOpt false "Whether or not to enable partitionmanager.";
};

config = mkIf cfg.enable {
programs.partition-manager = {
enable = true;
package = pkgs.kdePackages.partitionmanager;
};
};
}
23 changes: 23 additions & 0 deletions modules/nixos/programs/graphical/file-managers/thunar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
config,
lib,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.graphical.file-managers.thunar;
in
{
options.${namespace}.programs.graphical.file-managers.thunar = {
enable = mkBoolOpt false "Whether to enable the xfce file manager.";
};

config = mkIf cfg.enable {
programs.thunar = {
enable = true;
};
};
}
Loading

0 comments on commit 1cdcb90

Please # to comment.