add doctrine and sway modules

This commit is contained in:
Fabian Montero 2025-08-05 23:22:16 -06:00
parent 1c7810a49e
commit 768378cc4a
Signed by: fabian
GPG key ID: 1FFAC35E1798174F
8 changed files with 110 additions and 3 deletions

12
doctrine/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
pkgs,
namespace,
}: let
doctrine = {
lib = import ./lib {inherit lib pkgs doctrine;};
prefix = "trivium";
inherit namespace;
};
inherit (pkgs) lib;
in
doctrine

10
doctrine/lib/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
lib,
doctrine,
pkgs,
}: let
close = f: args: f (args // {inherit lib pkgs doctrine;});
in {
importAll = pkgs.callPackage ./importAll.nix {};
mkModule = close (import ./mk-module.nix);
}

View file

@ -0,0 +1,30 @@
{
name,
hm ? null,
sys ? null,
options ? null,
lib,
config,
pkgs,
doctrine,
}: let
optionsSet = import options {
inherit config lib pkgs cfg name doctrine;
};
configFiles = {
inherit sys hm;
};
cfg = config.${doctrine.prefix}.${name};
in {
config = lib.mkIf cfg.enable (import configFiles.${doctrine.namespace} {
inherit config lib pkgs doctrine cfg;
});
options =
lib.optionalAttrs (options != null) optionsSet.${doctrine.namespace}
// {
enable = lib.mkEnableOption name;
};
}

14
modules/sway/default.nix Normal file
View file

@ -0,0 +1,14 @@
{
config,
lib,
pkgs,
doctrine,
...
}:
doctrine.lib.mkModule {
inherit config;
name = "sway";
hm = ./hm.nix;
sys = ./sys.nix;
options = ./options.nix;
}

3
modules/sway/options.nix Normal file
View file

@ -0,0 +1,3 @@
{
sys = {};
}

41
modules/sway/sys.nix Normal file
View file

@ -0,0 +1,41 @@
{pkgs, ...}: {
services.libinput.enable = true;
hardware.graphics.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = with pkgs; [xdg-desktop-portal-gtk];
xdgOpenUsePortal = true;
# warning: xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you
# should either set `xdg.portal.config` or `xdg.portal.configPackages`
# to specify which portal backend to use for the requested interface.
#
# https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in
#
# If you simply want to keep the behaviour in < 1.17, which uses the first
# portal implementation found in lexicographical order, use the following:
#
# xdg.portal.config.common.default = "*";
config.common.default = "*";
};
environment = {
sessionVariables.NIXOS_OZONE_WL = "1";
systemPackages = with pkgs; [
qt5.qtwayland
qt6.qtwayland
];
};
programs = {
gtklock = {
enable = mkDefault true;
config = {};
modules = [];
};
};
}

View file

@ -1,3 +0,0 @@
{callPackage}: {
importAll = callPackage ./importAll.nix {};
}