diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 015dc25..62524cb 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -21,7 +21,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} extra-conf: | - extra-experimental-features = nix-command flakes + extra-experimental-features = nix-command flakes pipe-operators - name: Set up cache uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 193d5e7..84bda95 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,7 +15,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} extra-conf: | - extra-experimental-features = nix-command flakes + extra-experimental-features = nix-command flakes pipe-operators - name: Set up cache uses: DeterminateSystems/magic-nix-cache-action@main - name: Build ISO @@ -27,4 +27,3 @@ jobs: uses: softprops/action-gh-release@v1 with: path: path/ - diff --git a/docs/default.nix b/docs/default.nix index f7e9622..65a0659 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -14,15 +14,35 @@ echo "- [${name}](${name}.md)" >> src/SUMMARY.md ''; system = (build_systems {root = ../example/.;})."example".options; - makeOptionsDocPrograms = name: pkgs.nixosOptionsDoc {options = system.mods.${name};}; + makeOptionsDocPrograms = names: pkgs.nixosOptionsDoc {options = lib.attrByPath (lib.splitString "." names) null system.mods;}; conf = makeOptionsDoc system.conf; - paths = builtins.readDir ../modules/programs; - names = lib.lists.remove "default" ( - map (name: lib.strings.removeSuffix ".nix" name) (lib.attrsets.mapAttrsToList (name: _: name) paths) + basePath = ../modules/programs; + pathToAttrs = path: + lib.attrsets.mapAttrsToList ( + name: meta: { + name = name; + meta = meta; + } + ) + (builtins.readDir path); + pathToStrings = path: prefix: let + mapFn = attrs: + if attrs.meta == "directory" + then pathToStrings "${basePath}/${attrs.name}" attrs.name + else if prefix != "" + then "${prefix}.${attrs.name}" + else attrs.name; + in + map + mapFn + (pathToAttrs path); + filteredNames = builtins.filter (names: !(lib.strings.hasInfix "default" names)) ( + map (name: lib.strings.removeSuffix ".nix" name) (lib.lists.flatten (pathToStrings basePath "")) ); - mods = map makeOptionsDocPrograms names; - docs = lib.strings.concatLines (map generateDocs (lib.lists.zipLists names mods)); - summary = lib.strings.concatStringsSep " " (map summaryAppend names); + deduplicatedNames = map (name: lib.strings.splitString "." name |> lib.lists.unique |> lib.strings.concatStringsSep "." ) filteredNames; + mods = map makeOptionsDocPrograms deduplicatedNames; + docs = lib.strings.concatLines (map generateDocs (lib.lists.zipLists deduplicatedNames mods)); + summary = lib.strings.concatStringsSep " " (map summaryAppend deduplicatedNames); in pkgs.stdenvNoCC.mkDerivation { name = "dashNix-book"; diff --git a/home/default.nix b/home/default.nix index 5cd013a..6e178e2 100644 --- a/home/default.nix +++ b/home/default.nix @@ -35,7 +35,7 @@ ./common.nix ./themes ./sync.nix - ../modules/programs/browser/foxwrappers.nix + ../lib/foxwrappers.nix ] ++ homeMods ++ additionalHomeMods diff --git a/modules/programs/browser/foxwrappers.nix b/lib/foxwrappers.nix similarity index 100% rename from modules/programs/browser/foxwrappers.nix rename to lib/foxwrappers.nix diff --git a/modules/conf.nix b/modules/conf.nix index a9e9734..2cfc57b 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -104,17 +104,6 @@ ''; }; - streamdeck = { - enable = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Install streamdeck configuration program. - ''; - }; - }; - kernelOverride = lib.mkOption { default = null; type = with lib.types; nullOr package; diff --git a/modules/programs/browser/zen.nix b/modules/programs/browser/zen.nix index 375756c..b9840d0 100644 --- a/modules/programs/browser/zen.nix +++ b/modules/programs/browser/zen.nix @@ -39,7 +39,7 @@ in { (mkExtension "@react-devtools" "https://addons.mozilla.org/firefox/downloads/latest/react-devtools/latest.xpi") (mkExtension "extension@redux.devtools" "https://addons.mozilla.org/firefox/downloads/latest/reduxdevtools/latest.xpi") (mkExtension "private-relay@firefox.com" "https://addons.mozilla.org/firefox/downloads/latest/private-relay/latest.xpi") - (mkExtension "addon@darkreader.org" "file://${pkgs.callPackage ./darkreader.nix {inherit lib stable;}}/latest.xpi") + (mkExtension "addon@darkreader.org" "file://${pkgs.callPackage ../../../patches/darkreader.nix {inherit lib stable;}}/latest.xpi") ]; example = []; type = with lib.types; listOf anything; diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 3248690..f46243c 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -34,6 +34,7 @@ ./sddm.nix ./sops.nix ./starship.nix + ./streamcontroller.nix ./stylix.nix ./supersonic.nix ./sway.nix diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hyprland/hyprland.nix index fe25f14..25dcc05 100644 --- a/modules/programs/hyprland/hyprland.nix +++ b/modules/programs/hyprland/hyprland.nix @@ -13,95 +13,93 @@ then config.mods.homePackages.browser.meta.mainProgram else config.mods.homePackages.browser.pname; in { - options.mods = { - hyprland = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enable Hyprland - ''; - }; - monitor = lib.mkOption { - default = [ - # main monitor - "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" - # all others - ",highrr,auto,1" - ]; - example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; - type = with lib.types; listOf str; - description = '' - The monitor configuration for hyprland. - ''; - }; - workspace = lib.mkOption { - default = []; - example = ["2,monitor:DP-1, default:true"]; - type = with lib.types; listOf str; - description = '' - The workspace configuration for hyprland. - ''; - }; - noAtomic = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Use tearing - ''; - }; - extraAutostart = lib.mkOption { - default = []; - example = ["your application"]; - type = lib.types.listOf lib.types.str; - description = '' - Extra exec_once. - ''; - }; - useDefaultConfig = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured Hyprland config. - ''; - }; - customConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Custom Hyprland configuration. - Will be merged with default configuration if enabled. - ''; - }; - plugins = lib.mkOption { - default = []; - example = []; - type = with lib.types; listOf package; - description = '' - Plugins to be added to Hyprland. - ''; - }; - pluginConfig = lib.mkOption { - default = {}; - example = {}; - type = with lib.types; attrsOf anything; - description = '' - Plugin configuration to be added to Hyprland. - ''; - }; - hyprspaceEnable = lib.mkOption { - default = false; - type = lib.types.bool; - example = true; - description = '' - Enables Hyprspace plugin for hyprland. - Please note, plugins tend to break VERY often. - ''; - }; + options.mods.hyprland = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enable Hyprland + ''; + }; + monitor = lib.mkOption { + default = [ + # main monitor + "${config.conf.defaultMonitor},${config.conf.defaultMonitorMode},0x0,${config.conf.defaultMonitorScale}" + # all others + ",highrr,auto,1" + ]; + example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"]; + type = with lib.types; listOf str; + description = '' + The monitor configuration for hyprland. + ''; + }; + workspace = lib.mkOption { + default = []; + example = ["2,monitor:DP-1, default:true"]; + type = with lib.types; listOf str; + description = '' + The workspace configuration for hyprland. + ''; + }; + noAtomic = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Use tearing + ''; + }; + extraAutostart = lib.mkOption { + default = []; + example = ["your application"]; + type = lib.types.listOf lib.types.str; + description = '' + Extra exec_once. + ''; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured Hyprland config. + ''; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom Hyprland configuration. + Will be merged with default configuration if enabled. + ''; + }; + plugins = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = '' + Plugins to be added to Hyprland. + ''; + }; + pluginConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Plugin configuration to be added to Hyprland. + ''; + }; + hyprspaceEnable = lib.mkOption { + default = false; + type = lib.types.bool; + example = true; + description = '' + Enables Hyprspace plugin for hyprland. + Please note, plugins tend to break VERY often. + ''; }; }; diff --git a/modules/programs/streamcontroller.nix b/modules/programs/streamcontroller.nix new file mode 100644 index 0000000..4db158b --- /dev/null +++ b/modules/programs/streamcontroller.nix @@ -0,0 +1,37 @@ +{ + lib, + pkgs, + config, + options, + ... +}: { + options.mods = { + streamcontroller = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables starship prompt + ''; + }; + configFilePath = lib.mkOption { + default = null; + type = with lib.types; nullOr path; + description = '' + Path to the config json for the streamcontroller. + -> ./something.json + ''; + }; + }; + }; + + config = lib.mkIf config.mods.streamcontroller.enable ( + lib.optionalAttrs (options ? environment.systemPackages) { + programs.streamcontroller.enable = true; + } + // (lib.optionalAttrs (options ? home.file) { + home.file."var/app/com.core447.StreamController/data/pages/defaultpage.json".path = lib.mkIf (!isNull config.mods.streamcontroller.path) config.mods.streamcontroller.path; + }) + ); +} diff --git a/modules/programs/browser/darkeader.patch b/patches/darkeader.patch similarity index 100% rename from modules/programs/browser/darkeader.patch rename to patches/darkeader.patch diff --git a/modules/programs/browser/darkreader.nix b/patches/darkreader.nix similarity index 100% rename from modules/programs/browser/darkreader.nix rename to patches/darkreader.nix