diff --git a/doctrine/default.nix b/doctrine/default.nix new file mode 100644 index 0000000..b4c72b8 --- /dev/null +++ b/doctrine/default.nix @@ -0,0 +1,12 @@ +{ + pkgs, + namespace, +}: let + doctrine = { + lib = import ./lib {inherit lib pkgs doctrine;}; + prefix = "trivium"; + inherit namespace; + }; + inherit (pkgs) lib; +in + doctrine diff --git a/doctrine/lib/default.nix b/doctrine/lib/default.nix new file mode 100644 index 0000000..1b03fe1 --- /dev/null +++ b/doctrine/lib/default.nix @@ -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); +} diff --git a/pkgs/lib/importAll.nix b/doctrine/lib/importAll.nix similarity index 100% rename from pkgs/lib/importAll.nix rename to doctrine/lib/importAll.nix diff --git a/doctrine/lib/mk-module.nix b/doctrine/lib/mk-module.nix new file mode 100644 index 0000000..aac7500 --- /dev/null +++ b/doctrine/lib/mk-module.nix @@ -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; + }; +} diff --git a/modules/sway/default.nix b/modules/sway/default.nix new file mode 100644 index 0000000..7c4af71 --- /dev/null +++ b/modules/sway/default.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + pkgs, + doctrine, + ... +}: +doctrine.lib.mkModule { + inherit config; + name = "sway"; + hm = ./hm.nix; + sys = ./sys.nix; + options = ./options.nix; +} diff --git a/modules/sway/options.nix b/modules/sway/options.nix new file mode 100644 index 0000000..b6505c6 --- /dev/null +++ b/modules/sway/options.nix @@ -0,0 +1,3 @@ +{ + sys = {}; +} diff --git a/modules/sway/sys.nix b/modules/sway/sys.nix new file mode 100644 index 0000000..f01ffca --- /dev/null +++ b/modules/sway/sys.nix @@ -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 = []; + }; + }; +} diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix deleted file mode 100644 index e3ab56e..0000000 --- a/pkgs/lib/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{callPackage}: { - importAll = callPackage ./importAll.nix {}; -}