diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index ae6de9e..06dc541 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,58 +1,34 @@ # by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml name: Docs - on: push: branches: - main - jobs: build: name: Build - permissions: contents: read - - runs-on: ubuntu-latest - + runs-on: nixos-latest steps: - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - extra-conf: | - extra-experimental-features = nix-command flakes - - - name: Set up cache - uses: DeterminateSystems/magic-nix-cache-action@main - + - name: Nix Config + run: | + mkdir -p $HOME/.config + mkdir -p $HOME/.config/nix + echo experimental-features = nix-command flakes pipe-operators >> $HOME/.config/nix/nix.conf + echo access-tokens = github.com=${{ secrets.GITHUBTOKEN }} >> $HOME/.config/nix/nix.conf + nix profile install nixpkgs#nodejs - name: Build docs - run: nix -L build github:${{ github.repository }}/${{ github.sha }}#docs - + run: nix -L build git+https://git.dashie.org/${{ forgejo.repository }}.git?rev=${{ forgejo.sha }}#docs --no-write-lock-file - name: Prepare docs for upload run: cp -r --dereference --no-preserve=mode,ownership result/ public/ - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + # - name: Upload artifact + # uses: https://data.forgejo.org/forgejo/upload-artifact@v4 + # with: + # path: public/ + - name: Publish Page + uses: https://data.forgejo.org/actions/git-pages@v2 with: - path: public/ - - deploy: - name: Deploy - - needs: build - - permissions: - pages: write - id-token: write - - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - runs-on: ubuntu-latest - - steps: - - name: Deploy docs to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + site: https://username.pages.dashie.org/reponame/ + token: ${{ forge.token }} + source: public/ diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..e92ddfd --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,35 @@ +# inspired by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml +name: PR check +on: + pull_request: + branches: ["main"] +jobs: + build: + name: check + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + extra-conf: | + extra-experimental-features = nix-command flakes pipe-operators + - name: Set up cache + uses: DeterminateSystems/magic-nix-cache-action@main + - name: action + uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: cache + uses: cachix/cachix-action@v16 + with: + name: dashnix + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Linter check + run: nix run --no-write-lock-file github:${{ github.repository }}/${{ github.sha }}#lint -- check + - name: Format check + run: nix run --no-write-lock-file github:${{ github.repository }}/${{ github.sha }}#format -- --check . + - name: Build docs + run: nix -L build github:${{ github.repository }}/${{ github.sha }}#docs --no-write-lock-file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ecee195..1984fb1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,30 +1,29 @@ -# by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml -name: Release -on: - release: - types: [created] -jobs: - build: - name: Release - permissions: - contents: read - runs-on: ubuntu-latest - steps: - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - extra-conf: | - extra-experimental-features = nix-command flakes - - name: Set up cache - uses: DeterminateSystems/magic-nix-cache-action@main - - name: Build ISO - run: nix build github:${{ github.repository }}/${{ github.sha }}#iso - - name: Prepare ISO for upload - run: | - cp -r --dereference --no-preserve=mode,ownership result/ public/ - - name: upload ISO - uses: softprops/action-gh-release@v1 - with: - path: path/ - +# by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml +name: Release +on: + release: + types: [created] +jobs: + build: + name: Release + permissions: write-all + runs-on: ubuntu-latest + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + extra-conf: | + extra-experimental-features = nix-command flakes pipe-operators + - name: Set up cache + uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build ISO + run: nix build github:${{ github.repository }}/${{ github.sha }}#iso --no-write-lock-file + - name: Prepare ISO for upload + run: | + cp -r --dereference --no-preserve=mode,ownership result/iso/DashNix.iso DashNix.iso + - name: upload ISO + uses: softprops/action-gh-release@v1 + with: + files: | + DashNix.iso diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f610716 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +result/* +result +flake.lock diff --git a/LICENSE b/LICENSE index f288702..7b6bec5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,169 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -672,3 +838,4 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . + diff --git a/assets/logo.svg b/assets/logo.svg new file mode 100644 index 0000000..7ca00e2 --- /dev/null +++ b/assets/logo.svg @@ -0,0 +1,228 @@ + + + + diff --git a/assets/logo2.png b/assets/logo2.png new file mode 100644 index 0000000..beeac55 Binary files /dev/null and b/assets/logo2.png differ diff --git a/assets/logo2.svg b/assets/logo2.svg new file mode 100644 index 0000000..08baa43 --- /dev/null +++ b/assets/logo2.svg @@ -0,0 +1,238 @@ + + + +DashNixDashNix diff --git a/assets/logo3.svg b/assets/logo3.svg new file mode 100644 index 0000000..6076a01 --- /dev/null +++ b/assets/logo3.svg @@ -0,0 +1,238 @@ + + + +DashNixDashNix diff --git a/assets/rainbow.svg b/assets/rainbow.svg new file mode 100644 index 0000000..9f59c7c --- /dev/null +++ b/assets/rainbow.svg @@ -0,0 +1,141 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/common_hardware.nix b/base/common_hardware.nix index 7d7282c..9f7ccf1 100644 --- a/base/common_hardware.nix +++ b/base/common_hardware.nix @@ -1,33 +1,46 @@ { + mkDashDefault, pkgs, config, lib, hostName, modulesPath, ... -}: -let +}: let username = config.conf.username; -in -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +in { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + wsl.enable = mkDashDefault config.conf.wsl; # Bootloader. - boot = { - consoleLogLevel = 0; + boot = lib.mkIf (!config.conf.wsl) { + consoleLogLevel = mkDashDefault 0; + + lanzaboote = lib.mkIf config.conf.secureBoot { + enable = mkDashDefault true; + pkiBundle = mkDashDefault "/var/lib/sbctl"; + settings.reboot-for-bitlocker = mkDashDefault true; + }; + loader = { systemd-boot = { - enable = true; + enable = + if config.conf.secureBoot + then lib.mkForce false + else if config.conf.useSystemdBootloader + then true + else mkDashDefault false; configurationLimit = 5; }; - efi.canTouchEfiVariables = true; + efi.canTouchEfiVariables = mkDashDefault true; }; - plymouth = { - enable = true; - }; - kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + + kernelPackages = mkDashDefault pkgs.linuxPackages_latest; initrd = { - verbose = false; + verbose = mkDashDefault false; availableKernelModules = [ "nvme" "xhci_pci" @@ -37,76 +50,107 @@ in "sd_mod" ]; }; - kernelParams = [ - ''resume="PARTLABEL=SWAP"'' - ''quiet'' - ''udev.log_level=3'' - ] ++ config.conf.boot_params; + kernelParams = + [ + ''resume="PARTLABEL=SWAP"'' + ''quiet'' + ''udev.log_level=3'' + ] + ++ config.conf.bootParams; }; - # Enable networking networking = { - useDHCP = lib.mkDefault true; - networkmanager.enable = true; - hostName = hostName; + useDHCP = mkDashDefault true; + networkmanager.enable = mkDashDefault true; + hostName = mkDashDefault hostName; }; - # Set your time zone. - time.timeZone = config.conf.timezone; + time = { + timeZone = mkDashDefault config.conf.timezone; + hardwareClockInLocalTime = mkDashDefault config.conf.systemLocalTime; + }; - # Select internationalisation properties. - i18n.defaultLocale = config.conf.locale; + i18n.defaultLocale = mkDashDefault config.conf.locale; - # Enable the X11 windowing system. services = { - flatpak.enable = true; - xserver.enable = true; - fstrim.enable = lib.mkDefault true; + lorri.enable = mkDashDefault true; + xserver.enable = mkDashDefault true; + fstrim.enable = mkDashDefault true; + pulseaudio.enable = mkDashDefault false; pipewire = { - enable = true; + enable = mkDashDefault true; alsa = { - enable = true; - support32Bit = true; + enable = mkDashDefault true; + support32Bit = mkDashDefault true; }; - jack.enable = true; - pulse.enable = true; + jack.enable = mkDashDefault true; + pulse.enable = mkDashDefault true; }; }; - nixpkgs.hostPlatform = lib.mkDefault config.conf.system; + nixpkgs.hostPlatform = mkDashDefault config.conf.system; nix = { gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d --delete-generations +5"; + automatic = mkDashDefault true; + dates = mkDashDefault "weekly"; + options = mkDashDefault "--delete-older-than 7d --delete-generations +5"; }; settings = { - trusted-users = [ username ]; - auto-optimise-store = true; + trusted-users = [username]; + auto-optimise-store = mkDashDefault true; - experimental-features = "nix-command flakes"; + builders-use-substitutes = mkDashDefault true; + + trusted-substituters = [ + "https://hyprland.cachix.org" + "https://anyrun.cachix.org" + "https://oxipaste.cachix.org" + "https://oxinoti.cachix.org" + "https://oxishut.cachix.org" + "https://oxidash.cachix.org" + "https://oxicalc.cachix.org" + "https://hyprdock.cachix.org" + "https://reset.cachix.org" + "https://dashvim.cachix.org" + ]; + + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" + "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" + "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" + "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" + "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" + "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" + "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" + "dashvim.cachix.org-1:uLRdxp1WOWHnsZZtu3SwUWZRsvC7SXo0Gyk3tIefuL0=" + ]; + + experimental-features = mkDashDefault "nix-command flakes pipe-operators"; }; }; - # Enable sound with pipewire. hardware = { - pulseaudio.enable = false; - cpu.${config.conf.cpu}.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + cpu.${config.conf.cpu}.updateMicrocode = + mkDashDefault + config.hardware.enableRedistributableFirmware; }; - security.rtkit.enable = true; + security.rtkit.enable = mkDashDefault true; environment.variables = { - XDG_CACHE_HOME = "$HOME/.cache"; - DIRENV_LOG_FORMAT = ""; + XDG_CACHE_HOME = mkDashDefault "$HOME/.cache"; + DIRENV_LOG_FORMAT = mkDashDefault ""; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; }; # allows user change later on users = { - mutableUsers = true; + mutableUsers = mkDashDefault true; users.${username} = { - isNormalUser = true; - description = username; + isNormalUser = mkDashDefault true; + description = mkDashDefault username; extraGroups = [ "networkmanager" "wheel" @@ -115,6 +159,8 @@ in "vboxusers" "video" "audio" + "scanner" + "lp" ]; packages = with pkgs; [ home-manager @@ -122,8 +168,7 @@ in ]; # this password will only last for the first login # e.g. login, then change to whatever else, this also ensures no public hash is available - password = "firstlogin"; + password = mkDashDefault "firstlogin"; }; }; - } diff --git a/base/env.nix b/base/env.nix index 9a62d7e..0eaf068 100644 --- a/base/env.nix +++ b/base/env.nix @@ -1,18 +1,24 @@ -{ pkgs, config, ... }: { + mkDashDefault, + pkgs, + config, + lib, + ... +}: { environment = { variables = { - GSETTINGS_SCHEMA_DIR = "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; - NEOVIDE_MAXIMIZED = "0"; - GPG_TTY = "$(tty)"; - EDITOR = "neovide --no-fork"; - SUDO_EDITOR = "neovide --no-fork"; - SCRIPTS = "$HOME/.config/scripts"; + GSETTINGS_SCHEMA_DIR = mkDashDefault "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}"; + NEOVIDE_MAXIMIZED = mkDashDefault "0"; + GPG_TTY = mkDashDefault "$(tty)"; + EDITOR = mkDashDefault "neovide --no-fork"; + SUDO_EDITOR = mkDashDefault "neovide --no-fork"; + SCRIPTS = mkDashDefault "$HOME/.config/scripts"; }; sessionVariables = { - NIXOS_OZONE_WL = "1"; - GOPATH = "$HOME/.go"; - FLAKE = config.conf.nix_path; + NIXOS_OZONE_WL = mkDashDefault "1"; + GOPATH = mkDashDefault "$HOME/.go"; + FLAKE = mkDashDefault config.conf.nixosConfigPath; + NH_FLAKE = mkDashDefault config.conf.nixosConfigPath; }; }; } diff --git a/base/xkb_layout.nix b/base/xkb_layout.nix index ecbc97c..b399693 100644 --- a/base/xkb_layout.nix +++ b/base/xkb_layout.nix @@ -1,7 +1,10 @@ -{ pkgs, ... }: -let - layout = pkgs.writeText "dashie" '' - xkb_symbols "dashie" +{ + mkDashDefault, + pkgs, + ... +}: let + layout = pkgs.writeText "enIntUmlaut" '' + xkb_symbols "enIntUmlaut" { include "us(basic)" include "level3(ralt_switch)" @@ -10,12 +13,11 @@ let key { [ u, U, udiaeresis, Udiaeresis ] }; }; ''; -in -{ - environment.systemPackages = [ pkgs.xorg.xkbcomp ]; - services.xserver.xkb.extraLayouts.dashie = { +in { + environment.systemPackages = mkDashDefault [pkgs.xorg.xkbcomp]; + services.xserver.xkb.extraLayouts.enIntUmlaut = { description = "US layout with 'umlaut'"; - languages = [ "eng" ]; + languages = ["eng"]; symbolsFile = "${layout}"; }; } diff --git a/docs/default.nix b/docs/default.nix index a5a5f8d..1fd8a1e 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,12 +1,11 @@ # with friendly help by stylix: https://github.com/danth/stylix/blob/master/docs/default.nix { pkgs, - build_systems, + buildSystems, lib, ... -}: -let - makeOptionsDoc = configuration: pkgs.nixosOptionsDoc { options = configuration; }; +}: let + makeOptionsDoc = configuration: pkgs.nixosOptionsDoc {options = configuration;}; generateDocs = obj: '' touch src/${obj.fst}.md sed '/*Declared by:*/,/^$/d' <${obj.snd.optionsCommonMark} >> src/${obj.fst}.md @@ -14,29 +13,49 @@ let summaryAppend = name: '' echo "- [${name}](${name}.md)" >> src/SUMMARY.md ''; - system = (build_systems ../example/.)."example".options; - makeOptionsDocPrograms = name: pkgs.nixosOptionsDoc { options = system.mods.${name}; }; + system = (buildSystems {root = ../example/.;})."example".options; + 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: { + inherit name; + inherit 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"; - src = ./.; + pkgs.stdenvNoCC.mkDerivation { + name = "dashNix-book"; + src = ./.; - patchPhase = '' - sed '/*Declared by:*/,/^$/d' <${conf.optionsCommonMark} >> src/conf.md - ${docs} - echo "[README](README.md)\n # Options\n - [Base Config](conf.md)" >> src/SUMMARY.md - ${summary} - ''; + patchPhase = '' + sed '/*Declared by:*/,/^$/d' <${conf.optionsCommonMark} >> src/conf.md + ${docs} + echo "[README](README.md)\n # Options\n - [Base Config](conf.md)" >> src/SUMMARY.md + ${summary} + ''; - buildPhase = '' - ${pkgs.mdbook}/bin/mdbook build --dest-dir $out - ''; -} + buildPhase = '' + ${pkgs.mdbook}/bin/mdbook build --dest-dir $out + ''; + } diff --git a/docs/src/README.md b/docs/src/README.md index 2caf918..3658e00 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -1,180 +1,329 @@ -``` -██████ █████ ███████ ██ ██ ███ ██ ██ ██ ██ -██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ -██ ██ ███████ ███████ ███████ ██ ██ ██ ██ ███ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -██████ ██ ██ ███████ ██ ██ ██ ████ ██ ██ ██ -``` - -A very opinionated (technically only for me) configuration that allows easy adding and removing of systems alongside custom configurations for each system. - -# Usage - -This flake is intended to be used as an input to your own NixOS configuration: - -```nix -dashNix = { - url = "github:DashieTM/DashNix"; - inputs = { - # ensure these are here to update the packages on your own - nixpkgs.follows = "nixpkgs"; - stable.follows = "stable"; - }; -}; -``` - -You can then configure your systems in your flake outputs with a provided library command: - -```nix -nixosConfigurations = (inputs.dashNix.dashNixLib.build_systems ./.); -``` - -The paremeter specifies where your hosts directory will be placed, in said directory you can then create a directory for each system. -Note, the name of the systems directory is also its hostname. - -In order for your configuration to work, you are required to at least provide a single config file with a further config file being optional for custom configuration. -The hardware.nix specifies additional NixOS configuration, while home.nix specifies additional home-manager configuration. (both optional) - -|- flake.nix\ -|- flake.lock\ -|- hosts/\ -|--- system1/\ -|------ configuration.nix (required)\ -|------ hardware.nix (optional)\ -|------ home.nix (optional)\ -|--- system2/\ -|------ configuration.nix (required)\ -|------ hardware.nix (optional)\ -|------ home.nix (optional)\ -|--- system3/\ -|------ configuration.nix (required)\ -|------ hardware.nix (optional)\ -|------ home.nix (optional) - -Here is a minimal required configuration.nix (the TODOs mention a required change): - -```nix -{config, ...}: { - # variables for system - # TODO important changes - conf = { - # change this to your monitor and your pc name - # should be something like DP-1 - monitor = "YOURMONITOR"; - # your username - username = "YOURNAME"; - # TODO only needed when you use intel -> amd is default - # cpu = "intel"; - locale = "something.UTF-8"; - timezone = "CONTINENT/CITY"; - }; - # modules - mods = { - # default disk config has root home boot and swap partition, overwrite if you want something different - drives = { - defaultDrives.enable = false; - extraDrives = [ - { - name = "boot"; - drive = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; - }; - } - { - name = ""; - drive = { - device = "/dev/disk/by-label/ROOT"; - fsType = "ext4"; - options = [ "noatime" "nodiratime" "discard" ]; - }; - } - ]; - }; - sops.enable = false; - nextcloud.enable = false; - hyprland.monitor = [ - # default - # TODO change this to your resolution - "${config.conf.monitor},1920x1080@144,0x0,1" - # all others - ",highrr,auto,1" - ]; - # or amd, whatever you have - gpu.nvidia.enable = true; - kde_connect.enable = true; - # TODO change this to your main resolution - # -> this will be your login manager - greetd = { resolution = "3440x1440@180"; }; - }; -} -``` - -## First Login - -After logging in the first time, your password will be set to "firstlogin", please change this to whatever you like. - -## Nixos and Home-manager Modules - -You can add additional modules or remove all of them by overriding parameters to the build_systems command: - -```nix -nixosConfigurations = - let - additionalMods = { - nixos = [ - # your modules - ]; home = [ - # your modules - ]; - } - # passing this parameter will override the existing modules - mods = { - nixos = []; - home = []; - } - in - (inputs.dashNix.dashNixLib.build_systems [ - "system1" - ] ./. mods additionalMods); -``` - -# Modules - -This configuration features several modules that can be used as preconfigured "recipies". -These modules attempt to combine the home-manager and nixos packages/options to one single configuration file for each new system. -For package lists, please check the individual modules, as the lists can be long. - -- base packages : A list of system packages to be installed by default -- home packages : A list of home packages to be installed by default -- media packages : A list of media packages to be installed by default -- coding packages : A list of coding packages to be installed by default -- acpid : Enables the acpid daemon -- bluetooth : Configures/enables bluetooth and installs tools for bluetooth -- drives : A drive configuration module -- flatpak : Installs and enables declarative flatpak -- gnome_services : Gnome services for minimal enviroments -> Window managers etc -- gpu : GPU settings (AMD) -- greetd : Enables and configures the greetd/regreet login manager with Hyprland -- kde_connect : Enables KDE connect and opens its ports -- layout : Modules to configure keyboard layout system wide -- piper : Installs and enables piper alongside its daemon -- printing : Enables and configures printing services -- virtualbox : Enables and configures virtualbox -- xone : Installs the xone driver -- starship : Configures the starship prompt -- keepassxc : Configures keepassxc -- gaming : Configures gaming related features (launchers, gamemode) -- stylix : Configures system themes, can also be applied to dashvim if used. -- git : Git key and config module -- nextcloud : Handles synchronization via nextcloud cmd. (requires config.sops.secrets.nextcloud) -- firefox: Enables and configures firefox (extensions and settings) -- Hyprland: Installs and configures Hyprland with various additional packages -- yazi: Installs yazi and sets custom keybinds -- teams: For the poor souls that have to use this.... -- sops: Enables sops-nix -- fish: Enables and configures fish shell -- kitty: Enables and configures kitty terminal -- oxi: My own programs, can be selectively disabled, or as a whole -- scripts: Various preconfigured scripts with the ability to add more +
+ +![Logo of DashNix](logo.svg) + +
+ +An opinionated flake to bootstrap NixOS systems with default configurations for various programs and services from both NixOS and HomeManager which can be enabled, disabled, configured or replaced at will. + +# Usage + +This flake is intended to be used as an input to your own NixOS configuration: + +```nix +dashNix = { + url = "github:Xetibo/DashNix"; + inputs = { + # ensure these are here to update the packages on your own + nixpkgs.follows = "nixpkgs"; + stable.follows = "stable"; + }; +}; +``` + +You can then configure your systems in your flake outputs with a provided library command: + +Please note that overriding inputs will invalidate the cache configuration, this means you will have to add this manually: + +```nix + builders-use-substitutes = true; + + extra-substituters = [ + "https://hyprland.cachix.org" + "https://anyrun.cachix.org" + "https://cache.garnix.io" + "https://oxipaste.cachix.org" + "https://oxinoti.cachix.org" + "https://oxishut.cachix.org" + "https://oxidash.cachix.org" + "https://oxicalc.cachix.org" + "https://hyprdock.cachix.org" + "https://reset.cachix.org" + "https://dashvim.cachix.org" + ]; + + extra-trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" + "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" + "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" + "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" + "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" + "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" + "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" + "dashvim.cachix.org-1:uLRdxp1WOWHnsZZtu3SwUWZRsvC7SXo0Gyk3tIefuL0=" + ]; +``` + +```nix +nixosConfigurations = inputs.dashNix.dashNixLib.buildSystems { root = ./.; }; +``` + +This command will build each system that is placed within the hosts/ directory. +In this directory create one directory for each system you want to configure with DashNix. +This will automatically pick up the hostname for the system and look for 3 different files that are explained below. +(Optionally, you can also change the parameter root (./.) to define a different starting directory than hosts/) + +In order for your configuration to work, you are required to at least provide a single config file with a further config file being optional for custom configuration. +The hardware.nix specifies additional NixOS configuration, while home.nix specifies additional home-manager configuration. (both optional) + +|- flake.nix\ +|- flake.lock\ +|- hosts/\ +|--- system1/\ +|------ configuration.nix (required)\ +|------ hardware.nix (optional)\ +|------ home.nix (optional)\ +|--- system2/\ +|------ configuration.nix (required)\ +|------ hardware.nix (optional)\ +|------ home.nix (optional)\ +|--- system3/\ +|------ configuration.nix (required)\ +|------ hardware.nix (optional)\ +|------ home.nix (optional) + +Here is a minimal required configuration.nix (the TODOs mention a required change): + +```nix +{config, ...}: { + # TODO denote important changes + + # variables for system + conf = { + # TODO your username + username = "YOURNAME"; + # TODO only needed when you use intel -> amd is default + # cpu = "intel"; + # TODO your xkb layout + locale = "something.UTF-8"; + # TODO your timezone + timezone = "CONTINENT/CITY"; + }; + + # modules + mods = { + # default disk config has root home boot and swap partition, overwrite if you want something different + sops.enable = false; + nextcloud.enable = false; + wm.monitors = [ + # Example + # { + # name = "DP-1"; + # resolutionX = 3440; + # resolutionY = 1440; + # refreshrate = 180; + # positionX = 2560; + # positionY = 0; + # scale = 1; + # transform = "0"; + # vrr = false; + # } + ]; + gpu.nvidia.enable = true; + kdeConnect.enable = true; + # login manager: + # default is greetd + # greetd = { }; + # sddm = { }; + # gdm = { }; + drives = { + # default assumes ROOT, BOOT, HOME and SWAP labaled drives exist + # for an example without HOME see below + # defaultDrives.enable = false; + # extraDrives = [ + # { + # name = "boot"; + # drive = { + # device = "/dev/disk/by-label/BOOT"; + # fsType = "vfat"; + # options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; + # }; + # } + # { + # name = ""; + # drive = { + # device = "/dev/disk/by-label/ROOT"; + # fsType = "ext4"; + # options = [ "noatime" "nodiratime" "discard" ]; + # }; + # } + # ]; + # You can also use disko to format your disks on installation. + # Please refer to the Documentation about the drives module for an example. + }; + }; +} +``` + +## First Login + +After logging in the first time, your password will be set to "firstlogin", please change this to whatever you like. + +## Configuring pkgs + +While DashNix offers a default pkgs config, you may want to permit an unsecure packages, +add additional modules/inputs, or add an overlay to them. +You can configure both stable and unstable pkgs the following way: + +Please note that modules and inputs are merged together to ensure functionality. + +```nix +currentSystem = "x86_64-linux"; +permittedPackages = [ + "some package" +]; +config = { + system = currentSystem; + config = { + allowUnfree = true; + permittedInsecurePackages = permittedPackages; + }; + inputs = { + # Some inputs + } + mods = { + home = [ + # Some home manager module + ]; + nixos = [ + # Some nixos module + ]; +} +}; +unstableBundle = { + pkgs = inputs.unstable; + inherit config mods; +}; +inputs.dashNix.dashNixLib.buildSystems { + root = ./.; + inherit unstableBundle; +} +``` + +With this you could also change your input to something different should you wish to do so. +Note that overriding inputs via the flake still works, +this way however ensures you can also configure the inputs. + +## Stable/Unstable + +Sometimes you want to differentiate between systems that are stable and unstable, e.g. for servers and desktops/laptops. +This can be done with the overridePkgs flag for the lib function: + +(overridePkgs simply inverts the default bundle that is used for the nix standard library as well as NixOS itself) + +```nix +nixosConfigurations = + inputs.dashNix.dashNixLib.buildSystems { + root = ./stable; + inherit stableBundle; + overridePkgs = true; + } + // inputs.dashNix.dashNixLib.buildSystems { + inherit unstableBundle; + root = ./unstable; + }; +``` + +You can now place your systems in the respective directories. +Keep in mind that the hosts directory will still need to exist in each variant. +E.g. stable/hosts/yourserver and unstable/hosts/yourdesktop + +# Installation via ISO + +You can find a custom ISO in the releases: [Link](https://github.com/Xetibo/DashNix/releases). +With this, you will receive the example config in /iso/example alongside the gnome desktop environment, +as well as a few tools like gnome-disks, Neovim, Vscodium, a browser etc. + +Alternatively, you can use whatever NixOS installer and just install your config from there, just make sure to set the drive configuration before. + +## Commands + +First, copy the read-only config from /iso/example-config to a location of your choice. + +```sh +cp /iso/example-config ~/config -r +``` + +Then configure as you please and choose a command below depending on your disk installation variant. + +Installation via manual configuration: + +```sh +sudo nixos-install --flake # --root --option experimental-features "nix-command flakes pipe-operators" +#example +#nixos-install --flake ~/config#globi --root /mnt --option experimental-features "nix-command flakes pipe-operators" +``` + +Installation via disko: + +```sh +sudo disko-install --flake # --disk --option experimental-features "nix-command flakes pipe-operators" +#example +#disko-install -- --flake ~/config#globi --disk main /dev/nvme0n1 --option experimental-features "nix-command flakes pipe-operators" +``` + +# Installation via flake + +If you already have nix installed, you can instead just copy the default config onto your system and install DashNix with it. +To create the example config for a base to start with, you can just run this flake with the mkFlake command: + +```sh +nix run github:Xetibo/DashNix#mkFlake +``` + +This command will put the default configuration into $HOME/gits/nixos + +# Modules + +This configuration features several modules that can be used as preconfigured "recipies". +These modules attempt to combine the home-manager and nixos packages/options to one single configuration file for each new system. +For package lists, please check the individual modules, as the lists can be long. + +- Hyprland: Installs and configures Hyprland with various additional packages +- Niri: Installs and configures Niri with various additional packages +- acpid : Enables the acpid daemon +- base packages : A list of system packages to be installed by default +- bluetooth : Configures/enables bluetooth and installs tools for bluetooth +- coding packages : A list of coding packages to be installed by default +- drives : A drive configuration module +- firefox: Enables and configures firefox (extensions and settings) +- fish: Enables and configures fish shell +- gaming : Configures gaming related features (launchers, gamemode) +- git : Git key and config module +- gnome_services : Gnome services for minimal enviroments -> Window managers etc +- gpu : GPU settings (AMD) +- greetd : Enables and configures the greetd/regreet login manager with Hyprland +- home packages : A list of home packages to be installed by default +- kde_connect : Enables KDE connect and opens its ports +- keepassxc : Configures keepassxc +- kitty: Enables and configures kitty terminal +- layout : Modules to configure keyboard layout system wide +- media packages : A list of media packages to be installed by default +- mime: Mime type configuration +- nextcloud : Handles synchronization via nextcloud cmd. (requires config.sops.secrets.nextcloud) +- oxi: My own programs, can be selectively disabled, or as a whole +- piper : Installs and enables piper alongside its daemon +- plymouth: enable or disable plymouth +- printing : Enables and configures printing services +- scripts: Various preconfigured scripts with the ability to add more +- sops: Enables sops-nix +- starship : Configures the starship prompt +- stylix : Configures system themes, can also be applied to dashvim if used. +- teams: For the poor souls that have to use this.... +- virtualbox : Enables and configures virtualbox +- xkb: Keyboard layout configuration +- xone : Installs the xone driver +- yazi: Installs yazi and sets custom keybinds + +# Credits + +- [Fufexan](https://github.com/fufexan) for the xdg-mime config: +- [Catppuccin](https://github.com/catppuccin) for base16 colors and zen-browser css +- [Danth](https://github.com/danth) for providing a base for the nix docs +- [chermnyx](https://github.com/chermnyx) for providing a base for zen configuration +- [voronind-com](https://github.com/voronind-com) for providing the darkreader configuration +- [Nix-Artwork](https://github.com/NixOS/nixos-artwork/tree/master/logo) for the Nix/NixOS logo (Tim Cuthbertson (@timbertson)) +- [xddxdd](https://github.com/xddxdd) for the CachyOS-Kernel flake diff --git a/docs/src/logo.svg b/docs/src/logo.svg new file mode 100644 index 0000000..08baa43 --- /dev/null +++ b/docs/src/logo.svg @@ -0,0 +1,238 @@ + + + +DashNixDashNix diff --git a/example/flake.nix b/example/flake.nix index 4ae9e17..01ec944 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -2,30 +2,20 @@ description = "some dots"; inputs = { - dashvim.url = "github:DashieTM/DashVim"; - hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - ironbar.url = "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; - anyrun.url = "github:Kirottu/anyrun"; nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; stable.url = "github:NixOs/nixpkgs/nixos-24.05"; dashNix = { - url = "github:DashieTM/DashNix"; + url = "github:Xetibo/DashNix"; inputs = { nixpkgs.follows = "nixpkgs"; stable.follows = "stable"; - dashvim.follows = "dashvim"; - hyprland.follows = "hyprland"; - ironbar.follows = "ironbar"; - anyrun.follows = "anyrun"; }; }; }; - outputs = - { ... }@inputs: - { - nixosConfigurations = (inputs.dashNix.dashNixLib.build_systems ./.); - }; + outputs = inputs: { + nixosConfigurations = inputs.dashNix.dashNixLib.buildSystems {root = ./.;}; + }; nixConfig = { builders-use-substitutes = true; @@ -34,12 +24,28 @@ "https://hyprland.cachix.org" "https://anyrun.cachix.org" "https://cache.garnix.io" + "https://oxipaste.cachix.org" + "https://oxinoti.cachix.org" + "https://oxishut.cachix.org" + "https://oxidash.cachix.org" + "https://oxicalc.cachix.org" + "https://hyprdock.cachix.org" + "https://reset.cachix.org" + "https://dashvim.cachix.org" ]; extra-trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "oxipaste.cachix.org-1:n/oA3N3Z+LJP7eIWOwuoLd9QnPyZXqFjLgkahjsdDGc=" + "oxinoti.cachix.org-1:dvSoJl2Pjo5HMaNngdBbSaixK9BSf2N8gzjP2MdGvfc=" + "oxishut.cachix.org-1:axyAGF3XMh1IyMAW4UMbQCdMNovDH0KH6hqLLRJH8jU=" + "oxidash.cachix.org-1:5K2FNHp7AS8VF7LmQkJAUG/dm6UHCz4ngshBVbjFX30=" + "oxicalc.cachix.org-1:qF3krFc20tgSmtR/kt6Ku/T5QiG824z79qU5eRCSBTQ=" + "hyprdock.cachix.org-1:HaROK3fBvFWIMHZau3Vq1TLwUoJE8yRbGLk0lEGzv3Y=" + "reset.cachix.org-1:LfpnUUdG7QM/eOkN7NtA+3+4Ar/UBeYB+3WH+GjP9Xo=" + "dashvim.cachix.org-1:uLRdxp1WOWHnsZZtu3SwUWZRsvC7SXo0Gyk3tIefuL0=" ]; }; } diff --git a/example/hosts/example/configuration.nix b/example/hosts/example/configuration.nix index 392656e..dbe8cd0 100644 --- a/example/hosts/example/configuration.nix +++ b/example/hosts/example/configuration.nix @@ -1,67 +1,68 @@ -{ config, ... }: -{ +{config, ...}: { + # TODO denote important changes + # variables for system - # TODO important changes conf = { - # change this to your monitor and your pc name - # should be something like DP-1 - monitor = "YOURMONITOR"; - # your username - username = "YOURNAME"; + # TODO your username + username = "exampleName"; # TODO only needed when you use intel -> amd is default # cpu = "intel"; - locale = "something.UTF-8"; - timezone = "CONTINENT/CITY"; + # TODO your xkb layout + locale = "en_US.UTF-8"; + # TODO your timezone + timezone = "Europe/Zurich"; }; + # modules mods = { # default disk config has root home boot and swap partition, overwrite if you want something different - drives = { - defaultDrives.enable = false; - extraDrives = [ - { - name = "boot"; - drive = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ - "rw" - "fmask=0022" - "dmask=0022" - "noatime" - ]; - }; - } - { - name = ""; - drive = { - device = "/dev/disk/by-label/ROOT"; - fsType = "ext4"; - options = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - } - ]; - }; sops.enable = false; nextcloud.enable = false; - hyprland.monitor = [ - # default - # TODO change this to your resolution - "${config.conf.monitor},1920x1080@144,0x0,1" - # all others - ",highrr,auto,1" + wm.monitors = [ + # Example + # { + # name = "DP-1"; + # resolutionX = 3440; + # resolutionY = 1440; + # refreshrate = 180; + # positionX = 2560; + # positionY = 0; + # scale = 1; + # transform = "0"; + # vrr = false; + # } ]; - # or amd, whatever you have gpu.nvidia.enable = true; - kde_connect.enable = true; - # TODO change this to your main resolution - # -> this will be your login manager - greetd = { - resolution = "3440x1440@180"; + kdeConnect.enable = true; + # login manager: + # default is greetd + # greetd = { }; + # sddm = { }; + # gdm = { }; + drives = { + # default assumes ROOT, BOOT, HOME and SWAP labaled drives exist + # for an example without HOME see below + # defaultDrives.enable = false; + # extraDrives = [ + # { + # name = "boot"; + # drive = { + # device = "/dev/disk/by-label/BOOT"; + # fsType = "vfat"; + # options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ]; + # }; + # } + # { + # name = ""; + # drive = { + # device = "/dev/disk/by-label/ROOT"; + # fsType = "ext4"; + # options = [ "noatime" "nodiratime" "discard" ]; + # }; + # } + # ]; + # You can also use disko to format your disks on installation. + # Please refer to the Documentation about the drives module for an example. }; }; } diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 3633057..0000000 --- a/flake.lock +++ /dev/null @@ -1,2132 +0,0 @@ -{ - "nodes": { - "anyrun": { - "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs", - "systems": "systems" - }, - "locked": { - "lastModified": 1721135360, - "narHash": "sha256-ZhSA0e45UxiOAjEVqkym/aULh0Dt+KHJLNda7bjx9UI=", - "owner": "Kirottu", - "repo": "anyrun", - "rev": "c6101a31a80b51e32e96f6a77616b609770172e0", - "type": "github" - }, - "original": { - "owner": "Kirottu", - "repo": "anyrun", - "type": "github" - } - }, - "aquamarine": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1724273991, - "narHash": "sha256-+aUSOXKGpS5CRm1oTitgNAr05ThQNbKIXalZHl3nC6Y=", - "owner": "hyprwm", - "repo": "aquamarine", - "rev": "9a3161ad4c78dc420d1cbb3aae638222608c7de4", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "aquamarine", - "type": "github" - } - }, - "base16": { - "inputs": { - "fromYaml": "fromYaml" - }, - "locked": { - "lastModified": 1721224776, - "narHash": "sha256-iakVQHg2DSmdOc5dNBwrDt9JLRxX5MT+IIbxfZEpGdo=", - "owner": "SenchoPens", - "repo": "base16.nix", - "rev": "c89c8123310257f3ddc04cc59aa4b5573c6d515f", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "base16.nix", - "type": "github" - } - }, - "base16-fish": { - "flake": false, - "locked": { - "lastModified": 1622559957, - "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", - "owner": "tomyun", - "repo": "base16-fish", - "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", - "type": "github" - }, - "original": { - "owner": "tomyun", - "repo": "base16-fish", - "type": "github" - } - }, - "base16-foot": { - "flake": false, - "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", - "owner": "tinted-theming", - "repo": "base16-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-foot", - "type": "github" - } - }, - "base16-helix": { - "flake": false, - "locked": { - "lastModified": 1720809814, - "narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=", - "owner": "tinted-theming", - "repo": "base16-helix", - "rev": "34f41987bec14c0f3f6b2155c19787b1f6489625", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-helix", - "type": "github" - } - }, - "base16-kitty": { - "flake": false, - "locked": { - "lastModified": 1665001328, - "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", - "owner": "kdrag0n", - "repo": "base16-kitty", - "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", - "type": "github" - }, - "original": { - "owner": "kdrag0n", - "repo": "base16-kitty", - "type": "github" - } - }, - "base16-tmux": { - "flake": false, - "locked": { - "lastModified": 1696725902, - "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", - "owner": "tinted-theming", - "repo": "base16-tmux", - "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-tmux", - "type": "github" - } - }, - "base16-vim": { - "flake": false, - "locked": { - "lastModified": 1716150083, - "narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=", - "owner": "tinted-theming", - "repo": "base16-vim", - "rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-vim", - "type": "github" - } - }, - "base16_2": { - "inputs": { - "fromYaml": "fromYaml_2" - }, - "locked": { - "lastModified": 1708890466, - "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", - "owner": "SenchoPens", - "repo": "base16.nix", - "rev": "665b3c6748534eb766c777298721cece9453fdae", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "base16.nix", - "type": "github" - } - }, - "crane": { - "inputs": { - "nixpkgs": [ - "ironbar", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1713979152, - "narHash": "sha256-apdecPuh8SOQnkEET/kW/UcfjCRb8JbV5BKjoH+DcP4=", - "owner": "ipetkov", - "repo": "crane", - "rev": "a5eca68a2cf11adb32787fc141cddd29ac8eb79c", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "dashvim": { - "inputs": { - "base16": [ - "base16" - ], - "flake-parts": "flake-parts_2", - "nixpkgs": [ - "nixpkgs" - ], - "nixvim": "nixvim" - }, - "locked": { - "lastModified": 1724509876, - "narHash": "sha256-SvtppTW041MCVGmhKu8lsEbzVXwerLEIDcizdY0ZqEI=", - "owner": "DashieTM", - "repo": "DashVim", - "rev": "309544615a01e9aa242ca71bff58f503273345ea", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "DashVim", - "type": "github" - } - }, - "devshell": { - "inputs": { - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722113426, - "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", - "owner": "numtide", - "repo": "devshell", - "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "flake-compat": { - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" - } - }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "anyrun", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_10": { - "inputs": { - "nixpkgs-lib": [ - "reset", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_11": { - "inputs": { - "nixpkgs-lib": [ - "reset-plugins", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_3": { - "inputs": { - "nixpkgs-lib": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_4": { - "inputs": { - "nixpkgs-lib": [ - "hyprdock", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_5": { - "inputs": { - "nixpkgs-lib": [ - "oxicalc", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_6": { - "inputs": { - "nixpkgs-lib": [ - "oxidash", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_7": { - "inputs": { - "nixpkgs-lib": [ - "oxinoti", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_8": { - "inputs": { - "nixpkgs-lib": [ - "oxipaste", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_9": { - "inputs": { - "nixpkgs-lib": [ - "oxishut", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_4" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "inputs": { - "systems": "systems_5" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_6" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems_7" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_6": { - "inputs": { - "systems": "systems_8" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_7": { - "inputs": { - "systems": "systems_9" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_8": { - "inputs": { - "systems": "systems_10" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_9": { - "inputs": { - "systems": [ - "stylix", - "systems" - ] - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "fromYaml": { - "flake": false, - "locked": { - "lastModified": 1721222302, - "narHash": "sha256-5vL4w9+tS9yd8WpIiDUtxN1IuxCVK2nebZMs/hCXXis=", - "owner": "SenchoPens", - "repo": "fromYaml", - "rev": "93bad85d1633b8b27287b438c0bd394094c24d06", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "fromYaml", - "type": "github" - } - }, - "fromYaml_2": { - "flake": false, - "locked": { - "lastModified": 1689549921, - "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", - "owner": "SenchoPens", - "repo": "fromYaml", - "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "fromYaml", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": [ - "dashvim", - "nixvim", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ], - "nixpkgs-stable": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1721042469, - "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "dashvim", - "nixvim", - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "gnome-shell": { - "flake": false, - "locked": { - "lastModified": 1713702291, - "narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=", - "owner": "GNOME", - "repo": "gnome-shell", - "rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934", - "type": "github" - }, - "original": { - "owner": "GNOME", - "ref": "46.1", - "repo": "gnome-shell", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722407237, - "narHash": "sha256-wcpVHUc2nBSSgOM7UJSpcRbyus4duREF31xlzHV5T+A=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "58cef3796271aaeabaed98884d4abaab5d9d162d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_2": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724435763, - "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_3": { - "inputs": { - "nixpkgs": [ - "stylix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715930644, - "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "hyprcursor": { - "inputs": { - "hyprlang": [ - "hyprland", - "hyprlang" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1722623071, - "narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=", - "owner": "hyprwm", - "repo": "hyprcursor", - "rev": "912d56025f03d41b1ad29510c423757b4379eb1c", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprcursor", - "type": "github" - } - }, - "hyprdock": { - "inputs": { - "flake-parts": "flake-parts_4", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1716453478, - "narHash": "sha256-EoKGnKvYKoe9geFoK0wyEAMTPGOfRtjXibt4GUCfvBA=", - "owner": "DashieTM", - "repo": "hyprdock", - "rev": "8d07dbdf446e6b21528cc994547cc8f173a70330", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "hyprdock", - "type": "github" - } - }, - "hyprland": { - "inputs": { - "aquamarine": "aquamarine", - "hyprcursor": "hyprcursor", - "hyprlang": "hyprlang", - "hyprutils": "hyprutils", - "hyprwayland-scanner": "hyprwayland-scanner", - "nixpkgs": "nixpkgs_4", - "systems": "systems_3", - "xdph": "xdph" - }, - "locked": { - "lastModified": 1724442134, - "narHash": "sha256-RpA3GmcBvd6DLssIWfYKdDfiumLv8w4KIhDaI+//6ls=", - "ref": "refs/heads/main", - "rev": "688fe5c14781c63a1db23d4d02bf239283068ff6", - "revCount": 5131, - "submodules": true, - "type": "git", - "url": "https://github.com/hyprwm/Hyprland" - }, - "original": { - "submodules": true, - "type": "git", - "url": "https://github.com/hyprwm/Hyprland" - } - }, - "hyprland-protocols": { - "inputs": { - "nixpkgs": [ - "hyprland", - "xdph", - "nixpkgs" - ], - "systems": [ - "hyprland", - "xdph", - "systems" - ] - }, - "locked": { - "lastModified": 1721326555, - "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=", - "owner": "hyprwm", - "repo": "hyprland-protocols", - "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-protocols", - "type": "github" - } - }, - "hyprlang": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1724174162, - "narHash": "sha256-fOOBLwil6M9QWMCiSULwjMQzrXhHXUnEqmjHX5ZHeVI=", - "owner": "hyprwm", - "repo": "hyprlang", - "rev": "16e5c9465f04477d8a3dd48a0a26bf437986336c", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprlang", - "type": "github" - } - }, - "hyprutils": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1722869141, - "narHash": "sha256-0KU4qhyMp441qfwbirNg3+wbm489KnEjXOz2I/RbeFs=", - "owner": "hyprwm", - "repo": "hyprutils", - "rev": "0252fd13e78e60fb0da512a212e56007515a49f7", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprutils", - "type": "github" - } - }, - "hyprwayland-scanner": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1721324119, - "narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=", - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "type": "github" - } - }, - "ironbar": { - "inputs": { - "crane": "crane", - "naersk": "naersk", - "nixpkgs": "nixpkgs_6", - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1714908451, - "narHash": "sha256-TPbvKQdoGfZMzp+fl72vy6MtRV1yGcOG/es67VOA0xw=", - "owner": "JakeStanger", - "repo": "ironbar", - "rev": "3a1c60442382f970cdb7669814b6ef3594d9f048", - "type": "github" - }, - "original": { - "owner": "JakeStanger", - "ref": "3a1c60442382f970cdb7669814b6ef3594d9f048", - "repo": "ironbar", - "type": "github" - } - }, - "naersk": { - "inputs": { - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1713520724, - "narHash": "sha256-CO8MmVDmqZX2FovL75pu5BvwhW+Vugc7Q6ze7Hj8heI=", - "owner": "nix-community", - "repo": "naersk", - "rev": "c5037590290c6c7dae2e42e7da1e247e54ed2d49", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722082646, - "narHash": "sha256-od8dBWVP/ngg0cuoyEl/w9D+TCNDj6Kh4tr151Aax7w=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "0413754b3cdb879ba14f6e96915e5fdf06c6aab6", - "type": "github" - }, - "original": { - "owner": "lnl7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nix-flatpak": { - "locked": { - "lastModified": 1721549352, - "narHash": "sha256-nlXJa8RSOX0kykrIYW33ukoHYq+FOSNztHLLgqKwOp8=", - "owner": "gmodena", - "repo": "nix-flatpak", - "rev": "dbce39ea8664820ba9037caaf1e2fad365ed6b4b", - "type": "github" - }, - "original": { - "owner": "gmodena", - "repo": "nix-flatpak", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1717196966, - "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "57610d2f8f0937f39dbd72251e9614b1561942d8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1722555339, - "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1721524707, - "narHash": "sha256-5NctRsoE54N86nWd0psae70YSLfrOek3Kv1e8KoXe/0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "556533a23879fc7e5f98dd2e0b31a6911a213171", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_10": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_11": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_12": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_13": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_14": { - "locked": { - "lastModified": 1716190602, - "narHash": "sha256-xYRimrR0duWvokWQEvB87bSsICeCvvX9DxpUOzCfsDE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5a5ac83292c7842072318f57d68a48474f8bd34d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_15": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_16": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_17": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_18": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_19": { - "locked": { - "lastModified": 1716948383, - "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1722185531, - "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_20": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_21": { - "locked": { - "lastModified": 1721466660, - "narHash": "sha256-pFSxgSZqZ3h+5Du0KvEL1ccDZBwu4zvOil1zzrPNb3c=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6e14bbce7bea6c4efd7adfa88a40dac750d80100", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_22": { - "locked": { - "lastModified": 1714912032, - "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1716330097, - "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1724224976, - "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1714314149, - "narHash": "sha256-yNAevSKF4krRWacmLUsLK7D7PlfuY3zF0lYnGYNi9vQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "cf8cc1201be8bc71b7cbbbdaf349b22f4f99c7ae", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_6": { - "locked": { - "lastModified": 1714253743, - "narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { - "locked": { - "lastModified": 1724224976, - "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", - "owner": "NixOs", - "repo": "nixpkgs", - "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", - "type": "github" - }, - "original": { - "owner": "NixOs", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_8": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_9": { - "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixvim": { - "inputs": { - "devshell": "devshell", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_3", - "git-hooks": "git-hooks", - "home-manager": "home-manager", - "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs_2", - "nuschtosSearch": "nuschtosSearch", - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1722492816, - "narHash": "sha256-aZe7oSm/+GM1whS6bxZy+DJgbcy8rDIkygBA0owCvmU=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "820f8d58eafd7121989fea3ae9e71f29699d856b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixvim", - "type": "github" - } - }, - "nur": { - "locked": { - "lastModified": 1724486206, - "narHash": "sha256-AktI2GKW4DnVwj3WS+mTmYjtL2qug8H46IN0Rtf4O+Q=", - "owner": "nix-community", - "repo": "nur", - "rev": "8feee883ff50c836e711bb7e08f91b34f31feb84", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nur", - "type": "github" - } - }, - "nuschtosSearch": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722144272, - "narHash": "sha256-olZbfaEdd+zNPuuyYcYGaRzymA9rOmth8yXOlVm+LUs=", - "owner": "NuschtOS", - "repo": "search", - "rev": "16565307c267ec219c2b5d3494ba66df08e7d403", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, - "oxicalc": { - "inputs": { - "flake-parts": "flake-parts_5", - "nixpkgs": "nixpkgs_8" - }, - "locked": { - "lastModified": 1716225554, - "narHash": "sha256-IenHIQgKdKJTt02VJLQ+q8EunIkMwQ57XFWyKO+rb7s=", - "owner": "DashieTM", - "repo": "OxiCalc", - "rev": "a3fa5d76941278fd0f586817dcd04be134159bd8", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "OxiCalc", - "type": "github" - } - }, - "oxidash": { - "inputs": { - "flake-parts": "flake-parts_6", - "nixpkgs": "nixpkgs_9", - "rust-overlay": "rust-overlay_2" - }, - "locked": { - "lastModified": 1716235599, - "narHash": "sha256-6LDrLEfPzwbd5nEcis8us4BA18YhoWkzMVwafCJ5N/A=", - "owner": "DashieTM", - "repo": "OxiDash", - "rev": "fe6984abc73f75a64b0a03231068c20f53ec4f76", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "OxiDash", - "type": "github" - } - }, - "oxinoti": { - "inputs": { - "flake-parts": "flake-parts_7", - "nixpkgs": "nixpkgs_11", - "rust-overlay": "rust-overlay_3" - }, - "locked": { - "lastModified": 1716235566, - "narHash": "sha256-1U4/h0YyuoOERjQE68yQZVsDdIGl43OprDplSGBMhYY=", - "owner": "DashieTM", - "repo": "OxiNoti", - "rev": "c52c330d59a3b066e94618adbe9a7be5b9cfde24", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "OxiNoti", - "type": "github" - } - }, - "oxipaste": { - "inputs": { - "flake-parts": "flake-parts_8", - "nixpkgs": "nixpkgs_13", - "rust-overlay": "rust-overlay_4" - }, - "locked": { - "lastModified": 1716235097, - "narHash": "sha256-kTsSNciMnp3y/QOPseB/QlhRqVxrm7teRCMl05OIiBs=", - "owner": "DashieTM", - "repo": "OxiPaste", - "rev": "3f494c1a3dd093e3c5761520554977a9dec33a3a", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "OxiPaste", - "type": "github" - } - }, - "oxishut": { - "inputs": { - "flake-parts": "flake-parts_9", - "nixpkgs": "nixpkgs_15", - "rust-overlay": "rust-overlay_5" - }, - "locked": { - "lastModified": 1716235696, - "narHash": "sha256-qqN2ev97ff1Yftr+8YS7Pm2/kk8SpQU8uxplbQYJGho=", - "owner": "DashieTM", - "repo": "OxiShut", - "rev": "d38d5c892b7ae2420715cbb6b4944abb76b49f9d", - "type": "github" - }, - "original": { - "owner": "DashieTM", - "repo": "OxiShut", - "type": "github" - } - }, - "reset": { - "inputs": { - "flake-parts": "flake-parts_10", - "nixpkgs": "nixpkgs_17", - "rust-overlay": "rust-overlay_6" - }, - "locked": { - "lastModified": 1718284469, - "narHash": "sha256-6cZjFyjhGTOj9r8eprCWZy1v2o1Tqcl6H6g/LTgHhp4=", - "owner": "Xetibo", - "repo": "ReSet", - "rev": "6c1291bd19383ea45d0610dcdc17e8491b8e20ea", - "type": "github" - }, - "original": { - "owner": "Xetibo", - "repo": "ReSet", - "type": "github" - } - }, - "reset-plugins": { - "inputs": { - "flake-parts": "flake-parts_11", - "nixpkgs": "nixpkgs_19", - "rust-overlay": "rust-overlay_7" - }, - "locked": { - "lastModified": 1718300175, - "narHash": "sha256-kPeJJ/au+jV4jhyAhkLI3uwqK7pEDjdVJvwDmtQq8/k=", - "owner": "Xetibo", - "repo": "ReSet-Plugins", - "rev": "8d3af2fab9425f8b89fb7b82b4e23eba12a42f85", - "type": "github" - }, - "original": { - "owner": "Xetibo", - "repo": "ReSet-Plugins", - "type": "github" - } - }, - "root": { - "inputs": { - "anyrun": "anyrun", - "base16": "base16", - "dashvim": "dashvim", - "home-manager": "home-manager_2", - "hyprdock": "hyprdock", - "hyprland": "hyprland", - "ironbar": "ironbar", - "nix-flatpak": "nix-flatpak", - "nixpkgs": "nixpkgs_7", - "nur": "nur", - "oxicalc": "oxicalc", - "oxidash": "oxidash", - "oxinoti": "oxinoti", - "oxipaste": "oxipaste", - "oxishut": "oxishut", - "reset": "reset", - "reset-plugins": "reset-plugins", - "sops-nix": "sops-nix", - "stable": "stable", - "stylix": "stylix" - } - }, - "rust-overlay": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "ironbar", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1714443211, - "narHash": "sha256-lKTA3XqRo4aVgkyTSCtpcALpGXdmkilHTtN00eRg0QU=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "ce35c36f58f82cee6ec959e0d44c587d64281b6f", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_10" - }, - "locked": { - "lastModified": 1716171463, - "narHash": "sha256-lc7wOh5BjYUoxdhcPkeUY8BmuL2qtRaHlW1403RW48E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "04d61d14803854fd8453ec43c5c53a471e5407a8", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_3": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_12" - }, - "locked": { - "lastModified": 1716171463, - "narHash": "sha256-lc7wOh5BjYUoxdhcPkeUY8BmuL2qtRaHlW1403RW48E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "04d61d14803854fd8453ec43c5c53a471e5407a8", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_4": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_14" - }, - "locked": { - "lastModified": 1716171463, - "narHash": "sha256-lc7wOh5BjYUoxdhcPkeUY8BmuL2qtRaHlW1403RW48E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "04d61d14803854fd8453ec43c5c53a471e5407a8", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_5": { - "inputs": { - "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_16" - }, - "locked": { - "lastModified": 1716171463, - "narHash": "sha256-lc7wOh5BjYUoxdhcPkeUY8BmuL2qtRaHlW1403RW48E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "04d61d14803854fd8453ec43c5c53a471e5407a8", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_6": { - "inputs": { - "flake-utils": "flake-utils_7", - "nixpkgs": "nixpkgs_18" - }, - "locked": { - "lastModified": 1716171463, - "narHash": "sha256-lc7wOh5BjYUoxdhcPkeUY8BmuL2qtRaHlW1403RW48E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "04d61d14803854fd8453ec43c5c53a471e5407a8", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_7": { - "inputs": { - "flake-utils": "flake-utils_8", - "nixpkgs": "nixpkgs_20" - }, - "locked": { - "lastModified": 1717035469, - "narHash": "sha256-MzH+yjKULH3HCRj9QCTwBvqq4LZkR0ZqRE/QfGOGC2E=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "095702e63a40e86f339d11864da9dc965b70a01e", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "sops-nix": { - "inputs": { - "nixpkgs": "nixpkgs_21", - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1723501126, - "narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=", - "owner": "Mic92", - "repo": "sops-nix", - "rev": "be0eec2d27563590194a9206f551a6f73d52fa34", - "type": "github" - }, - "original": { - "owner": "Mic92", - "repo": "sops-nix", - "type": "github" - } - }, - "stable": { - "locked": { - "lastModified": 1724316499, - "narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", - "owner": "NixOs", - "repo": "nixpkgs", - "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", - "type": "github" - }, - "original": { - "owner": "NixOs", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "stylix": { - "inputs": { - "base16": "base16_2", - "base16-fish": "base16-fish", - "base16-foot": "base16-foot", - "base16-helix": "base16-helix", - "base16-kitty": "base16-kitty", - "base16-tmux": "base16-tmux", - "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_9", - "gnome-shell": "gnome-shell", - "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_22", - "systems": "systems_11" - }, - "locked": { - "lastModified": 1724444244, - "narHash": "sha256-fH1lyJvJjUhZ8xMlmiI18EZNzodDSe74rFuwlZDL0aQ=", - "owner": "danth", - "repo": "stylix", - "rev": "d042af478ce87e188139480922a3085218194106", - "type": "github" - }, - "original": { - "owner": "danth", - "repo": "stylix", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_10": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_11": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_5": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_6": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_7": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_8": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_9": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "dashvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722330636, - "narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "768acdb06968e53aa1ee8de207fd955335c754b7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "xdph": { - "inputs": { - "hyprland-protocols": "hyprland-protocols", - "hyprlang": [ - "hyprland", - "hyprlang" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1724073926, - "narHash": "sha256-nWlUL43jOFHf+KW6Hqrx+W/r1XdXuDyb0wC/SrHsOu4=", - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "rev": "a08ecbbf33598924e93542f737fc6169a26b481e", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix index 52680f9..be1d5c2 100644 --- a/flake.nix +++ b/flake.nix @@ -2,100 +2,112 @@ description = "DashNix"; inputs = { - nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; - stable.url = "github:NixOs/nixpkgs/nixos-24.05"; - - nix-flatpak = { - url = "github:gmodena/nix-flatpak"; + unstable.url = "github:NixOs/nixpkgs/nixos-unstable"; + stable.url = "github:NixOs/nixpkgs/nixos-25.05"; + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + nur.url = "github:nix-community/NUR"; + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.2"; + inputs.nixpkgs.follows = "unstable"; }; + statix.url = "github:oppiliappan/statix?ref=master"; + # Darkreader requires es20, hence a stable pin + pkgsDarkreader.url = "github:NixOs/nixpkgs/nixos-24.11"; home-manager = { url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "unstable"; }; + cachy.url = "github:xddxdd/nix-cachyos-kernel?rev=bb7b8aa687464f24dcd452354d9621331d6b0737"; sops-nix.url = "github:Mic92/sops-nix"; - # Hyprspace = { - # url = "github:KZDKM/Hyprspace"; - # inputs.hyprland.follows = "nixpkgs"; - # }; - - nur.url = "github:nix-community/nur"; - hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + hyprland.url = "github:hyprwm/Hyprland"; ironbar = { - url = "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048"; + url = "github:JakeStanger/ironbar"; + inputs.nixpkgs.follows = "unstable"; }; + zen-browser.url = "github:youwen5/zen-browser-flake"; + stylix.url = "github:danth/stylix"; base16.url = "github:SenchoPens/base16.nix"; + disko.url = "github:nix-community/disko/latest"; anyrun.url = "github:Kirottu/anyrun"; - oxicalc.url = "github:DashieTM/OxiCalc"; - oxishut.url = "github:DashieTM/OxiShut"; - oxinoti.url = "github:DashieTM/OxiNoti"; - oxidash.url = "github:DashieTM/OxiDash"; - oxipaste.url = "github:DashieTM/OxiPaste"; - hyprdock.url = "github:DashieTM/hyprdock"; + oxicalc.url = "github:Xetibo/OxiCalc"; + oxishut.url = "github:Xetibo/OxiShut"; + oxinoti.url = "github:Xetibo/OxiNoti"; + oxidash.url = "github:Xetibo/OxiDash"; + oxipaste.url = "github:Xetibo/OxiPaste"; + oxirun.url = "github:Xetibo/OxiRun"; + dashvim.url = "github:Xetibo/DashVim"; + + hyprdock.url = "github:Xetibo/hyprdock"; reset.url = "github:Xetibo/ReSet"; reset-plugins.url = "github:Xetibo/ReSet-Plugins"; - dashvim = { - url = "github:DashieTM/DashVim"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.base16.follows = "base16"; - }; + superfreq.url = "github:NotAShelf/superfreq"; + + compose.url = "github:garnix-io/nixos-compose"; }; - outputs = - { self, ... }@inputs: - let - stable = import inputs.stable { - system = "x86_64-linux"; - config = { - allowUnfree = true; - }; + outputs = {self, ...} @ inputs: let + currentSystem = "x86_64-linux"; + permittedPackages = [ + "olm-3.2.16" + ]; + importPkgsFn = import ./lib/importPkgs.nix; + defaultConfigureFn = pkgs: + importPkgsFn { + inherit inputs currentSystem permittedPackages pkgs; }; - pkgs = import inputs.nixpkgs { - system = "x86_64-linux"; - overlays = [ inputs.nur.overlay ]; - config = { - permittedInsecurePackages = [ "olm-3.2.16" ]; - allowUnfree = true; - }; + stable = defaultConfigureFn inputs.stable; + unstable = defaultConfigureFn inputs.unstable; + pkgsDarkreader = defaultConfigureFn inputs.pkgsDarkreader; + in rec { + dashNixLib = import ./lib { + inherit + self + inputs + unstable + permittedPackages + ; + dashNixAdditionalProps = { + inherit pkgsDarkreader; }; - in - rec { - dashNixLib = import ./lib { - inherit self inputs pkgs; - lib = inputs.nixpkgs.lib; - }; - docs = import ./docs { - inherit inputs pkgs; - lib = inputs.nixpkgs.lib; - build_systems = dashNixLib.build_systems; - }; - dashNixInputs = inputs; - stablePkgs = stable; - unstablePkgs = pkgs; - modules = ./modules; - iso = dashNixLib.buildIso.config.system.build.isoImage; + system = currentSystem; }; + docs = import ./docs { + inherit inputs; + pkgs = unstable; + system = currentSystem; + inherit (inputs.unstable) lib; + inherit (dashNixLib) buildSystems; + }; + lint = inputs.statix.packages.${currentSystem}.default; + format = unstable.alejandra; + dashNixInputs = inputs; + stablePkgs = stable; + unstablePkgs = unstable; + modules = ./modules; + iso = dashNixLib.buildIso.config.system.build.isoImage; + nixosConfigurations = dashNixLib.buildSystems {root = ./example/.;}; - nixConfig = { - builders-use-substitutes = true; + mkFlake = stablePkgs.writeShellApplication { + name = "Create example config"; + text = + /* + bash + */ + '' + mkdir -p ~/gits/nixos + mkdir -p ~/gits/backup_nixos - extra-substituters = [ - "https://hyprland.cachix.org" - "https://anyrun.cachix.org" - "https://cache.garnix.io" - ]; - - extra-trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" - ]; + mv ~/gits/nixos/* ~/gits/backup_nixos/ + cp -r ${./example}/* ~/gits/nixos/ + ''; + }; }; } diff --git a/home/common.nix b/home/common.nix index f976a76..fe2fa53 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,46 +1,41 @@ { + mkDashDefault, config, lib, - options, + pkgs, ... -}: -let +}: let username = config.conf.username; -in -{ +in { manual = { - html.enable = false; - json.enable = false; - manpages.enable = false; + html.enable = mkDashDefault false; + json.enable = mkDashDefault false; + manpages.enable = mkDashDefault false; }; - fonts.fontconfig.enable = true; - nixpkgs.config.allowUnfree = true; + fonts.fontconfig.enable = mkDashDefault true; home = { - username = username; - homeDirectory = "/home/${username}"; - sessionPath = [ "$HOME/.cargo/bin" ]; + username = mkDashDefault username; + homeDirectory = mkDashDefault "/home/${username}"; + sessionPath = ["$HOME/.cargo/bin"]; + enableNixpkgsReleaseCheck = mkDashDefault false; sessionVariables = { - GOROOT = "$HOME/.go"; + GOROOT = mkDashDefault "$HOME/.go"; + QT_QPA_PLATFORMTHEME = mkDashDefault "qt5ct"; }; - keyboard = null; - - file.".local/share/flatpak/overrides/global".text = '' - [Context] - filesystems=xdg-config/gtk-3.0;xdg-config/gtk-4.0 - ''; + keyboard = mkDashDefault null; }; programs.nix-index = { - enable = true; - enableFishIntegration = true; + enable = mkDashDefault true; + enableFishIntegration = mkDashDefault true; }; nix = { - extraOptions = lib.mkIf (options ? config.sops.secrets.access.path) '' + extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) '' !include ${config.sops.secrets.access.path} ''; }; diff --git a/home/default.nix b/home/default.nix index 67c4290..afc0ab3 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,42 +1,66 @@ { - inputs, - pkgs, + mkDashDefault, + dashNixAdditionalProps, config, - lib, - mod, - additionalHomeConfig, homeMods, - additionalHomeMods, + inputs, + lib, + additionalHomeConfig, + mod, + pkgs, root, + alternativePkgs, + system, + stable, + unstable, ... -}: -{ +}: { xdg = { - portal.config.common.default = "*"; + portal.config.common = { + default = mkDashDefault "hyprland;gtk"; + "org.freedesktop.impl.portal.FileChooser" = lib.mkIf (config.mods.media.filePickerPortal != "Default") "shana"; + }; portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + enable = mkDashDefault true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk # prob needed either way + (lib.mkIf (config.mods.media.filePickerPortal != "Default") xdg-desktop-portal-shana) + (lib.mkIf (config.mods.media.filePickerPortal == "Kde") kdePackages.xdg-desktop-portal-kde) + # Gnome uses their file manager, kinda cool tbh + (lib.mkIf (config.mods.media.filePickerPortal == "Gnome" && !config.mods.nautilus.enable) nautilus) + (lib.mkIf (config.mods.media.filePickerPortal == "Lxqt") xdg-desktop-portal-lxqt) + (lib.mkIf (config.mods.media.filePickerPortal == "Term") xdg-desktop-portal-termfilechooser) + ]; }; }; home-manager = { - useGlobalPkgs = true; - useUserPackages = true; + useGlobalPkgs = mkDashDefault true; + useUserPackages = mkDashDefault true; extraSpecialArgs = { - inherit inputs root; + inherit + inputs + root + alternativePkgs + system + stable + unstable + dashNixAdditionalProps + ; + mkDashDefault = import ../lib/override.nix {inherit lib;}; }; users.${config.conf.username} = { + disabledModules = ["programs/anyrun.nix"]; imports = [ ./common.nix - ./xdg.nix ./themes ./sync.nix + ../lib/foxwrappers.nix ] ++ homeMods - ++ additionalHomeMods - ++ lib.optional (builtins.pathExists mod) mod - ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig; + ++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig + ++ lib.optional (builtins.pathExists mod) mod; }; }; } diff --git a/home/sync.nix b/home/sync.nix index d82e269..38dceea 100644 --- a/home/sync.nix +++ b/home/sync.nix @@ -4,18 +4,18 @@ pkgs, lib, ... -}: -let +}: let username = config.mods.nextcloud.username; password = - if (config.sops.secrets ? nextcloud.path) then config.sops.secrets.nextcloud.path else ""; + if (config.sops.secrets ? nextcloud.path) + then config.sops.secrets.nextcloud.path + else ""; url = config.mods.nextcloud.url; synclist = config.mods.nextcloud.synclist; in -lib.mkIf config.mods.nextcloud.enable { - systemd.user = { - services = ( - builtins.listToAttrs ( + lib.mkIf config.mods.nextcloud.enable { + systemd.user = { + services = builtins.listToAttrs ( map (opts: { name = "${opts.name}"; value = { @@ -30,13 +30,12 @@ lib.mkIf config.mods.nextcloud.enable { KillMode = "process"; KillSignal = "SIGINT"; }; - Install.WantedBy = [ "multi-user.target" ]; + Install.WantedBy = ["multi-user.target"]; }; - }) synclist - ) - ); - timers = ( - builtins.listToAttrs ( + }) + synclist + ); + timers = builtins.listToAttrs ( map (opts: { name = "${opts.name}"; value = { @@ -48,9 +47,9 @@ lib.mkIf config.mods.nextcloud.enable { "timers.target" ]; }; - }) synclist - ) - ); - startServices = true; - }; -} + }) + synclist + ); + startServices = true; + }; + } diff --git a/home/themes/default.nix b/home/themes/default.nix index 10c4ace..9976455 100644 --- a/home/themes/default.nix +++ b/home/themes/default.nix @@ -1,115 +1,8 @@ { - config, - inputs, - pkgs, - ... -}: -let - username = config.conf.username; - # at time of using this here, stylix might not be evaluated yet - # hence ensure it is by using base16 mkSchemeAttrs - base16 = pkgs.callPackage inputs.base16.lib { }; - scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); - # active_colors=#ffc0caf5, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ffc0caf5, #ffc0caf5, #ffc0caf5, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ffc0caf5, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ffc0caf5, #ffc0caf5 - # disabled_colors=#ff6d728d, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ff6d728d, #ff6d728d, #ff6d728d, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ff6d728d, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ff6d728d, #ff6d728d - # inactive_colors=#ff6d728d, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ff6d728d, #ff6d728d, #ff6d728d, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ff6d728d, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ff6d728d, #ff6d728d - color = '' - [ColorScheme] - active_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} - disabled_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} - inactive_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} - ''; - qss = '' - QTabBar::tab:selected { - color: palette(highlight); - } - QMenuBar, QMenu, QToolBar, QStatusBar, QFrame, QScrollBar { - border: none; - } - ''; -in -{ - xdg.configFile."qt5ct/colors/tokyonight.conf" = { - text = "${color}"; - }; - xdg.configFile."qt6ct/colors/tokyonight.conf" = { - text = "${color}"; - }; - xdg.configFile."qt5ct/qss/tab.qss" = { - text = "${qss}"; - }; - xdg.configFile."qt5ct/qt5ct.conf" = { - text = '' - [Appearance] - color_scheme_path=/home/${username}/.config/qt5ct/colors/tokyonight.conf - custom_palette=true - icon_theme=MoreWaita - standard_dialogs=gtk3 - style=Breeze - - [Fonts] - fixed="Noto Sans,12,-1,5,50,0,0,0,0,0" - general="Noto Sans,12,-1,5,50,0,0,0,0,0" - - [Interface] - activate_item_on_single_click=2 - buttonbox_layout=3 - cursor_flash_time=1000 - dialog_buttons_have_icons=0 - double_click_interval=400 - gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox - keyboard_scheme=4 - menus_have_icons=true - show_shortcuts_in_context_menus=true - stylesheets=/home/${username}/.config/qt5ct/qss/tab.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/fusion-fixes.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/scrollbar-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/sliders-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/tooltip-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/traynotification-simple.qss - toolbutton_style=4 - underline_shortcut=0 - wheel_scroll_lines=3 - - [SettingsWindow] - geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q\0\0\n\0\0\0\0\0\0\0\r[\0\0\x5\x7f\0\0\0\0\x2\0\0\0\rp\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q) - - [Troubleshooting] - force_raster_widgets=1 - ignored_applications=@Invalid() - ''; - }; - xdg.configFile."qt6ct/qt6ct.conf" = { - text = '' - [Appearance] - color_scheme_path=/home/${username}/.config/qt6ct/colors/toykonight.conf - custom_palette=true - standard_dialogs=default - style=Adwaita-Dark - - [Fonts] - fixed="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" - general="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" - - [Interface] - activate_item_on_single_click=2 - buttonbox_layout=3 - cursor_flash_time=1000 - dialog_buttons_have_icons=0 - double_click_interval=400 - gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox - keyboard_scheme=4 - menus_have_icons=true - show_shortcuts_in_context_menus=true - stylesheets=@Invalid() - toolbutton_style=4 - underline_shortcut=1 - wheel_scroll_lines=3 - - [PaletteEditor] - geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x2\x30\0\0\x1\xf4\0\0\0\0\0\0\0\0\0\0\x2\x30\0\0\x1\xf4\0\0\0\0\0\0\0\0\a\x80\0\0\0\0\0\0\0\0\0\0\x2\x30\0\0\x1\xf4) - - [SettingsWindow] - geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x3\xec\0\0\x3,\0\0\0\0\0\0\0\0\0\0\x3\xec\0\0\x3,\0\0\0\0\0\0\0\0\rp\0\0\0\0\0\0\0\0\0\0\x3\xec\0\0\x3,)" - - [Troubleshooting] - force_raster_widgets=1 - ignored_applications=@Invalid() - ''; - }; + imports = [ + ./qt.nix + ./kdeglobals.nix + ./oxiced.nix + ./firefoxTheme.nix + ]; } diff --git a/home/themes/firefoxTheme.nix b/home/themes/firefoxTheme.nix new file mode 100644 index 0000000..0de46f6 --- /dev/null +++ b/home/themes/firefoxTheme.nix @@ -0,0 +1,327 @@ +# css from https://github.com/catppuccin/zen-browser/tree/main/themes +{ + config, + inputs, + pkgs, + lib, + ... +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + userChrome = + /* + css + */ + '' + /* Catppuccin Mocha Blue userContent.css*/ + + @media (prefers-color-scheme: dark) { + + /* Common variables affecting all pages */ + @-moz-document url-prefix("about:") { + :root { + --in-content-page-color: #${scheme.base05} !important; + --color-accent-primary: #${scheme.base0D} !important; + --color-accent-primary-hover: rgb(163, 197, 251) !important; // TODO + --color-accent-primary-active: rgb(138, 153, 250) !important; // TODO + background-color: #${scheme.base00} !important; + --in-content-page-background: #${scheme.base00} !important; + } + + } + + /* Variables and styles specific to about:newtab and about:home */ + @-moz-document url("about:newtab"), url("about:home") { + + :root { + --newtab-background-color: #${scheme.base00} !important; + --newtab-background-color-secondary: #${scheme.base02} !important; + --newtab-element-hover-color: #${scheme.base02} !important; + --newtab-text-primary-color: #${scheme.base05} !important; + --newtab-wordmark-color: #${scheme.base05} !important; + --newtab-primary-action-background: #${scheme.base0D} !important; + } + + .icon { + color: #${scheme.base0D} !important; + } + + .search-wrapper .logo-and-wordmark .logo { + //background: url("zen-logo-mocha.svg"), url("https://raw.githubusercontent.com/IAmJafeth/zen-browser/main/themes/Mocha/Blue/zen-logo-mocha.svg") no-repeat center !important; // TODO + display: inline-block !important; + height: 82px !important; + width: 82px !important; + background-size: 82px !important; + } + + @media (max-width: 609px) { + .search-wrapper .logo-and-wordmark .logo { + background-size: 64px !important; + height: 64px !important; + width: 64px !important; + } + } + + .card-outer:is(:hover, :focus, .active):not(.placeholder) .card-title { + color: #${scheme.base0D} !important; + } + + .top-site-outer .search-topsite { + background-color: #${scheme.base0D} !important; + } + + .compact-cards .card-outer .card-context .card-context-icon.icon-download { + fill: #${scheme.base0B} !important; + } + } + + /* Variables and styles specific to about:preferences */ + @-moz-document url-prefix("about:preferences") { + :root { + --zen-colors-tertiary: #${scheme.base01} !important; + --in-content-text-color: #${scheme.base05} !important; + --link-color: #${scheme.base0D} !important; + --link-color-hover: rgb(163, 197, 251) !important; // TODO + --zen-colors-primary: #${scheme.base02} !important; + --in-content-box-background: #${scheme.base02} !important; + --zen-primary-color: #${scheme.base0D} !important; + } + + groupbox , moz-card{ + background: #${scheme.base00} !important; + } + + button, + groupbox menulist { + background: #${scheme.base02} !important; + color: #${scheme.base05} !important; + } + + .main-content { + background-color: #${scheme.base01} !important; + } + + .identity-color-blue { + --identity-tab-color: #8aadf4 !important; // TODO + --identity-icon-color: #8aadf4 !important; // TODO + } + + .identity-color-turquoise { + --identity-tab-color: #8bd5ca !important; // TODO + --identity-icon-color: #8bd5ca !important; // TODO + } + + .identity-color-green { + --identity-tab-color: #${scheme.base0B} !important; + --identity-icon-color: #${scheme.base0B} !important; + } + + .identity-color-yellow { + --identity-tab-color: #eed49f !important; // TODO + --identity-icon-color: #eed49f !important; // TODO + } + + .identity-color-orange { + --identity-tab-color: #f5a97f !important; // TODO + --identity-icon-color: #f5a97f !important; // TODO + } + + .identity-color-red { + --identity-tab-color: #ed8796 !important; // TODO + --identity-icon-color: #ed8796 !important; // TODO + } + + .identity-color-pink { + --identity-tab-color: #f5bde6 !important; // TODO + --identity-icon-color: #f5bde6 !important; // TODO + } + + .identity-color-purple { + --identity-tab-color: #c6a0f6 !important; // TODO + --identity-icon-color: #c6a0f6 !important; // TODO + } + } + + /* Variables and styles specific to about:addons */ + @-moz-document url-prefix("about:addons") { + :root { + --zen-dark-color-mix-base: #${scheme.base01} !important; + --background-color-box: #${scheme.base00} !important; + } + } + + /* Variables and styles specific to about:protections */ + @-moz-document url-prefix("about:protections") { + :root { + --zen-primary-color: #${scheme.base00} !important; + --social-color: #${scheme.base0E} !important; + --coockie-color: #${scheme.base08} !important; + --fingerprinter-color: #${scheme.base0A} !important; + --cryptominer-color: #${scheme.base07} !important; + --tracker-color: #${scheme.base0B} !important; + --in-content-primary-button-background-hover: rgb(81, 83, 05) !important; + --in-content-primary-button-text-color-hover: #${scheme.base05} !important; + --in-content-primary-button-background: #${scheme.base03} !important; + --in-content-primary-button-text-color: #${scheme.base05} !important; + } + + + .card { + background-color: #${scheme.base02} !important; + } + } + } + ''; + userContent = + /* + css + */ + '' + /* Catppuccin Mocha Blue userChrome.css*/ + @media (prefers-color-scheme: dark) { + + :root { + --zen-colors-primary: #${scheme.base02} !important; + --zen-primary-color: #${scheme.base0D} !important; + --zen-colors-secondary: #${scheme.base02} !important; + --zen-colors-tertiary: #${scheme.base01} !important; + --zen-colors-border: #${scheme.base0D} !important; + --toolbarbutton-icon-fill: #${scheme.base0D} !important; + --lwt-text-color: #${scheme.base05} !important; + --toolbar-field-color: #${scheme.base05} !important; + --tab-selected-textcolor: rgb(171, 197, 247) !important; // TODO + --toolbar-field-focus-color: #${scheme.base05} !important; + --toolbar-color: #${scheme.base05} !important; + --newtab-text-primary-color: #${scheme.base05} !important; + --arrowpanel-color: #${scheme.base05} !important; + --arrowpanel-background: #${scheme.base00} !important; + --sidebar-text-color: #${scheme.base05} !important; + --lwt-sidebar-text-color: #${scheme.base05} !important; + --lwt-sidebar-background-color: #${scheme.base01} !important; //TODO 11111b !important; + --toolbar-bgcolor: #${scheme.base02} !important; + --newtab-background-color: #${scheme.base00} !important; + --zen-themed-toolbar-bg: #${scheme.base01} !important; + --zen-main-browser-background: #${scheme.base01} !important; + } + + #permissions-granted-icon{ + color: #${scheme.base01} !important; + } + + .sidebar-placesTree { + background-color: #${scheme.base00} !important; + } + + #zen-workspaces-button { + background-color: #${scheme.base00} !important; + } + + #TabsToolbar { + background-color: #${scheme.base01} !important; + } + + #urlbar-background { + background-color: #${scheme.base00} !important; + } + + .content-shortcuts { + background-color: #${scheme.base00} !important; + border-color: #${scheme.base0D} !important; + } + + .urlbarView-url { + color: #${scheme.base0D} !important; + } + + #zenEditBookmarkPanelFaviconContainer { + background: #${scheme.base01} !important; + } + + toolbar .toolbarbutton-1 { + &:not([disabled]) { + &:is([open], [checked]) > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack){ + fill: #${scheme.base01}; + } + } + } + + .identity-color-blue { + --identity-tab-color: #${scheme.base0D} !important; + --identity-icon-color: #${scheme.base0D} !important; + } + + .identity-color-turquoise { + --identity-tab-color: #${scheme.base0C} !important; + --identity-icon-color: #${scheme.base0C} !important; + } + + .identity-color-green { + --identity-tab-color: #${scheme.base0B} !important; + --identity-icon-color: #${scheme.base0B} !important; + } + + .identity-color-yellow { + --identity-tab-color: #${scheme.base0A} !important; + --identity-icon-color: #${scheme.base0A} !important; + } + + .identity-color-orange { + --identity-tab-color: #${scheme.base09} !important; + --identity-icon-color: #${scheme.base09} !important; + } + + .identity-color-red { + --identity-tab-color: #${scheme.base08} !important; + --identity-icon-color: #${scheme.base08} !important; + } + + .identity-color-pink { + --identity-tab-color: #${scheme.base0F} !important; + --identity-icon-color: #${scheme.base0F} !important; // TODO f5c2e7 + } + + .identity-color-purple { + --identity-tab-color: #${scheme.base0E} !important; + --identity-icon-color: #${scheme.base0E} !important; + } + } + ''; + browsername = config.mods.homePackages.browser; + profiles = + if config.mods.homePackages.browser == "firefox" + then config.mods.browser.firefox.profiles + else if config.mods.homePackages.browser == "zen" + then config.mods.browser.zen.profiles + else if config.mods.homePackages.browser == "librewolf" + then [ + { + name = "default"; + value = {}; + } + ] + else []; + profileNamesFn = + builtins.catAttrs "name"; + chromesFn = builtins.map ( + name: + if (builtins.isString browsername) + then { + ".${browsername}/${name}/chrome/userContent.css" = { + text = userChrome; + }; + + ".${browsername}/${name}/chrome/userChrome.css" = { + text = userContent; + }; + } + else {} + ); + moduleFn = lib.lists.foldr (attr1: attr2: attr1 // attr2) {}; + mkFirefoxTheme = profiles: + profiles + |> profileNamesFn + |> chromesFn + |> moduleFn; +in {home.file = mkFirefoxTheme profiles;} diff --git a/home/themes/kdeglobals.nix b/home/themes/kdeglobals.nix new file mode 100644 index 0000000..8fa5003 --- /dev/null +++ b/home/themes/kdeglobals.nix @@ -0,0 +1,252 @@ +# This is ABSOLUTE GARGABE, KDE srsly, remove this! +# props to catppuccin mocha for sparing me from doing this manually: https://github.com/catppuccin/kde/blob/main/Resources/Base.colors +{ + pkgs, + config, + lib, + inputs, + ... +}: let + base16 = pkgs.callPackage inputs.base16.lib {}; + + baseScheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + power = number: powerIndex: + if powerIndex == 1 + then number + else if powerIndex == 0 + then 1 + else number * power number (powerIndex - 1); + + lookupTable = powerIndex: { + "0" = 0 * (power 16 powerIndex); + "1" = 1 * (power 16 powerIndex); + "2" = 2 * (power 16 powerIndex); + "3" = 3 * (power 16 powerIndex); + "4" = 4 * (power 16 powerIndex); + "5" = 5 * (power 16 powerIndex); + "6" = 6 * (power 16 powerIndex); + "7" = 7 * (power 16 powerIndex); + "8" = 8 * (power 16 powerIndex); + "9" = 9 * (power 16 powerIndex); + "a" = 10 * (power 16 powerIndex); + "b" = 11 * (power 16 powerIndex); + "c" = 12 * (power 16 powerIndex); + "d" = 13 * (power 16 powerIndex); + "e" = 14 * (power 16 powerIndex); + "f" = 15 * (power 16 powerIndex); + }; + + convertHex = hexChars: + recombineColors [ + (convertColor (lib.lists.take 2 hexChars)) + (convertColor (lib.lists.take 2 (lib.lists.drop 2 hexChars))) + (convertColor (lib.lists.take 2 (lib.lists.drop 4 hexChars))) + ]; + + convertColor = color: (lookupTable 1).${(lib.lists.head color)} + (lookupTable 0).${(lib.lists.last color)}; + recombineColors = colors: lib.lists.foldr (a: b: (toString a) + "," + (toString b)) "end" colors; + + scheme = { + base00 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base00) + ); + base01 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base01) + ); + base02 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base02) + ); + base03 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base03) + ); + base04 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base04) + ); + base05 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base05) + ); + base06 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base06) + ); + base07 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base07) + ); + base08 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base08) + ); + base09 = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base09) + ); + base0A = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0A) + ); + base0B = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0B) + ); + base0C = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0C) + ); + base0D = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0D) + ); + base0E = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0E) + ); + base0F = lib.strings.removeSuffix ",end" ( + convertHex (lib.strings.stringToCharacters baseScheme.base0F) + ); + }; +in { + # temp + # crust -> surface1 + # subtext0 -> surface2 + # accentColor -> lavender + xdg.configFile."kdeglobals" = { + text = '' + [ColorEffects:Disabled] + Color=${scheme.base01} + ColorAmount=0.30000000000000004 + ColorEffect=2 + ContrastAmount=0.1 + ContrastEffect=0 + IntensityAmount=-1 + IntensityEffect=0 + + [ColorEffects:Inactive] + ChangeSelectionColor=true + Color=${scheme.base01} + ColorAmount=0.5 + ColorEffect=3 + ContrastAmount=0 + ContrastEffect=0 + Enable=true + IntensityAmount=0 + IntensityEffect=0 + + [Colors:Button] + BackgroundAlternate=${scheme.base07} + BackgroundNormal=${scheme.base02} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:Complementary] + BackgroundAlternate=${scheme.base03} + BackgroundNormal=${scheme.base00} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:Header] + BackgroundAlternate=${scheme.base03} + BackgroundNormal=${scheme.base00} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:Selection] + BackgroundAlternate=${scheme.base07} + BackgroundNormal=${scheme.base07} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundLink=${scheme.base07} + ForegroundInactive=${scheme.base00} + ForegroundActive=${scheme.base09} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base03} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:Tooltip] + BackgroundAlternate=27,25,35 + BackgroundNormal=${scheme.base01} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:View] + BackgroundAlternate=${scheme.base00} + BackgroundNormal=${scheme.base01} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [Colors:Window] + BackgroundAlternate=${scheme.base03} + BackgroundNormal=${scheme.base00} + DecorationFocus=${scheme.base07} + DecorationHover=${scheme.base02} + ForegroundActive=${scheme.base09} + ForegroundInactive=${scheme.base04} + ForegroundLink=${scheme.base07} + ForegroundNegative=${scheme.base08} + ForegroundNeutral=${scheme.base0A} + ForegroundNormal=${scheme.base05} + ForegroundPositive=${scheme.base0B} + ForegroundVisited=${scheme.base0E} + + + [General] + ColorScheme=CustomBase16Nix + Name=CustomBase16Nix + accentActiveTitlebar=false + shadeSortColumn=true + + + [KDE] + contrast=4 + + + [WM] + activeBackground=${scheme.base01} + activeBlend=${scheme.base05} + activeForeground=${scheme.base05} + inactiveBackground=${scheme.base03} + inactiveBlend=${scheme.base04} + inactiveForeground=${scheme.base04} + ''; + }; +} diff --git a/home/themes/oxiced.nix b/home/themes/oxiced.nix new file mode 100644 index 0000000..8a9e7dc --- /dev/null +++ b/home/themes/oxiced.nix @@ -0,0 +1,86 @@ +{ + config, + inputs, + pkgs, + ... +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + valueOrDefault = value: fallback: + if (scheme ? oxiced && scheme.oxiced ? ${value}) + then scheme.oxiced.value + else fallback; +in { + xdg.configFile."oxiced/theme.toml" = { + source = (pkgs.formats.toml {}).generate "oxiced" { + base = valueOrDefault "base" scheme.base00; + mantle = valueOrDefault "mantle" scheme.base01; + primary_bg = valueOrDefault "primary_bg" scheme.base02; + secondary_bg = valueOrDefault "secondary_bg" scheme.base03; + tertiary_bg = valueOrDefault "tertiary_bg" scheme.base04; + text = valueOrDefault "text" scheme.base05; + + primary = valueOrDefault "primary" scheme.base0D; + primary_contrast = valueOrDefault "primary_contrast" "FFFFFF"; + secondary = valueOrDefault "primary" scheme.base07; + secondary_contrast = valueOrDefault "secondary_contrast" "FFFFFF"; + + good = valueOrDefault "good" scheme.base0B; + good_contrast = valueOrDefault "good_contrast" "000000"; + bad = valueOrDefault "bad" scheme.base08; + bad_contrast = valueOrDefault "bad_contrast" "FFFFFF"; + warning = valueOrDefault "warning" scheme.base0A; + warning_contrast = valueOrDefault "warning_contrast" "000000"; + info = valueOrDefault "info" scheme.base0C; + info_contrast = valueOrDefault "info_contrast" "FFFFFF"; + + rose = valueOrDefault "rose" scheme.base06; + lavender = valueOrDefault "lavender" scheme.base07; + blue = valueOrDefault "blue" scheme.base0D; + mauve = valueOrDefault "mauve" scheme.base0E; + flamingo = valueOrDefault "flamingo" scheme.base0F; + + border_color_weak = valueOrDefault "border_color_weak" scheme.base05; + border_color_strong = valueOrDefault "border_color_strong" scheme.base0D; + + tint_amount = valueOrDefault "tint_amound" 0.10; + shade_amount = valueOrDefault "shade_amount" 0.05; + + border_radius = valueOrDefault "border_radius" 10; + + padding_xs = valueOrDefault "padding_xs" 4.0; + padding_sm = valueOrDefault "padding_sm" 8.0; + padding_md = valueOrDefault "padding_md" 12.0; + padding_lg = valueOrDefault "padding_lg" 16.0; + padding_xl = valueOrDefault "padding_xl" 24.0; + padding_xxl = valueOrDefault "padding_xxl" 32.0; + + font_sm = valueOrDefault "font_sm" 10.0; + font_md = valueOrDefault "font_md" 14.0; + font_lg = valueOrDefault "font_lg" 18.0; + font_xl = valueOrDefault "font_xl" 24.0; + font_xxl = valueOrDefault "font_xxl" 32.0; + + # legacy compatibility + name = scheme.scheme; + inherit (scheme) base00; + inherit (scheme) base01; + inherit (scheme) base02; + inherit (scheme) base03; + inherit (scheme) base04; + inherit (scheme) base05; + inherit (scheme) base06; + inherit (scheme) base07; + inherit (scheme) base08; + inherit (scheme) base09; + base0a = scheme.base0A; + base0b = scheme.base0B; + base0c = scheme.base0C; + base0d = scheme.base0D; + base0e = scheme.base0E; + base0f = scheme.base0F; + }; + }; +} diff --git a/home/themes/qt.nix b/home/themes/qt.nix new file mode 100644 index 0000000..21dc324 --- /dev/null +++ b/home/themes/qt.nix @@ -0,0 +1,124 @@ +{ + config, + inputs, + pkgs, + lib, + ... +}: let + username = config.conf.username; + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + # active_colors=#ffc0caf5, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ffc0caf5, #ffc0caf5, #ffc0caf5, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ffc0caf5, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ffc0caf5, #ffc0caf5 + # disabled_colors=#ff6d728d, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ff6d728d, #ff6d728d, #ff6d728d, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ff6d728d, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ff6d728d, #ff6d728d + # inactive_colors=#ff6d728d, #${scheme.base00}, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ff6d728d, #ff6d728d, #ff6d728d, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ff6d728d, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ff6d728d, #ff6d728d + color = '' + + + [ColorScheme] + active_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} + disabled_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} + inactive_colors=#ff${scheme.base05}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base00}, #ff${scheme.base05}, #ff${scheme.base04}, #ff${scheme.base05}, #ff${scheme.base00}, #ff${scheme.base00}, #00${scheme.base01}, #ff${scheme.base02}, #ff${scheme.base04}, #ff${scheme.base08}, #ff${scheme.base04}, #ff${scheme.base01}, #ff${scheme.base00}, #ff${scheme.base01}, #ff${scheme.base05}, #ff${scheme.base04} + ''; + qss = '' + + QTabBar::tab:selected { + color: palette(highlight); + } + QMenuBar, QMenu, QToolBar, QStatusBar, QFrame, QScrollBar { + border: none; + } + ''; +in { + stylix.targets.qt = { + enable = false; + }; + qt = { + enable = true; + style.package = pkgs.kdePackages.breeze; + style.name = lib.mkForce "breeze-dark"; + }; + + xdg.configFile = { + "qt5ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + "qt6ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + "qt5ct/qss/tab.qss" = { + text = "${qss}"; + }; + "qt5ct/qt5ct.conf" = { + text = '' + + [Appearance] + color_scheme_path=/home/${username}/.config/qt5ct/colors/tokyonight.conf + custom_palette=true + icon_theme=MoreWaita + standard_dialogs=xdgdesktopportal + style=Breeze + + [Fonts] + fixed="Noto Sans,12,-1,5,50,0,0,0,0,0" + general="Noto Sans,12,-1,5,50,0,0,0,0,0" + + [Interface] + activate_item_on_single_click=2 + buttonbox_layout=3 + cursor_flash_time=1000 + dialog_buttons_have_icons=0 + double_click_interval=400 + gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox + keyboard_scheme=4 + menus_have_icons=true + show_shortcuts_in_context_menus=true + stylesheets=/home/${username}/.config/qt5ct/qss/tab.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/fusion-fixes.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/scrollbar-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/sliders-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/tooltip-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/traynotification-simple.qss + toolbutton_style=4 + underline_shortcut=0 + wheel_scroll_lines=3 + + [SettingsWindow] + geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q\0\0\n\0\0\0\0\0\0\0\r[\0\0\x5\x7f\0\0\0\0\x2\0\0\0\rp\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q) + + [Troubleshooting] + force_raster_widgets=1 + ignored_applications=@Invalid() + ''; + }; + "qt6ct/qt6ct.conf" = { + text = '' + + [Appearance] + color_scheme_path=/home/${username}/.config/qt6ct/colors/tokyonight.conf + custom_palette=true + standard_dialogs=xdgdesktopportal + style=Breeze + + [Fonts] + fixed="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" + general="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" + + [Interface] + activate_item_on_single_click=2 + buttonbox_layout=3 + cursor_flash_time=1000 + dialog_buttons_have_icons=0 + double_click_interval=400 + gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox + keyboard_scheme=4 + menus_have_icons=true + show_shortcuts_in_context_menus=true + stylesheets=@Invalid() + toolbutton_style=4 + underline_shortcut=1 + wheel_scroll_lines=3 + + [Troubleshooting] + force_raster_widgets=1 + ignored_applications=@Invalid() + ''; + }; + }; +} diff --git a/home/xdg.nix b/home/xdg.nix deleted file mode 100644 index aa9541a..0000000 --- a/home/xdg.nix +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) 2020-2021 Mihai Fufezan -# credits to fufexan https://github.com/fufexan/dotfiles/blob/main/home/terminal/programs/xdg.nix -{ config, ... }: -let - browser = [ "firefox" ]; - imageViewer = [ "imv" ]; - videoPlayer = [ "mpv" ]; - audioPlayer = [ "io.bassi.Amberol" ]; - - xdgAssociations = - type: program: list: - builtins.listToAttrs ( - map (e: { - name = "${type}/${e}"; - value = program; - }) list - ); - - image = xdgAssociations "image" imageViewer [ - "png" - "svg" - "jpeg" - "gif" - ]; - video = xdgAssociations "video" videoPlayer [ - "mp4" - "avi" - "mkv" - ]; - audio = xdgAssociations "audio" audioPlayer [ - "mp3" - "flac" - "wav" - "aac" - ]; - browserTypes = - (xdgAssociations "application" browser [ - "json" - "x-extension-htm" - "x-extension-html" - "x-extension-shtml" - "x-extension-xht" - "x-extension-xhtml" - ]) - // (xdgAssociations "x-scheme-handler" browser [ - "about" - "ftp" - "http" - "https" - "unknown" - ]); - - # XDG MIME types - associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) ( - { - "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ]; - "text/html" = browser; - "text/plain" = [ "neovide" ]; - "x-scheme-handler/chrome" = [ "com.brave.browser" ]; - "inode/directory" = [ "yazi" ]; - } - // image - // video - // audio - // browserTypes - ); -in -{ - xdg = { - enable = true; - cacheHome = config.home.homeDirectory + "/.local/cache"; - - mimeApps = { - enable = true; - defaultApplications = associations; - }; - - userDirs = { - enable = true; - createDirectories = true; - extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; - }; - }; - }; -} diff --git a/iso/configuration.nix b/iso/configuration.nix index 7461131..9272a65 100644 --- a/iso/configuration.nix +++ b/iso/configuration.nix @@ -1,43 +1,77 @@ { pkgs, - lib, modulesPath, + lib, self, + inputs, ... -}: -{ - - imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" ]; +}: let + system = "x86_64-linux"; +in { + imports = ["${modulesPath}/installer/cd-dvd/iso-image.nix"]; nixpkgs.hostPlatform = { - system = "x86_64-linux"; + inherit system; }; environment.systemPackages = with pkgs; [ - neovim + inputs.dashvim.packages.${system}.minimal disko git - vesktop - vscodium firefox kitty + gnome-disk-utility + inputs.disko.packages.${system}.disko-install ]; + networking = { wireless.enable = false; networkmanager.enable = true; }; - services.greetd = { - enable = true; - settings = { - initial_session = { - command = "${pkgs.hyprland}/bin/Hyprland"; - user = "nixos"; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + "pipe-operators" + ]; + + users.users.nixos = { + isNormalUser = true; + password = "nixos"; + extraGroups = ["wheel"]; + }; + + image.baseName = lib.mkForce "DashNix"; + + programs = { + hyprland = { + enable = true; + withUWSM = true; + xwayland.enable = false; + }; + uwsm.enable = true; + }; + + fonts.packages = [pkgs.adwaita-fonts]; + i18n.defaultLocale = "en_US.UTF-8"; + + services = { + displayManager.autoLogin = { + enable = true; + user = "nixos"; + }; + greetd = { + enable = true; + settings = { + terminal.vt = 1; + default_session = { + command = "${lib.getExe pkgs.hyprland}"; + user = "nixos"; + }; }; }; }; isoImage = { - isoName = lib.mkForce "DashNix.iso"; makeEfiBootable = true; makeUsbBootable = true; contents = [ @@ -47,4 +81,6 @@ } ]; }; + + system.stateVersion = "25.11"; } diff --git a/lib/default.nix b/lib/default.nix index f16ceb3..d8a7402 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,60 +1,208 @@ { inputs, - pkgs, + unstable, self, - lib, - additionalMods ? { - nixos = [ ]; - home = [ ]; - }, - mods ? { - nixos = [ - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - ../base - ../home - ../modules - ]; - home = [ - inputs.anyrun.homeManagerModules.default - inputs.ironbar.homeManagerModules.default - inputs.oxicalc.homeManagerModules.default - inputs.oxishut.homeManagerModules.default - inputs.oxinoti.homeManagerModules.default - inputs.oxidash.homeManagerModules.default - inputs.oxipaste.homeManagerModules.default - inputs.hyprdock.homeManagerModules.default - inputs.hyprland.homeManagerModules.default - inputs.reset.homeManagerModules.default - inputs.nix-flatpak.homeManagerModules.nix-flatpak - inputs.sops-nix.homeManagerModules.sops - inputs.dashvim.homeManagerModules.dashvim - ../modules - ]; - }, + system, + permittedPackages, + dashNixAdditionalProps ? {}, ... -}: -{ - /** - # build_systems +}: let + defaultConfig = { + config = { + allowUnfree = true; + permittedInsecurePackages = permittedPackages; + }; + overlays = [ + inputs.cachy.overlays.default + inputs.nur.overlays.default + ]; + inherit system; + }; + mkPkgs = { + pkgs, + config, + }: let + overlays = + if (config ? overlays) + then config.overlays + else []; + comnbinedConfig = config // {overlays = overlays ++ defaultConfig.overlays;}; + in + import pkgs comnbinedConfig; +in rec { + mkNixos = { + root, + inputLib, + lib, + stablePkgs, + unstablePkgs, + stableMods, + unstableMods, + overridePkgs, + ... + }: + builtins.listToAttrs ( + map + (name: { + inherit name; + value = let + mod = root + /hosts/${name}/configuration.nix; + additionalNixosConfig = root + /hosts/${name}/hardware.nix; + additionalHomeConfig = root + /hosts/${name}/home.nix; + args = { + inherit + self + inputs + mod + additionalHomeConfig + system + root + dashNixAdditionalProps + lib + ; + stable = stablePkgs; + unstable = unstablePkgs; + pkgs = lib.mkForce ( + if overridePkgs + then stablePkgs + else unstablePkgs + ); + alternativePkgs = + if overridePkgs + then unstablePkgs + else stablePkgs; + hostName = name; + homeMods = + if overridePkgs + then unstableMods.home + else stableMods.home; + mkDashDefault = import ./override.nix {inherit lib;}; + }; + nixosMods = + if overridePkgs + then unstableMods.nixos + else stableMods.nixos; + in + inputLib.nixosSystem { + modules = + [ + {_module.args = args;} + mod + ] + ++ nixosMods + ++ lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig + ++ lib.optional (builtins.pathExists mod) mod; + }; + }) + ( + lib.lists.remove "" ( + lib.attrsets.mapAttrsToList (name: fType: + if fType == "directory" + then name + else "") ( + builtins.readDir (root + /hosts) + ) + ) + ) + ); - Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. + mkHome = { + root, + lib, + stablePkgs, + unstablePkgs, + stableMods, + unstableMods, + overridePkgs, + ... + }: + builtins.listToAttrs ( + map + (name: { + inherit name; + value = let + mod = root + /homes/${name}/configuration.nix; + additionalHomeConfig = root + /homes/${name}/home.nix; + args = { + inherit + self + inputs + mod + additionalHomeConfig + system + root + dashNixAdditionalProps + lib + ; + stable = stablePkgs; + unstable = unstablePkgs; + pkgs = lib.mkForce ( + if overridePkgs + then stablePkgs + else unstablePkgs + ); + alternativePkgs = + if overridePkgs + then unstablePkgs + else stablePkgs; + userName = name; + mkDashDefault = import ./override.nix {inherit lib;}; + }; + homeMods = + if overridePkgs + then unstableMods.home + else stableMods.home; + in + inputs.home-manager.lib.homeManagerConfiguration + { + inherit (args) pkgs; + modules = + [ + {_module.args = args;} + mod + ] + ++ homeMods + ++ [ + ../home/common.nix + ../home/themes + ../home/sync.nix + ./foxwrappers.nix + ] + ++ lib.optional (builtins.pathExists mod) mod; + }; + }) + ( + lib.lists.remove "" ( + lib.attrsets.mapAttrsToList (name: fType: + if fType == "directory" + then name + else "") ( + builtins.readDir (root + /homes) + ) + ) + ) + ); - A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. + /* + * + # buildSystems - The second parameter is the root of your configuration, which should be ./. in most cases. + Builds system given a list of system names which are placed within your hosts/ directory. Note that each system has its own directory in hosts/ as well. - `root` + A minimal configuration requires the file configuration.nix within each system directory, this will be the base config that is used across both NisOS and home-manager, specific optional files can also be added, hardware.nix for NisOS configuration and home.nix for home-manager configuration. - : the root path of your configuration + The second parameter is the root of your configuration, which should be ./. in most cases. - # Example usage - :::{.example} - ```nix - nixosConfigurations = - (build_systems [ "nixos" ] ./.); - ``` - ::: + `root` + + : the root path of your configuration + + # Example usage + :::{.example} + ```nix + nixosConfigurations = buildSystems { root = ./.; }; + ``` + ::: */ # let # paths = builtins.readDir ; @@ -63,53 +211,82 @@ # ); # in - build_systems = - root: - builtins.listToAttrs ( - map - (name: { - name = name; - value = - let - mod = root + /hosts/${name}/configuration.nix; - additionalNixosConfig = root + /hosts/${name}/hardware.nix; - additionalHomeConfig = root + /hosts/${name}/home.nix; - in - inputs.nixpkgs.lib.nixosSystem { - specialArgs = { - inherit - self - inputs - pkgs - mod - additionalHomeConfig - root - ; - hostName = name; - homeMods = mods.home; - additionalHomeMods = additionalMods.home; - }; - modules = - [ mod ] - ++ mods.nixos - ++ additionalMods.nixos - ++ inputs.nixpkgs.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig - ++ inputs.nixpkgs.lib.optional (builtins.pathExists mod) mod; - }; - }) - ( - lib.lists.remove "" ( - lib.attrsets.mapAttrsToList (name: fType: if fType == "directory" then name else "") ( - builtins.readDir (root + /hosts) - ) - ) - ) - ); + buildFunc = func: { + root, + unstableBundle ? {}, + stableBundle ? {}, + overridePkgs ? false, + ... + }: let + defaultNixosMods = inputs: [ + inputs.lanzaboote.nixosModules.lanzaboote + inputs.nixos-wsl.nixosModules.default + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + inputs.disko.nixosModules.disko + inputs.superfreq.nixosModules.default + inputs.sops-nix.nixosModules.sops + ../base + ../home + ../modules + ]; - buildIso = inputs.nixpkgs.lib.nixosSystem { - specialArgs = { - inherit self inputs pkgs; + defaultHomeMods = inputs: [ + inputs.anyrun.homeManagerModules.default + inputs.ironbar.homeManagerModules.default + inputs.oxicalc.homeManagerModules.default + inputs.oxishut.homeManagerModules.default + inputs.oxinoti.homeManagerModules.default + inputs.oxidash.homeManagerModules.default + inputs.oxipaste.homeManagerModules.default + inputs.oxirun.homeManagerModules.default + inputs.hyprdock.homeManagerModules.default + inputs.hyprland.homeManagerModules.default + inputs.reset.homeManagerModules.default + inputs.sops-nix.homeManagerModules.sops + inputs.dashvim.homeManagerModules.dashvim + ../modules + ]; + + unstableInput = unstableBundle.pkgs or inputs.unstable; + stableInput = stableBundle.pkgs or inputs.stable; + unstableConfig = unstableBundle.config or defaultConfig; + stableConfig = stableBundle.config or defaultConfig; + unstableInputs = (unstableBundle.inputs or {}) // inputs; + stableInputs = (stableBundle.inputs or {}) // inputs; + unstableMods = { + home = (defaultHomeMods unstableInputs) ++ (unstableBundle.mods.home or []); + nixos = (defaultNixosMods unstableInputs) ++ (unstableBundle.mods.nixos or []); }; - modules = [ ../iso/configuration.nix ]; + stableMods = { + home = (defaultHomeMods stableInputs) ++ (stableBundle.mods.home or []); + nixos = (defaultNixosMods stableInputs) ++ (stableBundle.mods.nixos or []); + }; + + unstablePkgs = mkPkgs { + pkgs = unstableInput; + config = unstableConfig; + }; + stablePkgs = mkPkgs { + pkgs = stableInput; + config = stableConfig; + }; + inputLib = unstableInput.lib; + inherit (unstablePkgs) lib; + in + func { + inherit lib inputLib stablePkgs unstablePkgs stableMods unstableMods stableInputs unstableInputs root overridePkgs; + }; + + buildSystems = buildFunc mkNixos; + buildHome = buildFunc mkHome; + + buildIso = inputs.unstable.lib.nixosSystem { + specialArgs = { + inherit self inputs unstable; + }; + modules = [ + ../iso/configuration.nix + ]; }; } diff --git a/lib/foxextensions.nix b/lib/foxextensions.nix new file mode 100644 index 0000000..d2360ad --- /dev/null +++ b/lib/foxextensions.nix @@ -0,0 +1,59 @@ +{ + lib, + name, + ... +}: let + mkExtension = id: install_url: { + ${id} = { + inherit install_url; + installation_mode = "normal_installed"; + }; + }; +in { + options.mods.browser.${name} = { + darkreader = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to enable darkreader"; + }; + extensions = lib.mkOption { + default = [ + (mkExtension "uBlock0@raymondhill.net" "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi") + (mkExtension "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" "https://addons.mozilla.org/firefox/downloads/latest/user-agent-string-switcher/latest.xpi") + (mkExtension "{d7742d87-e61d-4b78-b8a1-b469842139fa}" "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi") + (mkExtension "firefox@ghostery.com" "https://addons.mozilla.org/firefox/downloads/latest/ghostery/latest.xpi") + (mkExtension "CanvasBlocker@kkapsner.de" "https://addons.mozilla.org/firefox/downloads/latest/canvasblocker/latest.xpi") + (mkExtension "jid1-KKzOGWgsW3Ao4Q@jetpack" "https://addons.mozilla.org/firefox/downloads/latest/i-dont-care-about-cookies/latest.xpi") + (mkExtension "keepassxc-browser@keepassxc.org" "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi") + (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 "{20a9bb38-ed7c-4faf-9aaf-7c5d241fd747}" "https://addons.mozilla.org/firefox/downloads/file/4524699/angular_devtools-1.0.37.xpi") + (mkExtension "private-relay@firefox.com" "https://addons.mozilla.org/firefox/downloads/latest/private-relay/latest.xpi") + ]; + example = [ + { + "78272b6fa58f4a1abaac99321d503a20@proton.me" = { + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/proton-pass/latest.xpi"; + installation_mode = "normal_installed"; + }; + } + ]; + type = with lib.types; listOf anything; + description = '' + List of extensions via attrsets: + ```nix + # id + # figure out the id via: + # nix run github:tupakkatapa/mozid -- 'https://addons.mozilla.org/en/firefox/addon/ublock-origin' + "uBlock0@raymondhill.net" = { + # install url + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + # method https://mozilla.github.io/policy-templates/#extensionsettings + installation_mode = "force_installed"; + }; + ``` + ''; + }; + }; +} diff --git a/lib/foxwrappers.nix b/lib/foxwrappers.nix new file mode 100644 index 0000000..e5c39a7 --- /dev/null +++ b/lib/foxwrappers.nix @@ -0,0 +1,43 @@ +# https://github.com/0xc000022070/zen-browser-flake/issues/9#issuecomment-2711057434 +{inputs, ...}: let + mkFirefoxModule = import "${inputs.home-manager.outPath}/modules/programs/firefox/mkFirefoxModule.nix"; +in { + imports = [ + (mkFirefoxModule { + modulePath = [ + "programs" + "zen-browser" + ]; + name = "Zen Browser"; + wrappedPackageName = "zen"; + unwrappedPackageName = "zen-unwrapped"; + visible = true; + platforms = { + linux = { + vendorPath = ".zen"; + configPath = ".zen"; + }; + darwin = { + configPath = "Library/Application Support/Zen"; + }; + }; + }) + (mkFirefoxModule { + modulePath = [ + "programs" + "librewolf-dashnix" + ]; + name = "LibreWolf"; + description = "LibreWolf is a privacy enhanced Firefox fork."; + wrappedPackageName = "librewolf"; + unwrappedPackageName = "librewolf-unwrapped"; + + platforms.linux = {configPath = ".librewolf";}; + platforms.darwin = { + configPath = "Library/Application Support/LibreWolf"; + }; + + enableBookmarks = false; + }) + ]; +} diff --git a/lib/importPkgs.nix b/lib/importPkgs.nix new file mode 100644 index 0000000..cfcd413 --- /dev/null +++ b/lib/importPkgs.nix @@ -0,0 +1,17 @@ +{ + inputs, + currentSystem, + permittedPackages, + pkgs, +}: +import pkgs { + system = currentSystem; + config = { + allowUnfree = true; + permittedInsecurePackages = permittedPackages; + }; + overlays = [ + inputs.nur.overlays.default + inputs.cachy.overlays.default + ]; +} diff --git a/lib/override.nix b/lib/override.nix new file mode 100644 index 0000000..4d222f8 --- /dev/null +++ b/lib/override.nix @@ -0,0 +1 @@ +{lib, ...}: value: lib.mkOverride 999 value diff --git a/lib/wm.nix b/lib/wm.nix new file mode 100644 index 0000000..416956a --- /dev/null +++ b/lib/wm.nix @@ -0,0 +1,446 @@ +let + browserName = config: + if (builtins.isString config.mods.homePackages.browser) + then config.mods.homePackages.browser + else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram + then config.mods.homePackages.browser.meta.mainProgram + else config.mods.homePackages.browser.pname; + mkSimpleBind = modKeys: key: command: args: { + inherit modKeys key command args; + }; + mkRepeatSimpleBind = modKeys: key: command: args: { + inherit modKeys key command args; + meta.hyprland.repeat = true; + }; + mkSimpleCustomBind = modKeys: key: niri: hyprland: args: { + inherit modKeys key args; + command = { + inherit niri hyprland; + }; + }; + mkRepeatCustomBind = modKeys: key: niri: hyprland: args: { + inherit modKeys key args; + command = { + inherit niri hyprland; + }; + meta.hyprland.repeat = true; + }; + mkBindWithDesc = modKeys: key: command: args: desc: + { + meta.niri.desc = desc; + } + // mkSimpleBind modKeys key command args; +in { + defaultWindowRules = { + niri = [ + '' + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# + + block-out-from "screen-capture" + '' + '' + match app-id=r#"^steam$"# + open-on-workspace "0" + '' + '' + geometry-corner-radius 12 + clip-to-geometry true + '' + ]; + hyprland = [ + # window rules + "match:class OxiCalc, float on" + "match:class winecfg.exe, float on" + "match:class copyq, float on" + "match:class swappy, center on" + "match:class steam, workspace 10 silent" + ]; + }; + + defaultStartup = config: { + all = [ + "systemctl --user import-environment" + "dbus-update-activation-environment --systemd --all" + "hyprctl setcursor ${config.mods.stylix.cursor.name} ${toString config.mods.stylix.cursor.size}" + # ensures the systemd service knows what "hyprctl" is :) + ( + if config.mods.gaming.gamemode + then "systemctl try-restart gamemoded.service --user" + else "" + ) + + # other programs + "${browserName config}" + ( + if config.mods.oxi.hyprdock.enable + then "hyprdock --server" + else "" + ) + ( + if config.mods.hypr.hyprpaper.enable + then "hyprpaper" + else "" + ) + ( + if config.mods.hypr.hyprland.useIronbar + then "ironbar" + else "" + ) + ( + if config.mods.oxi.oxipaste.enable + then "oxipaste_daemon" + else "" + ) + ( + if config.mods.oxi.oxinoti.enable + then "oxinoti" + else "" + ) + ]; + niri = [ + "XDG_CURRENT_DESKTOP=Niri" + "XDG_SESSION_DESKTOP=Niri" + "XDG_SESSION_TYPE=wayland" + ]; + hyprland = [ + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + ]; + }; + + defaultEnv = config: { + all = { + GTK_CSD = "0"; + TERM = "kitty /bin/fish"; + HYPRCURSOR_THEME = config.mods.stylix.cursor.name; + HYPRCURSOR_SIZE = toString config.mods.stylix.cursor.size; + XCURSOR_THEME = config.mods.stylix.cursor.name; + XCURSOR_SIZE = toString config.mods.stylix.cursor.size; + QT_QPA_PLATFORM = "wayland"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + QT_WAYLAND_FORCE_DPI = "96"; + QT_AUTO_SCREEN_SCALE_FACTOR = "0"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + QT_SCALE_FACTOR = "1"; + EDITOR = "neovide --novsync --nofork"; + + LIBVA_DRIVER_NAME = + if config.mods.gpu.nvidia.enable + then "nvidia" + else ""; + GBM_BACKEND = + if config.mods.gpu.nvidia.enable + then "nvidia-drm" + else ""; + __GLX_VENDOR_LIBRARY_NAME = + if config.mods.gpu.nvidia.enable + then "nvidia" + else ""; + }; + niri = {}; + hyprland = {}; + }; + + defaultBinds = config: [ + (mkSimpleBind ["Mod"] "1" "focusWorkspace" ["1"]) + (mkSimpleBind ["Mod"] "2" "focusWorkspace" ["2"]) + (mkSimpleBind ["Mod"] "3" "focusWorkspace" ["3"]) + (mkSimpleBind ["Mod"] "4" "focusWorkspace" ["4"]) + (mkSimpleBind ["Mod"] "5" "focusWorkspace" ["5"]) + (mkSimpleBind ["Mod"] "6" "focusWorkspace" ["6"]) + (mkSimpleBind ["Mod"] "7" "focusWorkspace" ["7"]) + (mkSimpleBind ["Mod"] "8" "focusWorkspace" ["8"]) + (mkSimpleBind ["Mod"] "9" "focusWorkspace" ["9"]) + (mkSimpleBind ["Mod"] "0" "focusWorkspace" ["10"]) + (mkSimpleBind ["Mod" "Shift"] "1" "moveToWorkspace" ["1"]) + (mkSimpleBind ["Mod" "Shift"] "2" "moveToWorkspace" ["2"]) + (mkSimpleBind ["Mod" "Shift"] "3" "moveToWorkspace" ["3"]) + (mkSimpleBind ["Mod" "Shift"] "4" "moveToWorkspace" ["4"]) + (mkSimpleBind ["Mod" "Shift"] "5" "moveToWorkspace" ["5"]) + (mkSimpleBind ["Mod" "Shift"] "6" "moveToWorkspace" ["6"]) + (mkSimpleBind ["Mod" "Shift"] "7" "moveToWorkspace" ["7"]) + (mkSimpleBind ["Mod" "Shift"] "8" "moveToWorkspace" ["8"]) + (mkSimpleBind ["Mod" "Shift"] "9" "moveToWorkspace" ["9"]) + (mkSimpleBind ["Mod" "Shift"] "0" "moveToWorkspace" ["10"]) + (mkSimpleBind ["Mod"] "B" "toggleFullscreen" []) + (mkSimpleBind ["Mod"] "V" "toggleFloating" []) + (mkSimpleBind ["Mod" "Shift"] "M" "quit" []) + (mkSimpleBind ["Mod"] "Left" "moveWindowLeft" []) + (mkSimpleBind ["Mod"] "Down" "moveWindowDown" []) + (mkSimpleBind ["Mod"] "Up" "moveWindowUp" []) + (mkSimpleBind ["Mod"] "Right" "moveWindowRight" []) + + (mkRepeatSimpleBind ["Mod"] "J" "moveFocusLeft" []) + (mkRepeatSimpleBind ["Mod"] "K" "moveFocusDown" []) + (mkRepeatSimpleBind ["Mod"] "L" "moveFocusUp" []) + (mkRepeatSimpleBind ["Mod"] "semicolon" "moveFocusRight" []) + + (mkBindWithDesc ["Mod"] "Q" "killActive" [] "Kill active window") + + (mkBindWithDesc ["Mod"] "N" "spawn" ["neovide"] "Open Neovide") + (mkBindWithDesc ["Mod"] "T" "spawn-sh" ["kitty" "-1"] "Open Kitty") + (mkBindWithDesc ["Mod" "Shift"] "L" "spawn" ["hyprlock"] "Lock screen") + + ( + if config.mods.yazi.enable + then mkBindWithDesc ["Mod"] "E" "spawn-sh" ["EDITOR='neovide --no-fork' kitty yazi"] "Open Yazi" + else {} + ) + ( + if config.mods.anyrun.enable + then mkBindWithDesc ["Mod"] "R" "spawn" ["anyrun"] "Open Anyrun" + else {} + ) + ( + if config.mods.oxi.oxirun.enable + then mkBindWithDesc ["Mod"] "R" "spawn" ["oxirun"] "Open OxiRun" + else {} + ) + ( + if config.mods.oxi.oxidash.enable + then mkBindWithDesc ["Mod"] "M" "spawn" ["oxidash"] "Open OxiDash" + else {} + ) + ( + if config.mods.oxi.oxicalc.enable + then mkBindWithDesc ["Mod"] "G" "spawn" ["oxicalc"] "Open Oxicalc" + else {} + ) + ( + if config.mods.oxi.oxishut.enable + then mkBindWithDesc ["Mod"] "D" "spawn" ["oxishut"] "Open OxiShut" + else {} + ) + ( + if config.mods.oxi.oxipaste.enable + then mkBindWithDesc ["Mod"] "A" "spawn" ["oxipaste"] "Open Oxipaste" + else {} + ) + ( + if config.mods.oxi.hyprdock.enable + then mkBindWithDesc ["Mod" "Shift"] "P" "spawn" ["hyprdock --gui"] "Open Hyprdock" + else {} + ) + ( + if config.mods.hypr.hyprlock.enable + then mkBindWithDesc ["Mod" "Shift" "Alt"] "L" "spawn-sh" ["playerctl -a pause & hyprlock & systemctl suspend"] "Lock and suspend" + else {} + ) + ( + if config.mods.hypr.hyprlock.enable + then mkBindWithDesc ["Mod" "Shift" "Alt"] "K" "spawn-sh" ["playerctl -a pause & hyprlock & systemctl hibernate"] "Lock and hibernate" + else {} + ) + + (mkBindWithDesc ["Mod"] "F" "spawn" ["${browserName config}"] "Open Browser") + ( + if + ( + browserName config == "firefox" || browserName config == "zen" + ) + then mkBindWithDesc ["Mod" "Shift"] "F" "spawn" ["${browserName config} -p special"] "Open Browser Special Profile" + else {} + ) + + (mkBindWithDesc ["Mod"] "S" "spawn-sh" [''grim -g "$(slurp)" - | wl-copy''] "Take Screenshot") + (mkBindWithDesc ["Mod" "Shift"] "S" "spawn-sh" [''grim -g "$(slurp)" - | satty -f -''] "Take Screenshot and edit") + + ( + if config.mods.scripts.audioControl + then { + key = "XF86AudioMute"; + command = "spawn-sh"; + args = ["audioControl mute"]; + meta.niri = { + allowWhileLocked = true; + desc = "Mute Audio"; + }; + } + else {} + ) + ( + if config.mods.scripts.audioControl + then { + key = "XF86AudioRaiseVolume"; + command = "spawn-sh"; + args = ["audioControl +5%"]; + meta.niri = { + allowWhileLocked = true; + desc = "Raise Audio Volume"; + }; + } + else {} + ) + ( + if config.mods.scripts.audioControl + then { + key = "XF86AudioLowerVolume"; + command = "spawn-sh"; + args = ["audioControl -5%"]; + meta.niri = { + allowWhileLocked = true; + desc = "Lower Audio Volume"; + }; + } + else {} + ) + { + key = "XF86AudioPlay"; + command = "spawn-sh"; + args = ["playerctl play-pause"]; + meta.niri = { + allowWhileLocked = true; + desc = "Play/Pause"; + }; + } + { + key = "XF86AudioNext"; + command = "spawn-sh"; + args = ["playerctl next"]; + meta.niri = { + allowWhileLocked = true; + desc = "Next Song"; + }; + } + { + key = "XF86AudioPrev"; + command = "spawn-sh"; + args = ["playerctl previous"]; + meta.niri = { + allowWhileLocked = true; + desc = "Previous Song"; + }; + } + ( + if config.mods.scripts.changeBrightness + then { + key = "XF86MonBrightnessDown"; + command = "spawn-sh"; + args = ["changeBrightness -10%"]; + meta.niri = { + allowWhileLocked = true; + desc = "Lower Brigthness"; + }; + } + else {} + ) + ( + if config.mods.scripts.changeBrightness + then { + key = "XF86MonBrightnessUp"; + command = "spawn-sh"; + args = ["changeBrightness +10%"]; + meta.niri = { + allowWhileLocked = true; + desc = "Raise Brigthness"; + }; + } + else {} + ) + + # Niri only keybinds + (mkSimpleCustomBind ["Mod"] "BracketLeft" "consume-or-expel-window-left" null []) + (mkSimpleCustomBind ["Mod"] "BracketRight" "consume-or-expel-window-right" null []) + (mkSimpleCustomBind ["Mod"] "Comma" "consume-window-into-column" null []) + (mkSimpleCustomBind ["Mod"] "Period" "expel-window-from-column" null []) + (mkSimpleCustomBind ["Mod"] "Y" "switch-preset-column-width" null []) + (mkSimpleCustomBind ["Mod"] "Tab" "focus-workspace-previous" null []) + (mkSimpleCustomBind ["Mod" "Shift"] "V" "switch-focus-between-floating-and-tiling" null []) + (mkSimpleCustomBind ["Mod" "Shift"] "B" "expand-column-to-available-width" null []) + (mkSimpleCustomBind ["Mod"] "U" "set-column-width" null ["-10%"]) + (mkSimpleCustomBind ["Mod"] "P" "set-column-width" null ["+10%"]) + (mkSimpleCustomBind ["Mod"] "O" "set-column-width" null ["50%"]) + (mkSimpleCustomBind ["Mod" "Shift"] "Minus" "set-window-height" null ["-10%"]) + (mkSimpleCustomBind ["Mod" "Shift"] "Equal" "set-window-height" null ["+10%"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "1" "move-column-to-workspace" null ["1"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "2" "move-column-to-workspace" null ["2"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "3" "move-column-to-workspace" null ["3"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "4" "move-column-to-workspace" null ["4"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "5" "move-column-to-workspace" null ["5"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "6" "move-column-to-workspace" null ["6"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "7" "move-column-to-workspace" null ["7"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "8" "move-column-to-workspace" null ["8"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "9" "move-column-to-workspace" null ["9"]) + (mkSimpleCustomBind ["Mod" "Ctrl"] "0" "move-column-to-workspace" null ["10"]) + (mkSimpleCustomBind ["Mod" "Shift"] "J" "focus-monitor-left" null []) + (mkSimpleCustomBind ["Mod" "Shift"] "semicolon" "focus-monitor-right" null []) + (mkSimpleCustomBind ["Mod" "Ctrl"] "J" "move-column-to-monitor-left" null []) + (mkSimpleCustomBind ["Mod" "Ctrl"] "semicolon" "move-column-to-monitor-right" null []) + (mkSimpleCustomBind ["Mod" "Shift"] "Slash" "show-hotkey-overlay" null []) + { + modKeys = ["Mod"]; + key = "W"; + command.niri = "toggle-overview"; + meta.niri = { + desc = "Overview"; + repeat = false; + }; + } + { + modKeys = ["Mod"]; + key = "Escape"; + command.niri = "toggle-keyboard-shortcuts-inhibit"; + meta.niri = { + allowInhibit = false; + }; + } + { + modKeys = ["Mod"]; + key = "WheelScrollUp"; + command.niri = "focus-workspace-up"; + meta.niri.cooldown = 150; + } + { + modKeys = ["Mod"]; + key = "WheelScrollDown"; + command.niri = "focus-workspace-down"; + meta.niri.cooldown = 150; + } + { + modKeys = ["Mod"]; + key = "WheelScrollRight"; + command.niri = "focus-column-right"; + meta.niri.cooldown = 150; + } + { + modKeys = ["Mod"]; + key = "WheelScrollLeft"; + command.niri = "focus-column-left"; + meta.niri.cooldown = 150; + } + + # Hyprland only keybinds + (mkSimpleCustomBind ["Mod"] "C" null "togglesplit" []) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "1" null "movetoworkspacesilent" ["1"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "2" null "movetoworkspacesilent" ["2"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "3" null "movetoworkspacesilent" ["3"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "4" null "movetoworkspacesilent" ["4"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "5" null "movetoworkspacesilent" ["5"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "6" null "movetoworkspacesilent" ["6"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "7" null "movetoworkspacesilent" ["7"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "8" null "movetoworkspacesilent" ["8"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "9" null "movetoworkspacesilent" ["9"]) + (mkSimpleCustomBind ["Mod" "SHIFT" "ALT"] "0" null "movetoworkspacesilent" ["10"]) + (mkRepeatCustomBind ["Mod"] "U" null "resizeactive" ["-20" "0"]) + (mkRepeatCustomBind ["Mod"] "P" null "resizeactive" ["20" "0"]) + (mkRepeatCustomBind ["Mod"] "O" null "resizeactive" ["0" "-20"]) + (mkRepeatCustomBind ["Mod"] "I" null "resizeactive" ["0" "20"]) + (mkSimpleCustomBind ["Mod" "ALT"] "J" null "layoutmsg" ["preselect" "l"]) + (mkSimpleCustomBind ["Mod" "ALT"] "K" null "layoutmsg" ["preselect" "d"]) + (mkSimpleCustomBind ["Mod" "ALT"] "L" null "layoutmsg" ["preselect" "u"]) + (mkSimpleCustomBind ["Mod" "ALT"] "semicolon" null "layoutmsg" ["preselect" "r"]) + (mkSimpleCustomBind ["Mod" "ALT"] "H" null "layoutmsg" ["preselect" "n"]) + ( + if config.mods.hypr.hyprland.hyprspaceEnable + then { + modKeys = ["Mod"]; + key = "W"; + command.hyprland = "overview:toggle"; + args = []; + } + else {} + ) + ]; +} diff --git a/logo.svg b/logo.svg new file mode 100644 index 0000000..8c9526c --- /dev/null +++ b/logo.svg @@ -0,0 +1,293 @@ + + + +DashNixDashNix diff --git a/modules/conf.nix b/modules/conf.nix index dcaa1e7..0e3a166 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -1,98 +1,97 @@ { lib, config, - pkgs, options, ... -}: -{ +}: { options.conf = { - system = lib.mkOption { default = "x86_64-linux"; # no fisherprice unix support - type = - with lib.types; - (enum [ - "x86_64-linux" - "aarch64-linux" - "aarch64-linux-android" - ]); + type = with lib.types; (enum [ + "x86_64-linux" + "aarch64-linux" + "aarch64-linux-android" + ]); example = "aarch64-linux"; description = '' System architecture. ''; }; + systemLocalTime = lib.mkOption { + default = false; + example = true; + description = '' + System time for dualbooting + ''; + }; + + wsl = lib.mkOption { + default = false; + example = true; + description = '' + Runs Nix in wsl + ''; + }; + + secureBoot = lib.mkOption { + default = false; + example = true; + description = '' + enables secure boot. + Note: Secure boot is NOT reproducible + Here are the necessary steps: + + create your keys with sbctl -> sudo sbctl create-keys + + build with systemd once -> set this to false and build once + + build with secureBoot true + + verify that your keys are signed (note, only systemd and your generations should now be signed): sudo sbtcl verify + + enroll your keys (microsoft is necessary for windows dualboot support, leave it there): sudo sbctl enroll-keys --microsoft + + reboot with secureboot enabled + Note: Some motherboards have vendor specific keys for secure boot, this may not necessarily work with our self signed keys + You likely have to disable these vendor specific keys (example HP: sure boot) + ''; + }; + + useSystemdBootloader = lib.mkOption { + default = true; + example = false; + description = '' + use systemd bootloader. + ''; + }; + cpu = lib.mkOption { # TODO: how to enable arm? default = "amd"; - type = - with lib.types; - (enum [ - "amd" - "intel" - ]); + type = with lib.types; (enum [ + "amd" + "intel" + ]); example = "intel"; description = '' cpu microcode. ''; }; - monitor = lib.mkOption { - default = ""; - example = "eDP-1"; - type = lib.types.str; + additionalBootKernalParams = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf str; description = '' - main monitor + additional kernelParams passed to bootloader ''; }; - scale = lib.mkOption { - default = "1.0"; - example = "1.0"; - type = lib.types.str; - description = '' - Scale for the monitor - ''; - }; - - ironbar = { - modules = lib.mkOption { - default = [ ]; - example = [ - { - type = "upower"; - class = "memory-usage"; - } - ]; - type = with lib.types; listOf attrs; - description = '' - Adds modules to ironbar. - ''; - }; - }; - - boot_params = lib.mkOption { - default = [ ]; - example = [ "resume=something" ]; + bootParams = lib.mkOption { + default = []; + example = ["resume=something"]; type = with lib.types; listOf str; description = '' Boot params ''; }; - 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; @@ -104,7 +103,7 @@ }; username = lib.mkOption { - default = "dashie"; + default = "DashNix"; example = "pingpang"; type = lib.types.str; description = '' @@ -130,7 +129,7 @@ ''; }; - nixos-config-path = lib.mkOption { + nixosConfigPath = lib.mkOption { default = "/home/${config.conf.username}/gits/nixos/."; example = "yourpath/."; type = lib.types.str; @@ -139,63 +138,30 @@ ''; }; - nvim-colorscheme = lib.mkOption { - default = { - tokyonight = { - enable = true; - }; - }; - example = { - catppuccin = { - enable = true; - }; - }; - type = lib.types.attrs; - description = '' - nixvim colorscheme. - ''; - }; - - nix_path = lib.mkOption { - default = "/home${config.conf.username}/gits/nixos"; - example = "yourpath"; - type = lib.types.str; - description = '' - The default path for your configuration. - ''; - }; - - kb_layout = lib.mkOption { - default = "dashie"; - example = "us"; - type = lib.types.str; - description = '' - The layout used in services. - ''; - }; - systemStateVersion = lib.mkOption { - default = "unstable"; - example = "24.05"; + example = "24.11"; + default = "23.05"; type = lib.types.str; description = '' - System state version + System state version ''; }; homeStateVersion = lib.mkOption { - default = "24.05"; + default = "24.11"; example = "23.05"; type = lib.types.str; description = '' - Home state version + Home state version ''; }; - }; config = (lib.optionalAttrs (options ? system.stateVersion) { - boot.kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; + boot = { + kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; + kernelParams = config.conf.additionalBootKernalParams; + }; system.stateVersion = config.conf.systemStateVersion; }) // (lib.optionalAttrs (options ? home.stateVersion) { diff --git a/modules/programs/acpid.nix b/modules/programs/acpid.nix index 2c0eeab..228c402 100644 --- a/modules/programs/acpid.nix +++ b/modules/programs/acpid.nix @@ -3,9 +3,7 @@ config, options, ... -}: -{ - +}: { options.mods = { acpid.enable = lib.mkOption { default = false; @@ -18,6 +16,6 @@ }; config = lib.mkIf config.mods.acpid.enable ( - lib.optionalAttrs (options ? virtualisation.virtualbox.host) { services.acpid.enable = true; } + lib.optionalAttrs (options ? virtualisation.virtualbox.host) {services.acpid.enable = true;} ); } diff --git a/modules/programs/anyrun.nix b/modules/programs/anyrun.nix new file mode 100644 index 0000000..b1b7922 --- /dev/null +++ b/modules/programs/anyrun.nix @@ -0,0 +1,145 @@ +{ + mkDashDefault, + lib, + config, + pkgs, + options, + inputs, + ... +}: { + options.mods.anyrun = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables anyrun"; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured anyrun config. + ''; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom anyrun configuration. + Will be merged with default configuration if enabled. + ''; + }; + useDefaultCss = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured anyrun css. + ''; + }; + customCss = lib.mkOption { + default = ''''; + example = '' + #window { + border-radius: none; + } + ''; + type = lib.types.lines; + description = '' + Custom anyrun css. + Will be merged with default css if enabled. + ''; + }; + }; + + config = lib.mkIf config.mods.anyrun.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.anyrun = lib.mkForce { + package = pkgs.anyrun; + enable = true; + config = + if config.mods.anyrun.useDefaultConfig + then + lib.mkMerge + [ + { + plugins = [ + inputs.anyrun.packages.${pkgs.system}.applications + inputs.anyrun.packages.${pkgs.system}.rink + inputs.anyrun.packages.${pkgs.system}.translate + inputs.anyrun.packages.${pkgs.system}.websearch + ]; + hideIcons = mkDashDefault false; + width = { + fraction = mkDashDefault 0.3; + }; + y = { + fraction = mkDashDefault 0.5; + }; + layer = mkDashDefault "overlay"; + hidePluginInfo = mkDashDefault true; + closeOnClick = mkDashDefault true; + } + config.mods.anyrun.customConfig + ] + else config.mods.anyrun.customConfig; + + extraCss = + if config.mods.anyrun.useDefaultCss + then + '' + #window { + border-radius: 10px; + background-color: transparent; + } + + box#main { + border-radius: 10px; + } + + list#main { + border-radius: 10px; + margin: 0px 10px 10px 10px; + } + + list#plugin { + border-radius: 10px; + } + + list#match { + border-radius: 10px; + } + + entry#entry { + border: 0; + border-radius: 10px; + margin: 10px 10px 0px 10px; + } + + label#match-desc { + font-size: 12px; + border-radius: 10px; + } + + label#match-title { + font-size: 12px; + border-radius: 10px; + } + + label#plugin { + font-size: 16px; + border-radius: 10px; + } + + * { + border-radius: 10px; + } + '' + + config.mods.anyrun.customCss + else config.mods.anyrun.customCss; + }; + } + ); +} diff --git a/modules/programs/basePackages.nix b/modules/programs/basePackages.nix new file mode 100644 index 0000000..1d1b2b9 --- /dev/null +++ b/modules/programs/basePackages.nix @@ -0,0 +1,132 @@ +{ + mkDashDefault, + config, + lib, + options, + pkgs, + inputs, + system, + ... +}: { + options.mods = { + basePackages = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables default system packages. + ''; + }; + additionalPackages = lib.mkOption { + default = []; + example = [pkgs.openssl]; + type = with lib.types; listOf package; + description = '' + Additional packages to install. + Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. + ''; + }; + specialPrograms = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + specialServices = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; + }; + }; + + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + if config.mods.basePackages.enable + then + with pkgs; + [ + inputs.statix.packages.${system}.default + adwaita-icon-theme + dbus + dconf + direnv + glib + gnome.nixos-gsettings-overrides + gsettings-desktop-schemas + gtk-layer-shell + gtk3 + gtk4 + gtk4-layer-shell + hicolor-icon-theme + icon-library + kdePackages.breeze-icons + kdePackages.breeze + kdePackages.qtstyleplugin-kvantum + libsForQt5.qtstyleplugin-kvantum + libadwaita + libxkbcommon + alejandra + openssl + seahorse + upower + xorg.xkbutils + sbctl + ] + ++ config.mods.basePackages.additionalPackages + else config.mods.basePackages.additionalPackages; + + gtk.iconCache.enable = mkDashDefault false; + services = + if config.mods.basePackages.enable + then + { + upower.enable = mkDashDefault true; + dbus = { + enable = mkDashDefault true; + }; + avahi = { + enable = mkDashDefault true; + nssmdns4 = mkDashDefault true; + openFirewall = mkDashDefault true; + }; + } + // config.mods.basePackages.specialServices + else config.mods.basePackages.specialServices; + + programs = + if config.mods.basePackages.enable + then + lib.mkMerge + [ + { + nix-ld = { + enable = mkDashDefault true; + libraries = with pkgs; [ + jdk + zlib + ]; + }; + direnv = { + package = mkDashDefault pkgs.direnv; + silent = mkDashDefault false; + loadInNixShell = mkDashDefault true; + direnvrcExtra = mkDashDefault ""; + nix-direnv = { + enable = mkDashDefault true; + package = mkDashDefault pkgs.nix-direnv; + }; + }; + gnupg.agent.enable = mkDashDefault true; + } + config.mods.basePackages.specialPrograms + ] + else config.mods.basePackages.specialPrograms; + }; +} diff --git a/modules/programs/base_packages.nix b/modules/programs/base_packages.nix deleted file mode 100644 index 690af93..0000000 --- a/modules/programs/base_packages.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ - config, - lib, - options, - pkgs, - inputs, - ... -}: -{ - options.mods = { - base_packages = { - default_base_packages = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables default system packages. - ''; - }; - additional_packages = lib.mkOption { - default = [ ]; - example = [ pkgs.openssl ]; - type = with lib.types; listOf package; - description = '' - Additional packages to install. - Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. - ''; - }; - }; - }; - }; - - config = ( - lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = config.mods.base_packages.default_base_packages.additional_packages; - } - // (lib.mkIf config.mods.base_packages.default_base_packages.enable ( - lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = with pkgs; [ - adwaita-icon-theme - dbus - dconf - direnv - glib - gnome.nixos-gsettings-overrides - gsettings-desktop-schemas - gtk-layer-shell - gtk3 - gtk4 - gtk4-layer-shell - hicolor-icon-theme - icon-library - kdePackages.breeze-icons - libadwaita - libxkbcommon - nixfmt-rfc-style - openssl - seahorse - upower - xorg.xkbutils - ]; - - gtk.iconCache.enable = false; - services = { - upower.enable = true; - dbus = { - enable = true; - packages = with pkgs; [ gnome2.GConf ]; - }; - avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - }; - - programs = { - nix-ld = { - enable = true; - libraries = with pkgs; [ - jdk - zlib - ]; - }; - direnv = { - package = pkgs.direnv; - silent = false; - loadInNixShell = true; - direnvrcExtra = ""; - nix-direnv = { - enable = true; - package = pkgs.nix-direnv; - }; - }; - ssh.startAgent = true; - gnupg.agent.enable = true; - }; - } - )) - ); -} diff --git a/modules/programs/bluetooth.nix b/modules/programs/bluetooth.nix index 7818d34..f0e2ef1 100644 --- a/modules/programs/bluetooth.nix +++ b/modules/programs/bluetooth.nix @@ -1,10 +1,10 @@ { + mkDashDefault, lib, config, options, ... -}: -{ +}: { options.mods = { bluetooth.enable = lib.mkOption { default = false; @@ -19,8 +19,8 @@ config = lib.mkIf config.mods.bluetooth.enable ( lib.optionalAttrs (options ? hardware.bluetooth) { hardware.bluetooth = { - enable = true; - powerOnBoot = true; + enable = mkDashDefault true; + powerOnBoot = mkDashDefault true; }; } ); diff --git a/modules/programs/browser/brave.nix b/modules/programs/browser/brave.nix new file mode 100644 index 0000000..404fddd --- /dev/null +++ b/modules/programs/browser/brave.nix @@ -0,0 +1,22 @@ +{ + lib, + config, + options, + pkgs, + ... +}: { + options.mods.browser.brave = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables brave"; + }; + # TODO configure brave + }; + config = lib.mkIf (config.mods.browser.brave.enable || config.mods.homePackages.browser == "brave") ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [brave]; + } + ); +} diff --git a/modules/programs/browser/chromium.nix b/modules/programs/browser/chromium.nix new file mode 100644 index 0000000..5d48046 --- /dev/null +++ b/modules/programs/browser/chromium.nix @@ -0,0 +1,22 @@ +{ + lib, + config, + options, + pkgs, + ... +}: { + options.mods.browser.chromium = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables chromium"; + }; + # TODO configure chromium + }; + config = lib.mkIf (config.mods.browser.chromium.enable || config.mods.homePackages.browser == "chromium") ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [chromium]; + } + ); +} diff --git a/modules/programs/browser/default.nix b/modules/programs/browser/default.nix new file mode 100644 index 0000000..ade4ecf --- /dev/null +++ b/modules/programs/browser/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ + ./brave.nix + ./chromium.nix + ./firefox.nix + ./librewolf.nix + ./zen.nix + ]; +} diff --git a/modules/programs/browser/firefox.nix b/modules/programs/browser/firefox.nix new file mode 100644 index 0000000..d93ac58 --- /dev/null +++ b/modules/programs/browser/firefox.nix @@ -0,0 +1,125 @@ +{ + lib, + dashNixAdditionalProps, + config, + options, + pkgs, + ... +}: let + name = "firefox"; +in { + imports = [ + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) + ]; + options.mods.browser.${name} = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables firefox"; + }; + configuration = lib.mkOption { + default = { + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisplayBookmarksToolbar = "never"; + DisplayMenuBar = "default-off"; + CaptivePortal = false; + DisableFirefoxStudies = true; + DisableTelemetry = true; + DisableFirefoxAccounts = false; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = true; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Firefox policy configuration. See https://mozilla.github.io/policy-templates/ for more information."; + }; + profiles = lib.mkOption { + default = [ + { + name = "${config.conf.username}"; + value = { + isDefault = true; + id = 0; + }; + } + { + name = "special"; + value = { + isDefault = false; + id = 1; + }; + } + ]; + example = [ + { + name = "custom"; + value = { + isDefault = true; + id = 0; + extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader]; + }; + } + ]; + type = with lib.types; listOf (attrsOf anything); + description = "Firefox profiles"; + }; + }; + config = lib.mkIf (config.mods.browser.firefox.enable || config.mods.homePackages.browser == "firefox") ( + lib.optionalAttrs (options ? programs.firefox.profiles) { + stylix.targets.firefox.profileNames = + map ( + {name, ...}: + name + ) + config.mods.browser.firefox.profiles; + programs.firefox = { + enable = true; + package = + pkgs.wrapFirefox + pkgs.firefox-unwrapped + { + pname = "firefox"; + extraPolicies = + config.mods.browser.firefox.configuration + // { + ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.firefox.extensions + ++ ( + if config.mods.browser.firefox.darkreader + then [ + { + "addon@darkreader.org" = { + install_url = "file://${pkgs.callPackage ../../../patches/darkreader.nix {inherit lib dashNixAdditionalProps;}}/latest.xpi"; + installation_mode = "normal_installed"; + }; + } + ] + else [] + )); + }; + }; + profiles = builtins.listToAttrs config.mods.browser.firefox.profiles; + }; + } + ); +} diff --git a/modules/programs/browser/librewolf.nix b/modules/programs/browser/librewolf.nix new file mode 100644 index 0000000..fc74bf3 --- /dev/null +++ b/modules/programs/browser/librewolf.nix @@ -0,0 +1,119 @@ +{ + lib, + dashNixAdditionalProps, + config, + options, + pkgs, + ... +}: let + name = "librewolf"; +in { + imports = [ + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) + ]; + options.mods.browser.${name} = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables the librwolf browser"; + }; + configuration = lib.mkOption { + default = { + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisplayBookmarksToolbar = "never"; + DisplayMenuBar = "default-off"; + CaptivePortal = false; + DisableFirefoxStudies = true; + DisableTelemetry = true; + DisableFirefoxAccounts = false; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = true; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Librewolf policy configuration. See https://mozilla.github.io/policy-templates/ for more information."; + }; + profiles = lib.mkOption { + default = [ + { + name = "${config.conf.username}"; + value = { + isDefault = true; + id = 0; + }; + } + { + name = "special"; + value = { + isDefault = false; + id = 1; + }; + } + ]; + example = [ + { + name = "custom"; + value = { + isDefault = true; + id = 0; + extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader]; + }; + } + ]; + type = with lib.types; listOf (attrsOf anything); + description = "Librewolf profiles"; + }; + }; + config = lib.mkIf (config.mods.browser.librewolf.enable || config.mods.homePackages.browser == "librewolf") ( + lib.optionalAttrs (options ? home.packages) { + programs.librewolf-dashnix = { + enable = true; + package = + pkgs.wrapFirefox + pkgs.librewolf-unwrapped + { + pname = "librewolf"; + extraPolicies = + config.mods.browser.librewolf.configuration + // { + ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.librewolf.extensions + ++ ( + if config.mods.browser.firefox.darkreader + then [ + { + "addon@darkreader.org" = { + install_url = "file://${pkgs.callPackage ../../../patches/darkreader.nix {inherit lib dashNixAdditionalProps;}}/latest.xpi"; + installation_mode = "normal_installed"; + }; + } + ] + else [] + )); + }; + }; + profiles = builtins.listToAttrs config.mods.browser.librewolf.profiles; + }; + } + ); +} diff --git a/modules/programs/browser/zen.nix b/modules/programs/browser/zen.nix new file mode 100644 index 0000000..db32900 --- /dev/null +++ b/modules/programs/browser/zen.nix @@ -0,0 +1,157 @@ +# credits to Voronind for darkreader config https://github.com/voronind-com/nix/blob/main/home/program/firefox/default.nix +{ + lib, + dashNixAdditionalProps, + config, + options, + inputs, + system, + pkgs, + ... +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + name = "zen"; +in { + imports = [ + (import ../../../lib/foxextensions.nix + {inherit lib dashNixAdditionalProps pkgs name;}) + ]; + options.mods.browser.${name} = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables the zen browser"; + }; + configuration = lib.mkOption { + default = { + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + CaptivePortal = false; + DisableFirefoxStudies = true; + DisableTelemetry = true; + NoDefaultBookmarks = true; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = true; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + "3rdparty".Extensions = { + "addon@darkreader.org" = { + theme = { + darkSchemeBackgroundColor = "#${scheme.base00}"; + darkSchemeTextColor = "#${scheme.base05}"; + }; + previewNewDesign = true; + }; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Zen policy configuration. See https://mozilla.github.io/policy-templates for more information."; + }; + profiles = lib.mkOption { + default = [ + { + name = "${config.conf.username}"; + value = { + settings = { + "zen.view.compact.hide-tabbar" = false; + "zen.view.compact.hide-toolbar" = true; + "zen.view.sidebar-expanded" = false; + "zen.view.use-single-toolbar" = false; + "zen.view.welcome-screen.seen" = true; + "zen.theme.accent-color" = "#b4bbff"; + "extensions.autoDisableScopes" = 0; + "cookiebanners.service.mode" = 2; + "widget.use-xdg-desktop-portal.file-picker" = 1; + }; + isDefault = true; + id = 0; + }; + } + { + name = "special"; + value = { + settings = { + "zen.view.compact.hide-tabbar" = false; + "zen.view.compact.hide-toolbar" = true; + "zen.view.sidebar-expanded" = false; + "zen.view.use-single-toolbar" = false; + "zen.view.welcome-screen.seen" = true; + "zen.theme.accent-color" = "#b4bbff"; + "extensions.autoDisableScopes" = 0; + "widget.use-xdg-desktop-portal.file-picker" = 1; + }; + isDefault = false; + id = 1; + }; + } + ]; + example = [ + { + name = "custom"; + value = { + settings = { + extensions.autoDisableScopes = 0; + }; + extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader]; + isDefault = true; + id = 0; + }; + } + ]; + type = with lib.types; listOf (attrsOf anything); + description = "Zen profiles"; + }; + }; + config = lib.mkIf (config.mods.browser.zen.enable || config.mods.homePackages.browser == "zen") ( + (lib.optionalAttrs (options ? home.packages) { + programs.zen-browser = { + enable = true; + package = + pkgs.wrapFirefox + inputs.zen-browser.packages.${system}.zen-browser-unwrapped + { + pname = "zen-browser"; + extraPolicies = + config.mods.browser.zen.configuration + // { + ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.zen.extensions + ++ ( + if config.mods.browser.firefox.darkreader + then [ + { + "addon@darkreader.org" = { + install_url = "file://${pkgs.callPackage ../../../patches/darkreader.nix {inherit lib dashNixAdditionalProps;}}/latest.xpi"; + installation_mode = "normal_installed"; + }; + } + ] + else [] + )); + }; + }; + profiles = builtins.listToAttrs config.mods.browser.zen.profiles; + }; + }) + // (lib.optionalAttrs (options ? stylix.targets.zen-browser) { + stylix.targets.zen-browser.profileNames = lib.map (profile: profile.name) config.mods.browser.zen.profiles; + }) + ); +} diff --git a/modules/programs/clam.nix b/modules/programs/clam.nix new file mode 100644 index 0000000..e212529 --- /dev/null +++ b/modules/programs/clam.nix @@ -0,0 +1,60 @@ +{ + lib, + config, + options, + pkgs, + ... +}: { + options.mods.clam = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables the clamav program and its daemon"; + }; + scanner = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables the clamav scanner"; + }; + interval = lib.mkOption { + type = lib.types.str; + default = "*-*-* 04:00:00"; + description = '' + How often clamdscan is invoked. + By default this runs using 10 cores at most, be sure to run it at a time of low traffic. + ''; + }; + scanDirectories = lib.mkOption { + type = with lib.types; listOf str; + default = [ + "/home" + "/var/lib" + "/tmp" + "/etc" + "/var/tmp" + ]; + description = ''List of directories to scan''; + }; + }; + }; + config = lib.mkIf config.mods.clam.enable ( + lib.optionalAttrs (options ? services.clamav) { + services.clamav = { + daemon.enable = true; + updater.enable = true; + scanner = { + inherit (config.mods.clam.scanner) enable; + inherit (config.mods.clam.scanner) interval; + inherit (config.mods.clam.scanner) scanDirectories; + }; + }; + environment.systemPackages = [ + pkgs.clamav + ]; + } + // lib.optionalAttrs (options ? home.packages) {home.packages = with pkgs; [clamtk];} + ); +} diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index fb5dff7..5a22205 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -1,11 +1,15 @@ { + mkDashDefault, lib, config, pkgs, options, + inputs, + system, ... -}: -{ +}: let + font_family = "${config.mods.stylix.fonts.monospace.name}"; +in { options.mods = { coding = { enable = lib.mkOption { @@ -32,6 +36,102 @@ Enables jetbrains toolbox. ''; }; + vscodium = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables vscodium. + ''; + }; + extensions = lib.mkOption { + default = []; + example = []; + type = with lib.types; listOf package; + description = "Extensions to be installed"; + }; + }; + penpot = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables penpot"; + }; + neovide = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables neovide"; + }; + config = lib.mkOption { + default = { + font = { + size = 12; + normal = { + family = font_family; + style = ""; + }; + bold = { + family = font_family; + style = "ExtraBold"; + }; + italic = { + family = font_family; + style = "Italic"; + }; + bold_italic = { + family = font_family; + style = "Bold Italic"; + }; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Config for neovide"; + }; + }; + gh = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables and configures gh"; + }; + config = lib.mkOption { + default = { + version = 1; + git_protocol = "ssh"; + editor = ""; + prompt = "enabled"; + prefer_editor_prompt = "disabled"; + pager = ""; + aliases = { + co = "pr checkout"; + }; + http_unix_socket = ""; + browser = ""; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config for gh. Keep in mind, empty values refer to using environment variables"; + }; + hosts = lib.mkOption { + default = { + "github.com" = { + git_protocol = "ssh"; + users = { + ${config.mods.git.username} = ""; + }; + user = "${config.mods.git.username}"; + }; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "hosts for gh"; + }; + }; useDefaultPackages = lib.mkOption { default = true; example = false; @@ -39,8 +139,8 @@ description = "Use default base packages (only additionalPackages are installed if false)"; }; additionalPackages = lib.mkOption { - default = [ ]; - example = [ ]; + default = []; + example = []; type = with lib.types; listOf package; description = "Additional packages to be installed"; }; @@ -60,7 +160,7 @@ ghc haskellPackages.haskell-language-server ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' haskell packages @@ -80,9 +180,8 @@ default = with pkgs; [ typst tinymist - ltex-ls ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' typst packages @@ -103,7 +202,7 @@ go gopls ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' Go packages @@ -120,8 +219,8 @@ ''; }; packages = lib.mkOption { - default = with pkgs; [ rustup ]; - example = [ ]; + default = with pkgs; [rustup]; + example = []; type = with lib.types; listOf package; description = '' Rust packages @@ -145,7 +244,7 @@ nodePackages.typescript-language-server nodePackages.prettier ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' TS/JS packages @@ -166,7 +265,7 @@ zig zls ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' zig packages @@ -189,7 +288,7 @@ jdt-language-server temurin-jre-bin ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' Java packages @@ -208,15 +307,17 @@ packages = lib.mkOption { default = with pkgs; [ #.! - dotnet-sdk_8 - omnisharp-roslyn + (with dotnetCorePackages; + combinePackages [ + sdk_8_0 + sdk_9_0 + ]) csharpier netcoredbg - #fsharp fsharp fsautocomplete ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' C#/F# packages @@ -235,10 +336,11 @@ packages = lib.mkOption { default = with pkgs; [ bear + gdb gcc clang-tools ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' C/C++ packages @@ -261,7 +363,7 @@ python312Packages.python-lsp-ruff python312Packages.python-lsp-black ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' python packages @@ -287,7 +389,7 @@ #json jq ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' packages for said filetypes @@ -308,7 +410,7 @@ bash-language-server shfmt ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' bash packages @@ -330,7 +432,7 @@ tailwindcss-language-server # html-tidy ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' html/css packages @@ -351,13 +453,31 @@ nodePackages.sql-formatter sqls ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = '' sql packages ''; }; }; + gleam = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables gleam. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [gleam]; + example = []; + type = with lib.types; listOf package; + description = '' + gleam packages + ''; + }; + }; asm = { enable = lib.mkOption { default = true; @@ -368,8 +488,8 @@ ''; }; packages = lib.mkOption { - default = with pkgs; [ asm-lsp ]; - example = [ ]; + default = with pkgs; [asm-lsp]; + example = []; type = with lib.types; listOf package; description = '' assembly packages @@ -380,35 +500,59 @@ }; }; - config = - let - basePackages = with pkgs; [ - gitui - meson - ninja - tree-sitter - unzip - pkg-config - sqlite - plantuml - d-spy - tmux - tmate - #editors - neovide - #fallback - vscodium - ]; - in + config = let + basePackages = with pkgs; [ + gitui + meson + ninja + tree-sitter + unzip + pkg-config + sqlite + plantuml + d-spy + tmux + tmate + inputs.compose.packages.${system}.default + ]; + in lib.mkIf config.mods.coding.enable ( lib.optionalAttrs (options ? home.packages) { programs.dashvim = lib.mkIf config.mods.coding.dashvim { enable = true; - colorscheme = config.mods.stylix.colorscheme; + inherit (config.mods.stylix) colorscheme; }; - home.packages = - with pkgs; - [ (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) ] + programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { + enable = true; + package = mkDashDefault pkgs.vscodium; + profiles.default.extensions = config.mods.coding.vscodium.extensions; + }; + xdg.configFile = { + "neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { + source = + (pkgs.formats.toml {}).generate "neovide" + config.mods.coding.neovide.config; + }; + + "gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "config" + config.mods.coding.gh.config; + }; + "gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "hosts" + config.mods.coding.gh.hosts; + }; + }; + + home.packages = with pkgs; + [ + (lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) neovide) + (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) + (lib.mkIf config.mods.coding.penpot pkgs.penpot-desktop) + (lib.mkIf config.mods.coding.gh.enable gh) + ] ++ config.mods.coding.additionalPackages ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) @@ -424,7 +568,8 @@ ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) - ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages); + ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages) + ++ (lib.lists.optionals config.mods.coding.languages.gleam.enable config.mods.coding.languages.gleam.packages); } ); } diff --git a/modules/programs/containers.nix b/modules/programs/containers.nix new file mode 100644 index 0000000..b62ee25 --- /dev/null +++ b/modules/programs/containers.nix @@ -0,0 +1,79 @@ +{ + mkDashDefault, + lib, + config, + options, + pkgs, + ... +}: { + options.mods.containers = { + variant = lib.mkOption { + default = ""; + example = "podman"; + type = lib.types.enum [ + "" + "podman" + "docker" + ]; + description = "Enables and configures a containerization solution: podman/docker"; + }; + podmanPackages = lib.mkOption { + default = with pkgs; [ + podman-tui + podman-compose + ]; + example = []; + type = with lib.types; listOf package; + description = "Podman packages"; + }; + dockerPackages = lib.mkOption { + default = with pkgs; [ + docker-compose + ]; + example = []; + type = with lib.types; listOf package; + description = "Docker packages"; + }; + combinedPackages = lib.mkOption { + default = with pkgs; [ + dive + ]; + example = []; + type = with lib.types; listOf package; + description = "Container packages"; + }; + }; + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + (lib.lists.optionals ( + config.mods.containers.variant == "podman" + ) + config.mods.containers.podmanPackages) + ++ (lib.lists.optionals ( + config.mods.containers.variant == "docker" + ) + config.mods.containers.dockerPackages) + ++ (lib.lists.optionals ( + config.mods.containers.variant == "podman" || config.mods.containers.variant == "docker" + ) + config.mods.containers.combinedPackages); + virtualisation = + if (config.mods.containers.variant == "podman") + then { + containers.enable = true; + podman = { + enable = true; + dockerCompat = mkDashDefault true; + defaultNetwork.settings.dns_enabled = mkDashDefault true; + }; + } + else if (config.mods.containers.variant == "docker") + then { + containers.enable = true; + docker = { + enable = true; + }; + } + else {}; + }; +} diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 4a968be..08a4a2d 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -1,40 +1,54 @@ { imports = [ ./acpid.nix - ./base_packages.nix + ./anyrun.nix + ./basePackages.nix ./bluetooth.nix + ./browser + ./clam.nix ./coding.nix + ./containers.nix ./drives.nix - ./firefox.nix + ./fancontrol.nix + ./fastfetch.nix ./fish.nix ./flatpak.nix ./gaming.nix ./gdm.nix ./git.nix ./gnome.nix - ./gnome_services.nix + ./gnomeServices.nix ./gpu.nix ./greetd.nix - ./home_packages.nix - ./hyprland + ./homePackages.nix + ./hypr + ./ironbar.nix ./kde.nix - ./kde_connect.nix + ./kdeConnect.nix ./keepassxc.nix ./kitty.nix ./media.nix + ./mime.nix ./ncspot.nix ./nextcloud.nix + ./niri.nix + ./onedrive.nix ./oxi ./piper.nix - ./podman.nix + ./plymouth.nix ./printing.nix ./scripts.nix ./sddm.nix ./sops.nix ./starship.nix + ./streamcontroller.nix ./stylix.nix + ./superfreq.nix + ./supersonic.nix + ./sway.nix ./teams.nix - ./virtualbox.nix + ./virtmanager.nix + ./wm.nix ./xkb.nix ./xone.nix ./yazi diff --git a/modules/programs/drives.nix b/modules/programs/drives.nix index 579ed70..a631802 100644 --- a/modules/programs/drives.nix +++ b/modules/programs/drives.nix @@ -3,134 +3,310 @@ config, options, ... -}: -let - - driveModule = lib.types.submodule { - options = { - name = lib.mkOption { - type = lib.types.str; +}: { + options.mods.drives = { + variant = lib.mkOption { + default = "manual"; + example = "disko"; + type = with lib.types; (enum [ + "manual" + "disko" + ]); + description = '' + Disk configuration type, either "manual" for regular NixOS disk configuration, + or "disko" for using disko to automatically format your drives. + ''; + }; + useSwap = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use swap in drive. + ''; + }; + useEncryption = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables encryption. + !WARNING! + You need your root drive to be named root exactly! + Otherwise there will not be a root crypt! + !WARNING! + ''; + }; + homeAndRootFsTypes = lib.mkOption { + default = "ext4"; + example = "btrfs"; + type = with lib.types; (enum [ + "btrfs" + "ext2" + "ext3" + "ext4" + "exfat" + "f2fs" + "fat8" + "fat16" + "fat32" + "ntfs" + "xfs" + "zfs" + ]); + description = '' + Filesystem for the home and root partitions. + ''; + }; + defaultDrives = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; description = '' - The path of the drive. - Note that a / is already added at the beginning. + Use default drive config. + + - Manual variant + This config expects 4 different partitions on a single drive: + - boot partition with BOOT label and vfat format (filesystem configurable) + - swap partition with SWAP label + - root partition with ROOT label and ext4 format (filesystem configurable) + - home partition with HOME label and ext4 format (filesystem configurable) + - gpt disk format + + NOTE: Any different configuration must be done manually with this turned off. + + - Disko variant + This config creates 4 different partitions on a single drive: + - boot partition with 1GB size and vfat format + - swap partition with 32GB (size configurable) + - root partition with 30% size and ext4 format (size and filesystem configurable) + - home partition with 70%~ size and ext4 format (size and filesystem configurable) + - gpt disk format + + NOTE: Any different configuration must be done manually with this turned off. ''; - default = ""; - example = "drive2"; }; - drive = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - description = "The attrs of the drive"; - default = { }; - example = { - device = "/dev/disk/by-label/DRIVE2"; - fsType = "ext4"; + }; + extraDrives = lib.mkOption { + default = [ + ]; + example = [ + { + name = "drive2"; + drive = { + device = "/dev/disk/by-label/DRIVE2"; + fsType = "ext4"; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + } + ]; + type = with lib.types; listOf (attrsOf anything); + description = '' + Extra drives to add. + Please ensure to add variant compliant attrsets (manual/disko). + (The example is for manual variant, here an example for disko): + ```nix + drive2 = (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { + device = "/dev/nvme1n1" + type = "disk"; + content = { + type = "gpt"; + partitions = { + drive2 = { + start = "0%"; + end = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/drive2"; + mountOptions = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + }; + }; + }; + }; + ``` + ''; + }; + disko = { + defaultDiskId = lib.mkOption { + default = "TODO"; + example = "/dev/nvme0n1"; + type = lib.types.str; + description = "The name, ID, UUID or similar for the default drive."; + }; + rootAmount = lib.mkOption { + default = 30; + example = 40; + type = lib.types.number; + description = "The percentage of the disk for root. (Home will take up the rest) (Only for disko)"; + }; + swapAmount = lib.mkOption { + default = 32; + example = 64; + type = lib.types.number; + description = "The amount of swap to use. (Only for disko)"; + }; + }; + }; + + config = lib.optionalAttrs (options ? fileSystems) { + boot.initrd.luks.devices = lib.mkIf (config.mods.drives.variant == "manual" && config.mods.drives.useEncryption) ( + builtins.listToAttrs ( + map ( + { + name, + drive, + }: { + cryptstorage.device = lib.mkIf (name != "root") drive?device; + cryptoroot.device = lib.mkIf (name == "root") drive?device; + } + ) + config.mods.drives.extraDrives + ) + ); + + fileSystems = lib.mkIf (config.mods.drives.variant == "manual" && !config.conf.wsl) ( + builtins.listToAttrs ( + map ( + { + name, + drive, + }: { + name = "/" + name; + value = drive; + } + ) + config.mods.drives.extraDrives + ) + // (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { + "/" = { + device = "/dev/disk/by-label/ROOT"; + fsType = config.mods.drives.homeAndRootFsTypes; options = [ "noatime" "nodiratime" "discard" ]; }; - }; - }; - }; -in -{ - options.mods = { - drives = { - useSwap = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use default drive config - ''; - }; - }; - defaultDrives = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use default drive config - ''; - }; - }; - extraDrives = lib.mkOption { - default = [ - ]; - example = [ - { - name = "drive2"; - drive = { - device = "/dev/disk/by-label/DRIVE2"; - fsType = "ext4"; - options = [ - "noatime" - "nodiratime" - "discard" - ]; + "/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + options = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; + }; + + "/home" = { + device = "/dev/disk/by-label/HOME"; + fsType = config.mods.drives.homeAndRootFsTypes; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + } + ); + + swapDevices = lib.mkIf (config.mods.drives.useSwap && config.mods.drives.variant == "manual" && !config.conf.wsl) [ + {device = "/dev/disk/by-label/SWAP";} + ]; + + disko.devices = lib.mkIf (config.mods.drives.variant == "disko") { + disk = + { + main = (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { + device = "${config.mods.drives.disko.defaultDiskId}"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + root = { + start = "${ + if config.mods.drives.useSwap + then builtins.toString config.mods.drives.disko.swapAmount + else builtins.toString 1 + }G"; + end = "${builtins.toString config.mods.drives.disko.rootAmount}%"; + content = { + type = "filesystem"; + format = config.mods.drives.homeAndRootFsTypes; + mountpoint = "/"; + mountOptions = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + }; + plainSwap = { + start = "1G"; + end = "33G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; + }; + }; + boot = { + start = "0G"; + end = "1G"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; + }; + }; + home = { + start = "${builtins.toString config.mods.drives.disko.rootAmount}%"; + end = "100%"; + content = { + type = "filesystem"; + format = config.mods.drives.homeAndRootFsTypes; + mountpoint = "/home"; + mountOptions = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + }; + }; }; - } - ]; - # TODO: how to make this work - # type = with lib.types; listOf (attrsOf driveModule); - type = with lib.types; listOf (attrsOf anything); - description = '' - Extra drives to add. - ''; - }; - }; - }; - - config = ( - lib.optionalAttrs (options ? fileSystems) { - fileSystems = - builtins.listToAttrs ( + }; + } + // builtins.listToAttrs ( map ( - { name, drive }: { + name, + drive, + }: { name = "/" + name; value = drive; } - ) config.mods.drives.extraDrives - ) - // (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { - "/" = { - device = "/dev/disk/by-label/ROOT"; - fsType = "btrfs"; - options = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - - "/boot" = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ - "rw" - "fmask=0022" - "dmask=0022" - "noatime" - ]; - }; - - "/home" = { - device = "/dev/disk/by-label/HOME"; - fsType = "btrfs"; - options = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - }; - # TODO make this convert to choice of drives -> thanks to funny types this doesn't work... - swapDevices = lib.mkIf config.mods.drives.useSwap.enable [ { device = "/dev/disk/by-label/SWAP"; } ]; - } - ); + ) + config.mods.drives.extraDrives + ); + }; + }; } diff --git a/modules/programs/fancontrol.nix b/modules/programs/fancontrol.nix new file mode 100644 index 0000000..8abf24d --- /dev/null +++ b/modules/programs/fancontrol.nix @@ -0,0 +1,37 @@ +{ + lib, + pkgs, + config, + options, + ... +}: { + options.mods.fancontrol = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables fancontrol-gui with needed drivers"; + }; + forceId = lib.mkOption { + default = null; + example = "force_id=0x8628"; + type = with lib.types; nullOr str; + description = "Modprobe options for the it87 driver. Information at: https://wiki.archlinux.org/title/Lm_sensors#Gigabyte_B250/Z370/B450M/B560M/B660M/Z690/B550_motherboards"; + }; + }; + config = lib.mkIf config.mods.fancontrol.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = [pkgs.fancontrol-gui]; + } + // (lib.optionalAttrs (options ? boot.kernelModules) { + boot = { + kernelParams = ["acpi_enforce_resources=lax"]; + extraModulePackages = with config.boot.kernelPackages; [liquidtux it87]; + kernelModules = ["v4l2loopback" "it87"]; + extraModprobeConfig = lib.mkIf (config.mods.fancontrol.forceId != null) '' + options it87 ${config.mods.fancontrol.forceId} + ''; + }; + }) + ); +} diff --git a/modules/programs/fastfetch.nix b/modules/programs/fastfetch.nix new file mode 100644 index 0000000..9953d84 --- /dev/null +++ b/modules/programs/fastfetch.nix @@ -0,0 +1,75 @@ +{ + pkgs, + lib, + options, + config, + ... +}: { + options.mods.dashfetch = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "A custom configuration for fastfetch"; + }; + modules = lib.mkOption { + default = [ + "title" + "separator" + { + type = "os"; + key = "OS"; + format = "DashNix ({name} {version})"; + } + "host" + "kernel" + "uptime" + "packages" + "shell" + "display" + "de" + "wm" + "wmtheme" + "theme" + "icons" + "font" + "cursor" + "terminal" + "terminalfont" + "cpu" + "gpu" + "memory" + "swap" + "disk" + "localip" + "battery" + "poweradapter" + "locale" + "break" + "colors" + ]; + example = []; + type = with lib.types; listOf anything; + description = "modules for fastfetch"; + }; + }; + + config = lib.optionalAttrs (options ? home.packages) { + xdg.configFile."fastfetch/config.jsonc" = lib.mkIf config.mods.dashfetch.enable { + source = + (pkgs.formats.json {}).generate "config.jsonc" + { + "$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"; + logo = { + type = "kitty"; + source = ../../assets/logo2.png; + width = 35; + padding = { + top = 1; + }; + }; + modules = config.mods.dashfetch.modules; + }; + }; + }; +} diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix deleted file mode 100644 index d3305da..0000000 --- a/modules/programs/firefox.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ - lib, - config, - options, - pkgs, - ... -}: -{ - options.mods.firefox = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables firefox"; - }; - configuration = lib.mkOption { - default = { - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - DisplayBookmarksToolbar = "never"; - DisplayMenuBar = "default-off"; - CaptivePortal = false; - DisableFirefoxStudies = true; - DisableTelemetry = true; - DisableFirefoxAccounts = false; - NoDefaultBookmarks = true; - OfferToSaveLogins = false; - OfferToSaveLoginsDefault = false; - PasswordManagerEnabled = false; - FirefoxHome = { - Search = true; - Pocket = false; - Snippets = false; - TopSites = true; - Highlights = false; - }; - UserMessaging = { - ExtensionRecommendations = false; - SkipOnboarding = true; - }; - }; - example = { }; - type = with lib.types; attrsOf anything; - description = "Firefox policy configuration"; - }; - extensions = lib.mkOption { - default = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - darkreader - privacy-badger - vimium - keepassxc-browser - i-dont-care-about-cookies - tokyo-night-v2 - ]; - example = [ ]; - type = with lib.types; listOf package; - description = "Firefox extensions (from nur)"; - }; - }; - config = lib.mkIf config.mods.firefox.enable ( - lib.optionalAttrs (options ? programs.firefox.profiles) { - programs.firefox = { - enable = true; - policies = config.mods.firefox.configuration; - profiles.${config.conf.username} = { - isDefault = true; - id = 0; - extensions = config.mods.firefox.extensions; - }; - profiles."special" = { - isDefault = false; - id = 1; - extensions = config.mods.firefox.extensions; - }; - }; - } - ); -} diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 8c702bd..1d8c8c8 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -1,10 +1,14 @@ { lib, + pkgs, + inputs, config, options, ... -}: -{ +}: let + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; +in { options.mods.fish = { enable = lib.mkOption { default = true; @@ -30,7 +34,8 @@ programs.fish = { enable = true; shellInit = - if config.mods.fish.useDefaultConfig then + if config.mods.fish.useDefaultConfig + then '' if status is-interactive # Commands to run in interactive sessions can go here @@ -41,17 +46,21 @@ # Utility functions for zoxide. # - export NIX_PATH="$NIX_PATH:${config.conf.nixos-config-path}" + export NIX_PATH="$NIX_PATH:${config.conf.nixosConfigPath}" set EDITOR "neovide --no-fork" - alias rebuild='sudo nixos-rebuild switch --flake ${config.conf.nixos-config-path}' + alias rebuild='nh os switch -- --accept-flake-config' + alias update='nix flake update --flake $FLAKE --accept-flake-config' + alias gcli='gh' abbr --add ls 'lsd' abbr --add :q 'exit' abbr --add gh 'git push origin' + abbr --add gu 'git push upstream' abbr --add gl 'git pull origin' abbr --add gm 'git commit -m' abbr --add ga "git add -A" + abbr --add gc "git commit --amend --no-edit" abbr --add g+ 'bear -- g++ -Wextra -Werror -std=c++20' abbr --add s "kitty +kitten ssh" abbr --add zl 'z "" ' @@ -61,6 +70,13 @@ abbr --add cat 'bat' abbr --add find 'fd' abbr --add rm 'rip' + abbr --add cp 'cpz' + abbr --add cd 'z' + abbr --add y 'yazi' + + set fish_color_autosuggestion '${scheme.base07}' + set fish_color_param '${scheme.base06}' + set fish_color_operator '${scheme.base0E}' set fish_greeting # pwd based on the value of _ZO_RESOLVE_SYMLINKS. @@ -167,8 +183,7 @@ direnv hook fish | source '' + config.mods.fish.additionalConfig - else - config.mods.fish.additionalConfig; + else config.mods.fish.additionalConfig; }; } ); diff --git a/modules/programs/flatpak.nix b/modules/programs/flatpak.nix index 3ffd068..68ec2da 100644 --- a/modules/programs/flatpak.nix +++ b/modules/programs/flatpak.nix @@ -4,39 +4,18 @@ options, pkgs, ... -}: -{ +}: { options.mods.flatpak = { enable = lib.mkOption { - default = true; - example = false; + default = false; + example = true; type = lib.types.bool; description = "Enables the flatpak package manager"; }; - additional_packages = lib.mkOption { - default = [ ]; - example = [ ]; - type = with lib.types; listOf str; - description = "Flatpak packages"; - }; }; config = lib.mkIf config.mods.flatpak.enable ( - lib.optionalAttrs (options ? services.flatpak.remote) { - environment.systemPackages = [ pkgs.flatpak ]; - services.flatpak.remotes = lib.mkOptionDefault [ - { - name = "flathub-stable"; - location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; - } - ]; - services.flatpak.uninstallUnmanaged = true; - } - // lib.optionalAttrs (options ? services.flatpak.packages) { - services.flatpak.packages = [ - # fallback if necessary, but generally avoided as nix is superior :) - # default flatseal installation since flatpak permissions are totally not a broken idea - "com.github.tchx84.Flatseal" - ] ++ config.mods.flatpak.additional_packages; + lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = [pkgs.flatpak]; } ); } diff --git a/modules/programs/gaming.nix b/modules/programs/gaming.nix index 29ea71c..6c3eb0a 100644 --- a/modules/programs/gaming.nix +++ b/modules/programs/gaming.nix @@ -1,11 +1,11 @@ { + mkDashDefault, lib, config, options, pkgs, ... -}: -{ +}: { options.mods.gaming = { enable = lib.mkOption { default = false; @@ -15,22 +15,33 @@ }; tools = lib.mkOption { default = with pkgs; [ + protonplus + gamescope gamemode steam - lutris - wine + # TODO broken + # lutris + wineWowPackages.stable adwsteamgtk heroic + mangohud + nexusmods-app + steamtinkerlaunch + winetricks ]; - example = [ ]; + example = []; type = with lib.types; listOf package; description = "Install gaming related packages"; }; kernel = lib.mkOption { - default = true; - example = false; + default = false; + example = true; type = lib.types.bool; - description = "Whether to use the xanmod kernel"; + description = '' + Whether to use the CachyOS kernel. + WARNING: This is a manual compiled kernel! + (Please also ensure you use your own input hash for the source as the compilation can often fail due to temporary broken changes.) + ''; }; steam = lib.mkOption { default = true; @@ -44,42 +55,91 @@ type = lib.types.bool; description = "Whether to use gamemode"; }; - gpu_optimization = lib.mkOption { + pinCores = lib.mkOption { + default = "false"; + example = "true"; + type = lib.types.str; + description = "Pin Cores gamemode config"; + }; + parkCores = lib.mkOption { + default = "false"; + example = "true"; + type = lib.types.str; + description = "Park Cores gamemode config"; + }; + gpuOptimization = lib.mkOption { default = true; example = false; type = lib.types.bool; description = "Whether to use GPU performance setting. NOTE: this is at your own risk!"; }; - gpu_device = lib.mkOption { + gpuDevice = lib.mkOption { default = 0; example = 1; type = lib.types.int; description = "Your gpu device.(Physical id of lshw)"; }; + scheduler = lib.mkOption { + default = "scx_rustland"; + example = "scx_rusty"; + type = with lib.types; + nullOr (enum [ + "scx_bpfland" + "scx_chaos" + "scx_cosmos" + "scx_central" + "scx_flash" + "scx_flatcg" + "scx_lavd" + "scx_layered" + "scx_mitosis" + "scx_nest" + "scx_p2dq" + "scx_pair" + "scx_prev" + "scx_qmap" + "scx_rlfifo" + "scx_rustland" + "scx_rusty" + "scx_sdt" + "scx_simple" + "scx_tickless" + "scx_userland" + "scx_wd40" + ]); + description = "Scheduler to use, null disables this"; + }; }; config = lib.mkIf config.mods.gaming.enable ( lib.optionalAttrs (options ? environment.systemPackages) { environment.systemPackages = config.mods.gaming.tools; - boot.kernelPackages = lib.mkForce pkgs.linuxPackages_xanmod_latest; + boot.kernelPackages = lib.mkForce pkgs.cachyosKernels.linuxPackages-cachyos-latest; + services.scx = lib.mkIf (config.mods.gaming.scheduler != null) { + enable = true; + inherit (config.mods.gaming) scheduler; + }; programs = { - steam.enable = config.mods.gaming.steam; + steam.enable = mkDashDefault config.mods.gaming.steam; gamemode.enable = true; gamemode = { - enableRenice = true; settings = { general = { - governor = "performance"; + desiredgov = mkDashDefault "performance"; }; - gpu = lib.mkIf config.mods.gaming.gpu_optimization { - apply_gpu_optimisations = "accept-responsibility"; - gpu_device = config.mods.gaming.gpu_device; - amd_performance_level = "high"; - nv_powermizer_mode = 1; + cpu = { + pin_cores = mkDashDefault config.mods.gaming.pinCores; + park_cores = mkDashDefault config.mods.gaming.parkCores; + }; + gpu = lib.mkIf config.mods.gaming.gpuOptimization { + apply_gpu_optimisations = mkDashDefault "accept-responsibility"; + gpu_device = mkDashDefault config.mods.gaming.gpuDevice; + amd_performance_level = mkDashDefault "high"; + nv_powermizer_mode = mkDashDefault 1; }; custom = { - start = "notify-send -a 'Gamemode' 'Optimizations activated'"; - end = "notify-send -a 'Gamemode' 'Optimizations deactivated'"; + start = mkDashDefault "notify-send -a 'Gamemode' 'Optimizations activated'"; + end = mkDashDefault "notify-send -a 'Gamemode' 'Optimizations deactivated'"; }; }; }; diff --git a/modules/programs/gdm.nix b/modules/programs/gdm.nix index 2bb3e47..343c6cd 100644 --- a/modules/programs/gdm.nix +++ b/modules/programs/gdm.nix @@ -3,8 +3,7 @@ options, config, ... -}: -{ +}: { options.mods.gdm = { enable = lib.mkOption { default = false; @@ -13,8 +12,8 @@ description = "Enables the gdm displayManager"; }; extraOptions = lib.mkOption { - default = { }; - example = { }; + default = {}; + example = {}; type = with lib.types; attrsOf anything; description = "Extra options to be applied to the gnome config"; }; diff --git a/modules/programs/git.nix b/modules/programs/git.nix index e105cb7..57c1623 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -2,68 +2,63 @@ lib, config, options, - pkgs, ... -}: -{ +}: { options.mods.git = { username = lib.mkOption { - default = "DashieTM"; + default = ""; example = "globi"; type = lib.types.str; description = "Git user name"; }; email = lib.mkOption { - default = "fabio.lenherr@gmail.com"; + default = ""; example = "globi@globus.glob"; type = lib.types.str; description = "Git email"; }; - ssh_config = lib.mkOption { - default = '' + additionalConfig = lib.mkOption { + default = { + merge = { + tool = "nvimdiff"; + }; + diff = { + tool = "nvimdiff"; + }; + pull.rebase = true; + }; + example = { + pull.rebase = false; + }; + type = with lib.types; attrsOf anything; + description = "Additional git config"; + }; + sshConfig = lib.mkOption { + default = ""; + example = '' Host github.com ${ - if (config ? sops.secrets && config.sops.secrets ? hub.path) then - "IdentityFile ${config.sops.secrets.hub.path}" - else - "" - } - Host gitlab.com - ${ - if (config ? sops.secrets && config.sops.secrets ? lab.path) then - "IdentityFile ${config.sops.secrets.lab.path}" - else - "" - } - Host dashie.org - ${ - if (config ? sops.secrets && config.sops.secrets ? dashie.path) then - "IdentityFile ${config.sops.secrets.dashie.path}" - else - "" - } + if (config ? sops.secrets && config.sops.secrets ? hub.path) + then "IdentityFile ${config.sops.secrets.hub.path}" + else "" + } ''; - example = ""; type = lib.types.lines; description = "ssh configuration (keys for git)"; }; }; - config = ( - lib.optionalAttrs (options ? programs.git && options ? home.file) { - programs.git = { - enable = true; - userName = config.mods.git.username; - userEmail = config.mods.git.email; - extraConfig = { - merge = { - tool = "nvimdiff"; + config = lib.optionalAttrs (options ? programs.git && options ? home.file) { + programs.git = { + enable = true; + settings = + { + user = { + name = config.mods.git.username; + inherit (config.mods.git) email; }; - diff = { - tool = "nvimdiff"; - }; - }; - }; - home.file.".ssh/config".text = config.mods.git.ssh_config; - } - ); + } + // config.mods.git.additionalConfig; + }; + home.file.".ssh/config".text = config.mods.git.sshConfig; + }; } diff --git a/modules/programs/gnome.nix b/modules/programs/gnome.nix index a4f0921..faf2b1e 100644 --- a/modules/programs/gnome.nix +++ b/modules/programs/gnome.nix @@ -4,8 +4,7 @@ config, pkgs, ... -}: -{ +}: { options.mods.gnome = { enable = lib.mkOption { default = false; @@ -20,27 +19,26 @@ description = "Use default options provided by module. If disabled, will only apply extraOptions."; }; extraOptions = lib.mkOption { - default = { }; - example = { }; + default = {}; + example = {}; type = with lib.types; attrsOf anything; description = "Extra options to be applied to the gnome config"; }; extraDconf = lib.mkOption { - default = { }; - example = { }; + default = {}; + example = {}; type = with lib.types; attrsOf anything; description = "Extra options to be applied to the dconf config"; }; }; - config = - let - defaultExtensions = with pkgs.gnomeExtensions; [ - blur-my-shell - dash-to-dock - tray-icons-reloaded - ]; - in + config = let + defaultExtensions = with pkgs.gnomeExtensions; [ + blur-my-shell + dash-to-dock + tray-icons-reloaded + ]; + in lib.mkIf config.mods.gnome.enable ( lib.optionalAttrs (options ? services.xserver.desktopManager.gnome) ( { @@ -49,7 +47,7 @@ desktopManager.gnome.enable = true; }; } - // lib.mkIf config.mods.gnome.useDefaultOptions { environment.systemPackages = defaultExtensions; } + // lib.mkIf config.mods.gnome.useDefaultOptions {environment.systemPackages = defaultExtensions;} // { services.xserver.desktopManager.gnome = config.mods.gnome.extraOptions; } @@ -63,6 +61,11 @@ disable-user-extensions = false; enabled-extensions = map (extension: extension.extensionUuid) defaultExtensions; }; + "org/gnome/desktop/interface" = { + cursor-theme = config.mods.stylix.cursor.name; + cursor-size = config.mods.stylix.cursor.size; + color-scheme = "prefer-dark"; + }; }; }; } diff --git a/modules/programs/gnomeServices.nix b/modules/programs/gnomeServices.nix new file mode 100644 index 0000000..29bdea8 --- /dev/null +++ b/modules/programs/gnomeServices.nix @@ -0,0 +1,81 @@ +{ + lib, + config, + options, + pkgs, + ... +}: { + options.mods = { + gnomeServices.enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables gnome services: keyring and settings daemon. + Note: Do not use these for environments which ship these functionalities by default: GNOME, KDE + ''; + }; + nautilus.enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables and configures Nautilus + ''; + }; + }; + + config = lib.mkIf config.mods.gnomeServices.enable ( + lib.optionalAttrs (options ? services.gnome.gnome-keyring) { + programs.dconf = { + enable = true; + profiles.user.databases = [ + { + settings = { + "org/gnome/desktop/interface" = { + cursor-theme = config.mods.stylix.cursor.name; + cursor-size = lib.gvariant.mkInt32 config.mods.stylix.cursor.size; + color-scheme = "prefer-dark"; + }; + }; + } + ]; + }; + environment.extraInit = '' + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh" + ''; + services = { + # needed for GNOME services outside of GNOME Desktop + dbus.packages = with pkgs; [ + gcr + gnome-settings-daemon + ]; + + gnome.gnome-keyring.enable = true; + gvfs.enable = true; + }; + } + // lib.optionalAttrs (options ? home.packages) { + services.gnome-keyring.enable = true; + dconf.settings = { + "org/gnome/desktop/interface" = { + cursor-theme = config.mods.stylix.cursor.name; + cursor-size = config.mods.stylix.cursor.size; + color-scheme = "prefer-dark"; + }; + }; + home = { + packages = let + packages = with pkgs; [ + gcr + nautilus + sushi + nautilus-python + nautilus-open-any-terminal + ]; + in + lib.mkIf config.mods.nautilus.enable packages; + }; + } + ); +} diff --git a/modules/programs/gnome_services.nix b/modules/programs/gnome_services.nix deleted file mode 100644 index cebbad1..0000000 --- a/modules/programs/gnome_services.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - lib, - config, - options, - pkgs, - ... -}: -{ - options.mods = { - gnome_services.enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables gnome services: keyring and settings daemon. - Note: Do not use these for environments which ship these functionalities by default: GNOME, KDE - ''; - }; - nautilus.enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables and configures Nautilus - ''; - }; - }; - - config = lib.mkIf config.mods.gnome_services.enable ( - lib.optionalAttrs (options ? services.gnome.gnome-keyring) { - programs.dconf.enable = true; - services = { - # needed for GNOME services outside of GNOME Desktop - dbus.packages = with pkgs; [ - gcr - gnome.gnome-settings-daemon - ]; - - gnome.gnome-keyring.enable = true; - gvfs.enable = true; - }; - } - // lib.optionalAttrs (options ? home.packages) { - home.packages = - let - packages = with pkgs; [ - nautilus - sushi - nautilus-python - ]; - in - lib.mkIf config.mods.nautilus.enable packages; - } - ); -} diff --git a/modules/programs/gpu.nix b/modules/programs/gpu.nix index 69592a2..023b462 100644 --- a/modules/programs/gpu.nix +++ b/modules/programs/gpu.nix @@ -1,104 +1,111 @@ { + mkDashDefault, lib, config, options, pkgs, ... -}: -{ - - options.mods = { - gpu = { - nvidia.enable = lib.mkOption { - default = false; - example = true; +}: { + options.mods.gpu = { + nvidia.enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables nvidia support. + ''; + }; + amdgpu.enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables amdgpu support. + ''; + }; + intelgpu.enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables intel support. + ''; + }; + vapi = { + enable = lib.mkOption { + default = true; + example = false; type = lib.types.bool; description = '' - Enables nvidia support. + Enables vapi. ''; }; - amdgpu.enable = lib.mkOption { + rocm.enable = lib.mkOption { default = false; - example = true; type = lib.types.bool; - description = '' - Enables amdgpu support. - ''; - }; - intelgpu.enable = lib.mkOption { - default = false; example = true; - type = lib.types.bool; description = '' - Enables intel support. + Enables rocm support. ''; }; - vapi = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enables vapi. - ''; - }; - rocm.enable = lib.mkOption { - default = false; - type = lib.types.bool; - example = true; - description = '' - Enables rocm support. - ''; - }; - }; }; }; - config = - (lib.optionalAttrs (options ? hardware.graphics) { - boot = lib.mkIf config.mods.amdgpu.enable { - kernelModules = [ "kvm-amd" ]; - initrd.kernelModules = [ "amdgpu" ]; - kernelParams = [ "amdgpu.ppfeaturemask=0xffffffff" ]; - }; + config = lib.optionalAttrs (options ? boot) { + boot = lib.mkIf config.mods.gpu.amdgpu.enable { + kernelModules = ["kvm-amd"]; + initrd.kernelModules = ["amdgpu"]; + kernelParams = ["amdgpu.ppfeaturemask=0xffffffff"]; + }; + services.xserver.videoDrivers = + if config.mods.gpu.amdgpu.enable + then ["amdgpu"] + else if config.mods.gpu.nvidia.enable + then ["nvidia"] + else []; - hardware = { - graphics = - let - amdPackages = [ - (lib.mkIf (config.mods.gpu.intelgpu && lib.mkIf config.mods.gpu.vapi.enable) pkgs.vpl-gpu-rt) - (lib.mkIf ( - config.mods.gpu.intelgpu && lib.mkIf config.mods.gpu.vapi.enable - ) pkgs.intel-media-driver) - (lib.mkIf config.mods.gpu.vapi.enable pkgs.libvdpau-va-gl) - (lib.mkIf config.mods.gpu.vapi.enable pkgs.vaapiVdpau) - (lib.mkIf (config.mods.gpu.intelgpu || config.mods.gpu.amdgpu) pkgs.mesa.drivers) - ]; - rocmPackages = [ - pkgs.rocmPackages.clr.icd - pkgs.rocm-opencl-runtime - ]; - in - { - enable = true; - enable32Bit = lib.mkDefault true; - extraPackages = - amdPackages - ++ (lib.lists.optionals (config.mods.gpu.vapi.rocm.enable && config.mods.gpu.amdgpu) rocmPackages); - }; - }; - }) - // lib.optionalAttrs (options ? hardware.graphics) ( - lib.mkIf config.mods.gpu.nvidia.enable { - hardware.nvidia = { - modesetting.enable = true; - # powerManagement.enable = false; - # powerManagement.finegrained = true; - open = true; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.beta; - }; - services.xserver.videoDrivers = [ "nvidia" ]; + environment.variables = + if (config.mods.gpu.amdgpu.enable && config.mods.gpu.vapi.rocm.enable) + then { + RUSTICL_ENABLE = mkDashDefault "radeonsi"; } - ); + else {}; + + hardware = { + nvidia = lib.mkIf config.mods.gpu.nvidia.enable { + modesetting.enable = mkDashDefault true; + open = mkDashDefault true; + nvidiaSettings = mkDashDefault true; + package = mkDashDefault config.boot.kernelPackages.nvidiaPackages.beta; + }; + graphics = let + amdPackages = [ + (lib.mkIf (config.mods.gpu.intelgpu.enable && lib.mkIf config.mods.gpu.vapi.enable) pkgs.vpl-gpu-rt) + (lib.mkIf ( + config.mods.gpu.intelgpu.enable && lib.mkIf config.mods.gpu.vapi.enable + ) + pkgs.intel-media-driver) + (lib.mkIf config.mods.gpu.vapi.enable pkgs.libvdpau-va-gl) + (lib.mkIf config.mods.gpu.vapi.enable pkgs.libva) + (lib.mkIf config.mods.gpu.vapi.enable pkgs.libva-vdpau-driver) + (lib.mkIf (config.mods.gpu.intelgpu.enable || config.mods.gpu.amdgpu.enable) pkgs.mesa) + ]; + rocmPackages = [ + pkgs.rocmPackages.clr.icd + pkgs.mesa + pkgs.mesa.opencl + pkgs.vulkan-loader + pkgs.vulkan-validation-layers + pkgs.vulkan-tools + pkgs.clinfo + ]; + in { + enable = true; + enable32Bit = mkDashDefault true; + extraPackages = + amdPackages + ++ (lib.lists.optionals (config.mods.gpu.vapi.rocm.enable && config.mods.gpu.amdgpu.enable) rocmPackages); + }; + }; + }; } diff --git a/modules/programs/greetd.nix b/modules/programs/greetd.nix index 24f328b..fe3e455 100644 --- a/modules/programs/greetd.nix +++ b/modules/programs/greetd.nix @@ -1,12 +1,13 @@ { + mkDashDefault, config, lib, inputs, pkgs, options, + system, ... -}: -{ +}: { options.mods = { greetd = { enable = lib.mkOption { @@ -18,7 +19,10 @@ ''; }; monitor = lib.mkOption { - default = "${config.conf.monitor}"; + default = + if config.mods.wm.monitors != [] + then (builtins.elemAt config.mods.wm.monitors 0).name + else ""; example = "eDP-1"; type = lib.types.str; description = '' @@ -27,77 +31,94 @@ ''; }; scale = lib.mkOption { - default = "${config.conf.scale}"; + default = + if config.mods.wm.monitors != [] + then builtins.toString (builtins.elemAt config.mods.wm.monitors 0).scale + else ""; example = "1.5"; type = lib.types.str; description = '' Scale used by the monitor in the login screen. - By default the scale of the main monitor is used. + By default the scale of the main monitor is used. ''; }; + greeterCommand = lib.mkOption { + default = "${ + lib.getExe inputs.hyprland.packages.${system}.hyprland + } --config /etc/greetd/hyprgreet.conf"; + example = "${ + lib.getExe pkgs.cage + } -s -- ${lib.getExe pkgs.regreet}"; + type = lib.types.str; + description = "The compositor/greeter command to run"; + }; resolution = lib.mkOption { - default = "auto"; + default = + if config.mods.wm.monitors != [] + then let + resX = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).resolutionX; + resY = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).resolutionY; + refresh = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).refreshrate; + in "${resX}x${resY}@${refresh}" + else ""; example = "3440x1440@180"; type = lib.types.str; description = '' - Resolution/refreshrate used by the monitor in the login screen. + Resolution/refreshrate used by the monitor in the login screen. ''; }; environments = lib.mkOption { - default = '' - Hyprland - ''; + default = [ + (lib.mkIf config.mods.hypr.hyprland.enable inputs.hyprland.packages.${config.conf.system}.hyprland) + (lib.mkIf config.mods.niri.enable pkgs.niri) + ]; # no idea if these are written correctly - example = '' - Niri - River - ''; - type = lib.types.lines; + example = [ + pkgs.niri + pkgs.river-classic + pkgs.swayfx + ]; + type = with lib.types; listOf package; description = '' - List of environments that should be available in the login prompt. + List of environments that should be available in the login prompt. ''; }; + regreet = { + customSettings = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom regret settings. See https://github.com/rharish101/ReGreet/blob/main/regreet.sample.toml for more information. + ''; + }; + }; }; }; - config = - let - username = config.conf.username; - session = { - command = "${ - lib.getExe inputs.hyprland.packages.${config.conf.system}.hyprland - } --config /etc/greetd/hyprgreet.conf"; - user = username; - }; - in + config = let + inherit (config.conf) username; + in lib.mkIf config.mods.greetd.enable ( lib.optionalAttrs (options ? environment) { - services.xserver.displayManager.session = [ - { - manage = "desktop"; - name = "Hyprland"; - start = '' - ${lib.getExe pkgs.hyprland} & waitPID=$! - ''; - } - ]; - # greetd display manager - programs.hyprland.enable = true; - services.greetd = { - enable = true; - settings = { - terminal.vt = 1; - default_session = session; + programs.hyprland.enable = mkDashDefault true; + services = { + displayManager.sessionPackages = config.mods.greetd.environments; + greetd = { + enable = true; + settings = { + terminal.vt = mkDashDefault 1; + default_session = { + command = mkDashDefault config.mods.greetd.greeterCommand; + user = mkDashDefault username; + }; + }; }; }; - environment.etc."greetd/environments".text = config.mods.greetd.environments; - # should technically be the same, but this is configured instead in order to provide a decent out of the box login experience. environment.etc."greetd/hyprgreet.conf".text = '' - exec-once=gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' - monitor=${config.mods.greetd.monitor},${config.mods.greetd.resolution},0x0,${config.mods.greetd.scale} monitor=,disable @@ -107,23 +128,37 @@ force_no_accel = true } - cursor { - enable_hyprcursor = false - } - misc { disable_splash_rendering = false - disable_hyprland_logo = false + disable_hyprland_logo = true + disable_xdg_env_checks = true + disable_scale_notification = true } + env=STATE_DIR,var/cache/regreet + env=CACHE_DIR,var/cache/regreet + env=HYPRCURSOR_THEME,${config.mods.stylix.cursor.name} + env=HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size} env=XCURSOR_THEME,${config.mods.stylix.cursor.name} env=XCURSOR_SIZE,${toString config.mods.stylix.cursor.size} + env=QT_QPA_PLATFORMTHEME,qt5ct - exec-once=regreet --style /home/${username}/.config/gtk-3.0/gtk.css; hyprctl dispatch exit + exec-once=regreet --style /home/${username}/.config/gtk-3.0/gtk.css --config /home/${username}/.config/regreet/regreet.toml; hyprctl dispatch exit ''; # unlock GPG keyring on login - security.pam.services.greetd.enableGnomeKeyring = true; + security.pam = { + services.greetd = { + enableGnomeKeyring = mkDashDefault true; + sshAgentAuth = mkDashDefault true; + }; + sshAgentAuth.enable = mkDashDefault true; + }; + } + // lib.optionalAttrs (options ? home) { + xdg.configFile."regreet/regreet.toml".source = + (pkgs.formats.toml {}).generate "regreet" + config.mods.greetd.regreet.customSettings; } ); } diff --git a/modules/programs/homePackages.nix b/modules/programs/homePackages.nix new file mode 100644 index 0000000..6a995f0 --- /dev/null +++ b/modules/programs/homePackages.nix @@ -0,0 +1,154 @@ +{ + lib, + options, + config, + pkgs, + ... +} +: { + options.mods.homePackages = { + useDefaultPackages = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default packages (will use additional_packages only if disabled)"; + }; + additionalPackages = lib.mkOption { + default = []; + example = [pkgs.flatpak]; + type = with lib.types; listOf package; + description = '' + Additional Home manager packages. + Will be installed regardless of default home manager packages are installed. + ''; + }; + specialPrograms = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + specialServices = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; + matrixClient = lib.mkOption { + default = pkgs.nheko; + example = null; + type = with lib.types; nullOr package; + description = "The matrix client"; + }; + vesktop = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Adds the vesktop discord client"; + }; + ncspot = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Adds the ncspot spotify client"; + }; + orcaSlicer = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables orca slicer"; + }; + nextcloudClient = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Adds the full desktop nextcloud client (the nextcloud module in dashnix only provides the cli tool)"; + }; + mailClient = lib.mkOption { + default = pkgs.thunderbird; + example = null; + type = with lib.types; nullOr package; + description = "The email client"; + }; + browser = lib.mkOption { + default = "zen"; + example = "firefox"; + type = with lib.types; + nullOr ( + either (enum [ + "firefox" + "zen" + "librewolf" + "chromium" + "brave" + ]) + package + ); + description = "The browser (the enum variants have preconfigured modules)"; + }; + }; + + config = lib.optionalAttrs (options ? home.packages) { + home.packages = + if config.mods.homePackages.useDefaultPackages + then + with pkgs; + [ + (lib.mkIf config.mods.homePackages.ncspot ncspot) + (lib.mkIf config.mods.homePackages.orcaSlicer orca-slicer) + (lib.mkIf config.mods.homePackages.vesktop vesktop) + (lib.mkIf config.mods.homePackages.nextcloudClient nextcloud-client) + (lib.mkIf (config.mods.homePackages.matrixClient != null) config.mods.homePackages.matrixClient) + (lib.mkIf (config.mods.homePackages.mailClient != null) config.mods.homePackages.mailClient) + (lib.mkIf ( + # NOTE: This should be package, but nix doesn't have that.... + builtins.isAttrs config.mods.homePackages.browser && config.mods.homePackages.browser != null + ) + config.mods.homePackages.browser) + adw-gtk3 + bat + brightnessctl + dbus + fastfetch + fd + ffmpeg + flake-checker + gnome-keyring + gnutar + regreet + killall + kitty + libnotify + lsd + networkmanager + nh + nix-index + playerctl + poppler-utils + pulseaudio + libsForQt5.qt5ct + qt6Packages.qt6ct + fuc + ripgrep + rm-improved + system-config-printer + xournalpp + zenith + zoxide + ] + ++ config.mods.homePackages.additionalPackages + else config.mods.homePackages.additionalPackages; + + xdg.configFile."direnv/direnv.toml".source = (pkgs.formats.toml {}).generate "direnv" { + global = { + warn_timeout = "-1s"; + }; + }; + programs = config.mods.homePackages.specialPrograms; + services = config.mods.homePackages.specialServices; + }; +} diff --git a/modules/programs/home_packages.nix b/modules/programs/home_packages.nix deleted file mode 100644 index 21858fd..0000000 --- a/modules/programs/home_packages.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ - lib, - options, - config, - pkgs, - ... -}: -{ - options.mods.home_packages = { - useDefaultPackages = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Use default packages (will use additional_packages only if disabled)"; - }; - additional_packages = lib.mkOption { - default = [ ]; - example = [ pkgs.flatpak ]; - type = with lib.types; listOf package; - description = '' - Additional Home manager packages. - Will be installed regardless of default home manager packages are installed. - ''; - }; - matrixClient = lib.mkOption { - default = pkgs.nheko; - example = null; - type = with lib.types; nullOr package; - description = "The matrix client"; - }; - vesktop = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Adds the vesktop discord client"; - }; - ncspot = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Adds the ncspot spotify client"; - }; - nextcloudClient = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = "Adds the full desktop nextcloud client (the nextcloud module in dashnix only provides the cli tool)"; - }; - mailClient = lib.mkOption { - default = pkgs.thunderbird; - example = null; - type = with lib.types; nullOr package; - description = "The email client"; - }; - additionalBrowser = lib.mkOption { - default = pkgs.brave; - example = null; - type = with lib.types; nullOr package; - description = "Additional browser -> second to firefox, the only installed browser if firefox is disabled"; - }; - }; - config = - (lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.home_packages.additional_packages; - }) - // lib.mkIf config.mods.home_packages.useDefaultPackages ( - lib.optionalAttrs (options ? home.packages) { - home.packages = - with pkgs; - [ - # TODO add fcp once fixed.... - (lib.mkIf config.mods.home_packages.ncspot ncspot) - (lib.mkIf config.mods.home_packages.vesktop vesktop) - (lib.mkIf config.mods.home_packages.nextcloudClient nextcloud-client) - (lib.mkIf (!isNull config.mods.home_packages.matrixClient) config.mods.home_packages.matrixClient) - (lib.mkIf (!isNull config.mods.home_packages.mailClient) config.mods.home_packages.mailClient) - (lib.mkIf ( - !isNull config.mods.home_packages.additionalBrowser - ) config.mods.home_packages.additionalBrowser) - adw-gtk3 - bat - brightnessctl - dbus - fastfetch - fd - ffmpeg - flake-checker - gnome-keyring - gnutar - greetd.regreet - killall - kitty - libnotify - lsd - networkmanager - nh - nix-index - playerctl - poppler_utils - pulseaudio - qt5ct - qt6ct - ripgrep - rm-improved - system-config-printer - xournalpp - zenith - zoxide - ] - ++ config.mods.home_packages.additional_packages; - - xdg.configFile."direnv/direnv.toml".source = (pkgs.formats.toml { }).generate "direnv" { - global = { - warn_timeout = "-1s"; - }; - }; - - } - ); -} diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hypr/default.nix similarity index 69% rename from modules/programs/hyprland/default.nix rename to modules/programs/hypr/default.nix index a181f64..68b88ea 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hypr/default.nix @@ -1,8 +1,6 @@ { imports = [ ./hyprland.nix - ./anyrun.nix - ./ironbar.nix ./hyprlock.nix ./hyprpaper.nix ]; diff --git a/modules/programs/hypr/hyprland.nix b/modules/programs/hypr/hyprland.nix new file mode 100644 index 0000000..442b964 --- /dev/null +++ b/modules/programs/hypr/hyprland.nix @@ -0,0 +1,357 @@ +{ + mkDashDefault, + config, + lib, + options, + pkgs, + ... +}: let + defaultWmConf = import ../../../lib/wm.nix; +in { + options.mods.hypr.hyprland = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enable Hyprland + ''; + }; + noAtomic = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Use tearing (Warning, can be buggy) + ''; + }; + useIronbar = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Whether to use ironbar in hyprland. + ''; + }; + 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. + ''; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprland.enable ( + lib.optionalAttrs (options ? wayland.windowManager.hyprland) { + # install Hyprland related packages + home.packages = with pkgs; [ + xorg.xprop + grim + slurp + satty + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + kdePackages.xdg-desktop-portal-kde + xdg-desktop-portal-shana + copyq + wl-clipboard + hyprcursor + hyprpicker + ]; + + wayland.windowManager.hyprland = let + mkWorkspace = workspaces: + builtins.map (workspace: let + default = + if workspace.default + then ",default:true" + else ""; + in "${workspace.name},monitor:${workspace.monitor}${default}") + workspaces; + mkTransform = transform: + if transform == "0" + then 0 + else if transform == "90" + then 1 + else if transform == "180" + then 2 + else if transform == "270" + then 3 + else 4; + mkVrr = vrr: + if vrr + then "1" + else "0"; + mkMonitors = monitors: + builtins.map ( + monitor: "${monitor.name},${builtins.toString monitor.resolutionX}x${builtins.toString monitor.resolutionY}@${builtins.toString monitor.refreshrate},${builtins.toString monitor.positionX}x${builtins.toString monitor.positionY},${builtins.toString monitor.scale}, transform,${builtins.toString (mkTransform monitor.transform)}, vrr,${mkVrr monitor.vrr}" + ) + monitors; + + mkMods = bind: let + mods = bind.modKeys or []; + in + builtins.map (mod: + if mod == "Mod" + then (lib.strings.toUpper config.mods.wm.modKey) + " " + else lib.strings.toUpper mod) + mods + |> lib.strings.concatStringsSep ""; + mkArgs = args: + if args != [] + then (lib.strings.concatStringsSep " " args) + else ""; + shouldRepeat = bind: bind ? meta && bind.meta ? hyprland && bind.meta.hyprland ? repeat && bind.meta.hyprland.repeat == true; + + defaultBinds = cfg: + if cfg.mods.wm.useDefaultBinds + then defaultWmConf.defaultBinds cfg + else []; + + mkEBinds = cfg: let + binds = cfg.mods.wm.binds ++ defaultBinds cfg; + in + binds + |> builtins.filter (bind: bind ? command && shouldRepeat bind && !(hasInvalidCustomCommand bind)) + |> builtins.map ( + bind: "${mkMods bind},${bind.key},${mkCommand bind}" + ); + mkBinds = cfg: let + binds = cfg.mods.wm.binds ++ defaultBinds cfg; + in + binds + |> builtins.filter (bind: bind ? command && !(shouldRepeat bind) && !(hasInvalidCustomCommand bind)) + |> builtins.map ( + bind: "${mkMods bind},${bind.key},${mkCommand bind}" + ); + mkCommand = bind: let + args = bind.args or []; + in + if bind.command == "quit" + then "exit" + else if bind.command == "killActive" + then "killactive" + else if bind.command == "moveWindowRight" + then "movewindow,r" + else if bind.command == "moveWindowDown" + then "movewindow,d" + else if bind.command == "moveWindowLeft" + then "movewindow,l" + else if bind.command == "moveWindowUp" + then "movewindow,u" + else if bind.command == "moveFocusUp" + then "movefocus,u" + else if bind.command == "moveFocusRight" + then "movefocus,r" + else if bind.command == "moveFocusDown" + then "movefocus,d" + else if bind.command == "moveFocusLeft" + then "movefocus,l" + else if bind.command == "toggleFloating" + then "togglefloating" + else if bind.command == "toggleFullscreen" + then "fullscreen" + else if bind.command == "focusWorkspace" + then "workspace" + "," + mkArgs args + else if bind.command == "moveToWorkspace" + then "movetoworkspace" + "," + mkArgs args + else if bind.command == "spawn" + then "exec" + "," + mkArgs args + else if bind.command == "spawn-sh" + then "exec" + "," + mkArgs args + else bind.command.hyprland + "," + mkArgs args; + hasInvalidCustomCommand = bind: !(builtins.isString bind.command) && bind.command.hyprland or null == null; + + mkEnv = config: let + defaultEnv = + if config.mods.wm.useDefaultEnv + then defaultWmConf.defaultEnv config + else { + all = {}; + hyprland = {}; + }; + userEnv = + if config.mods.wm.env ? all + then config.mods.wm.env.all // config.mods.wm.env.hyprland + else config.mods.wm.env; + env = userEnv // defaultEnv.all // defaultEnv.hyprland; + in + lib.attrsets.mapAttrsToList ( + name: value: "${name},${value}" + ) + env; + mkAutoStart = config: let + defaultStartup = + if config.mods.wm.useDefaultStartup + then defaultWmConf.defaultStartup config + else { + all = []; + hyprland = []; + }; + userStartup = + if config.mods.wm.startup ? all + then config.mods.wm.startup.all ++ config.mods.wm.startup.hyprland + else config.mods.wm.startup; + autoStart = userStartup ++ defaultStartup.all ++ defaultStartup.hyprland; + in + autoStart; + mkWindowRule = config: let + defaultWindowRules = + if config.mods.wm.useDefaultWindowRules + then defaultWmConf.defaultWindowRules.hyprland + else []; + in + # defaultWindowRules ++ config.mods.wm.windowRules.hyprland; + defaultWindowRules; + in { + enable = true; + plugins = + [ + (lib.mkIf config.mods.hypr.hyprland.hyprspaceEnable pkgs.hyprlandPlugins.hyprspace) + ] + ++ config.mods.hypr.hyprland.plugins; + settings = + if config.mods.hypr.hyprland.useDefaultConfig + then + lib.mkMerge + [ + { + "$mod" = mkDashDefault config.mods.wm.modKey; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizeactive" + ]; + + general = { + gaps_out = mkDashDefault "3,5,5,5"; + border_size = mkDashDefault 3; + "col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; + allow_tearing = lib.mkIf config.mods.hypr.hyprland.noAtomic true; + }; + + decoration = { + rounding = mkDashDefault 4; + }; + + render = { + direct_scanout = mkDashDefault config.mods.gaming.enable; + }; + + animations = { + bezier = mkDashDefault "overshot, 0.05, 0.9, 0.1, 1.2"; + animation = [ + "windowsMove,1,4,default" + "windows,1,3,overshot,slide bottom" + "windowsOut,1,7,default,popin 70%" + "border,1,4,default" + "fade,1,7,default" + "workspaces,1,4,default" + "layers,1,2,default,slide" + ]; + }; + + dwindle = { + preserve_split = mkDashDefault true; + pseudotile = mkDashDefault 0; + permanent_direction_override = mkDashDefault false; + }; + + input = { + kb_layout = mkDashDefault "${config.mods.xkb.layout}"; + kb_variant = mkDashDefault "${config.mods.xkb.variant}"; + repeat_delay = mkDashDefault 200; + force_no_accel = mkDashDefault true; + touchpad = { + natural_scroll = mkDashDefault true; + tap-to-click = mkDashDefault true; + tap-and-drag = mkDashDefault true; + }; + }; + + misc = { + animate_manual_resizes = mkDashDefault 1; + enable_swallow = mkDashDefault true; + disable_splash_rendering = mkDashDefault true; + disable_hyprland_logo = mkDashDefault true; + disable_xdg_env_checks = mkDashDefault true; + disable_scale_notification = mkDashDefault true; + swallow_regex = mkDashDefault "^(.*)(kitty)(.*)$"; + initial_workspace_tracking = mkDashDefault 1; + # just doesn't work + enable_anr_dialog = false; + }; + + cursor = { + enable_hyprcursor = mkDashDefault true; + no_hardware_cursors = mkDashDefault ( + if config.mods.gpu.nvidia.enable + then 2 + else 0 + ); + # done with nix, this would break the current setup otherwise + sync_gsettings_theme = mkDashDefault false; + }; + + gesture = [ + "3, horizontal, workspace" + ]; + + layerrule = [ + # layer rules + # mainly to disable animations within slurp and grim + "match:namespace selection, no_anim on" + ]; + + workspace = mkWorkspace config.mods.wm.workspaces; + monitor = mkMonitors config.mods.wm.monitors; + env = mkEnv config; + bind = mkBinds config; + binde = mkEBinds config; + windowrule = mkWindowRule config; + exec-once = mkAutoStart config; + plugin = config.mods.hypr.hyprland.pluginConfig; + } + config.mods.hypr.hyprland.customConfig + ] + else lib.mkForce config.mods.hypr.hyprland.customConfig; + }; + } + ); +} diff --git a/modules/programs/hypr/hyprlock.nix b/modules/programs/hypr/hyprlock.nix new file mode 100644 index 0000000..c152b22 --- /dev/null +++ b/modules/programs/hypr/hyprlock.nix @@ -0,0 +1,69 @@ +{ + config, + lib, + options, + pkgs, + ... +}: { + options.mods.hypr.hyprlock = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables Hyprlock"; + }; + config = lib.mkOption { + default = { + background = [ + { + monitor = ""; + path = ""; + color = "rgba(26, 27, 38, 1.0)"; + } + ]; + + input-field = [ + { + monitor = "${ + if config.mods.wm.monitors != [] + then (builtins.elemAt config.mods.wm.monitors 0).name + else "" + }"; + placeholder_text = "password or something"; + } + ]; + + label = [ + { + monitor = "${ + if config.mods.wm.monitors != [] + then (builtins.elemAt config.mods.wm.monitors 0).name + else "" + }"; + text = "$TIME"; + font_size = 50; + position = "0, 200"; + valign = "center"; + halign = "center"; + } + ]; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config"; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprlock.enable ( + lib.optionalAttrs (options ? xdg.configFile) { + stylix.targets.hyprlock = { + enable = false; + }; + home.packages = with pkgs; [hyprlock]; + programs.hyprlock = lib.mkIf config.mods.hypr.hyprlock.enable { + enable = true; + settings = config.mods.hypr.hyprlock.config; + }; + } + ); +} diff --git a/modules/programs/hypr/hyprpaper.nix b/modules/programs/hypr/hyprpaper.nix new file mode 100644 index 0000000..b392b54 --- /dev/null +++ b/modules/programs/hypr/hyprpaper.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + options, + pkgs, + ... +}: { + options.mods.hypr.hyprpaper = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables Hyprpaper"; + }; + config = lib.mkOption { + default = ""; + example = '' + preload = path/to/wallpaper + wallpaper = YOURMONITOR,path/to/wallpaper + ''; + type = lib.types.lines; + description = '' + Hyprpaper config + ''; + }; + }; + + config = lib.mkIf config.mods.hypr.hyprpaper.enable ( + lib.optionalAttrs (options ? xdg.configFile) { + home.packages = with pkgs; [hyprpaper]; + xdg.configFile."hypr/hyprpaper.conf" = lib.mkIf config.mods.hypr.hyprpaper.enable { + text = config.mods.hypr.hyprpaper.config; + }; + } + ); +} diff --git a/modules/programs/hyprland/anyrun.nix b/modules/programs/hyprland/anyrun.nix deleted file mode 100644 index 33c38f7..0000000 --- a/modules/programs/hyprland/anyrun.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ - lib, - config, - pkgs, - options, - inputs, - ... -}: -{ - options.mods = { - hyprland.anyrun = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables anyrun"; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.anyrun.enable ( - lib.optionalAttrs (options ? programs.anyrun) { - programs.anyrun = { - enable = true; - config = { - plugins = [ - inputs.anyrun.packages.${pkgs.system}.applications - inputs.anyrun.packages.${pkgs.system}.rink - inputs.anyrun.packages.${pkgs.system}.translate - inputs.anyrun.packages.${pkgs.system}.websearch - ]; - #position = "center"; - hideIcons = false; - width = { - fraction = 0.3; - }; - y = { - fraction = 0.5; - }; - layer = "overlay"; - hidePluginInfo = true; - closeOnClick = true; - }; - - extraCss = '' - #window { - border-radius: 10px; - background-color: none; - } - - box#main { - border-radius: 10px; - } - - list#main { - border-radius: 10px; - margin: 0px 10px 10px 10px; - } - - list#plugin { - border-radius: 10px; - } - - list#match { - border-radius: 10px; - } - - entry#entry { - border: none; - border-radius: 10px; - margin: 10px 10px 0px 10px; - } - - label#match-desc { - font-size: 12px; - border-radius: 10px; - } - - label#match-title { - font-size: 12px; - border-radius: 10px; - } - - label#plugin { - font-size: 16px; - border-radius: 10px; - } - - * { - border-radius: 10px; - } - ''; - }; - } - ); -} diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hyprland/hyprland.nix deleted file mode 100644 index 09d822b..0000000 --- a/modules/programs/hyprland/hyprland.nix +++ /dev/null @@ -1,353 +0,0 @@ -{ - config, - lib, - options, - pkgs, - ... -}: -{ - options.mods = { - hyprland = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Enable Hyprland - ''; - }; - monitor = lib.mkOption { - default = [ ]; - 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. - ''; - }; - no_atomic = lib.mkOption { - default = false; - example = true; - type = lib.types.bool; - description = '' - Use tearing - ''; - }; - extra_autostart = lib.mkOption { - default = [ ]; - example = [ "your application" ]; - type = lib.types.listOf lib.types.str; - description = '' - Extra exec_once. - ''; - }; - use_default_config = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = '' - Use preconfigured Hyprland config. - ''; - }; - custom_config = lib.mkOption { - default = { }; - example = { }; - type = with lib.types; attrsOf anything; - description = '' - Custom Hyprland configuration. - Will be merged with default configuration if enabled. - ''; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.enable ( - lib.optionalAttrs (options ? wayland.windowManager.hyprland) { - # install Hyprland related packages - home.packages = with pkgs; [ - xorg.xprop - grim - slurp - satty - xdg-desktop-portal-gtk - # xdg-desktop-portal-hyprland - copyq - wl-clipboard - hyprcursor - hyprpicker - ]; - - wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.settings = - lib.mkIf config.mods.hyprland.use_default_config { - "$mod" = "SUPER"; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - bind = [ - # screenshots - ''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy'' - ''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -'' - ''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy'' - - # regular programs - "$mod SUPER,F,exec,firefox" - "$mod SUPERSHIFT,F,exec,firefox -p special" - "$mod SUPER,T,exec,kitty -1" - "$mod SUPER,E,exec,nautilus -w" - "$mod SUPER,N,exec,neovide" - "$mod SUPER,M,exec,oxidash" - "$mod SUPER,R,exec,anyrun" - "$mod SUPER,G,exec,oxicalc" - "$mod SUPER,D,exec,oxishut" - "$mod SUPER,A,exec,oxipaste" - "$mod SUPERSHIFT,P,exec,hyprdock --gui" - "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend" - "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate" - - # media keys - (lib.mkIf config.mods.scripts.audio-control ",XF86AudioMute,exec, audio-control mute") - (lib.mkIf config.mods.scripts.audio-control ",XF86AudioLowerVolume,exec, audio-control sink -5%") - (lib.mkIf config.mods.scripts.audio-control ",XF86AudioRaiseVolume,exec, audio-control sink +5%") - ",XF86AudioPlay,exec, playerctl play-pause" - ",XF86AudioNext,exec, playerctl next" - ",XF86AudioPrev,exec, playerctl previous" - (lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-") - (lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessUp,exec, change-brightness brightness +10%") - - # hyprland keybinds - # misc - "$mod SUPER,V,togglefloating," - "$mod SUPER,B,fullscreen," - "$mod SUPER,C,togglesplit" - "$mod SUPER,Q,killactive," - "$mod SUPERSHIFTALT,M,exit," - "$mod SUPERSHIFT,W,togglespecialworkspace" - - # move - "$mod SUPER,left,movewindow,l" - "$mod SUPER,right,movewindow,r" - "$mod SUPER,up,movewindow,u" - "$mod SUPER,down,movewindow,d" - - # workspaces - "$mod SUPER,1,workspace,1" - "$mod SUPER,2,workspace,2" - "$mod SUPER,3,workspace,3" - "$mod SUPER,4,workspace,4" - "$mod SUPER,5,workspace,5" - "$mod SUPER,6,workspace,6" - "$mod SUPER,7,workspace,7" - "$mod SUPER,8,workspace,8" - "$mod SUPER,9,workspace,9" - "$mod SUPER,0,workspace,10" - - # move to workspace - "$mod SUPERSHIFT,1,movetoworkspace,1" - "$mod SUPERSHIFT,2,movetoworkspace,2" - "$mod SUPERSHIFT,3,movetoworkspace,3" - "$mod SUPERSHIFT,4,movetoworkspace,4" - "$mod SUPERSHIFT,5,movetoworkspace,5" - "$mod SUPERSHIFT,6,movetoworkspace,6" - "$mod SUPERSHIFT,7,movetoworkspace,7" - "$mod SUPERSHIFT,8,movetoworkspace,8" - "$mod SUPERSHIFT,9,movetoworkspace,9" - "$mod SUPERSHIFT,0,movetoworkspace,10" - - # move to workspace silent - "$mod SUPERSHIFTALT,1,movetoworkspacesilent,1" - "$mod SUPERSHIFTALT,2,movetoworkspacesilent,2" - "$mod SUPERSHIFTALT,3,movetoworkspacesilent,3" - "$mod SUPERSHIFTALT,4,movetoworkspacesilent,4" - "$mod SUPERSHIFTALT,5,movetoworkspacesilent,5" - "$mod SUPERSHIFTALT,6,movetoworkspacesilent,6" - "$mod SUPERSHIFTALT,7,movetoworkspacesilent,7" - "$mod SUPERSHIFTALT,8,movetoworkspacesilent,8" - "$mod SUPERSHIFTALT,9,movetoworkspacesilent,9" - "$mod SUPERSHIFTALT,0,movetoworkspacesilent,10" - - # preselection - "$mod SUPERALT,j,layoutmsg,preselect l" - "$mod SUPERALT,k,layoutmsg,preselect d" - "$mod SUPERALT,l,layoutmsg,preselect u" - "$mod SUPERALT,semicolon,layoutmsg,preselect r" - "$mod SUPERALT,h,layoutmsg,preselect n" - ]; - - binde = [ - # hyprland keybinds - # focus - "$mod SUPER,J,movefocus,l" - "$mod SUPER,semicolon,movefocus,r" - "$mod SUPER,L,movefocus,u" - "$mod SUPER,K,movefocus,d" - - # resize - "$mod SUPER,U,resizeactive,-20 0" - "$mod SUPER,P,resizeactive,20 0" - "$mod SUPER,O,resizeactive,0 -20" - "$mod SUPER,I,resizeactive,0 20" - ]; - - general = { - gaps_out = "3,5,5,5"; - border_size = 3; - "col.active_border" = lib.mkForce "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg"; - # "col.inactive_border" = "0x66333333"; - allow_tearing = lib.mkIf config.mods.hyprland.no_atomic true; - }; - - decoration = { - rounding = 4; - }; - - animations = { - bezier = "penguin,0.05,0.9,0.1,1.0"; - animation = [ - "windowsMove,1,4,default" - "windows,1,7,default,popin 70%" - "windowsOut,1,7,default,popin 70%" - "border,1,10,default" - "fade,1,7,default" - "workspaces,1,6,default" - "layers,1,3,default,popin" - ]; - }; - - dwindle = { - preserve_split = true; - pseudotile = 0; - permanent_direction_override = false; - }; - - input = { - kb_layout = "${config.mods.xkb.layout}"; - kb_variant = "${config.mods.xkb.variant}"; - repeat_delay = 200; - force_no_accel = true; - touchpad = { - natural_scroll = true; - tap-to-click = true; - tap-and-drag = true; - }; - }; - - misc = { - animate_manual_resizes = 1; - enable_swallow = true; - disable_splash_rendering = true; - disable_hyprland_logo = true; - swallow_regex = "^(.*)(kitty)(.*)$"; - initial_workspace_tracking = 1; - }; - - cursor = { - # conversion seems to be borked right now, i want a smooth bibata :( - enable_hyprcursor = false; - no_hardware_cursors = lib.mkIf config.mods.gpu.nvidia.enable true; - # no_break_fs_vrr = true; - }; - - gestures = { - workspace_swipe = true; - }; - - monitor = config.mods.hyprland.monitor; - workspace = config.mods.hyprland.workspace; - - env = [ - "GTK_CSD,0" - ''TERM,"kitty /bin/fish"'' - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "XDG_SESSION_DESKTOP=Hyprland" - "HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}" - "HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "XCURSOR_THEME,${config.mods.stylix.cursor.name}" - "XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}" - "QT_QPA_PLATFORM,wayland" - "QT_QPA_PLATFORMTHEME,qt5ct" - "QT_WAYLAND_FORCE_DPI,96" - "QT_AUTO_SCREEN_SCALE_FACTOR,0" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "QT_SCALE_FACTOR,1" - ''EDITOR,"neovide --novsync --nofork"'' - (lib.mkIf config.mods.hyprland.no_atomic "WLR_DRM_NO_ATOMIC,1") - "GTK_USE_PORTAL, 1" - - (lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia") - (lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland") - (lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm") - (lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia") - ]; - - layerrule = [ - # layer rules - # mainly to disable animations within slurp and grim - "noanim, selection" - ]; - - windowrule = [ - # window rules - "tile,^(.*)(Spotify)(.*)$" - "float,^(.*)(OxiCalc)(.*)$" - "float,^(.*)(winecfg.exe)(.*)$" - "float,^(.*)(speed.exe)(.*)$" - "float,^(.*)(copyq)(.*)$" - "center,^(.*)(swappy)(.*)$" - "float,title:^(.*)(Spirit)(.*)$" - "float,title:^(.*)(reset)(.*)$" - "workspace 10 silent,^(.*)(steam)(.*)$" - "workspace 9 silent,^(.*)(dota)(.*)$" - "workspace 9 silent,^(.*)(battlebits)(.*)$" - "workspace 9 silent,^(.*)(aoe)(.*)$" - "suppressevent fullscreen maximize,^(.*)(neovide)(.*)$" - ]; - - windowrulev2 = [ - "immediate,class:^(.*)(Pal)$" - "immediate,class:^(.*)(dota2)$" - "immediate,class:^(.*)(needforspeedheat.exe)$" - ]; - - exec-once = [ - # environment - "systemctl --user import-environment" - "dbus-update-activation-environment --systemd --all" - "hyprctl setcursor Bibata-Modern-Classic 24" - - # other programs - "hyprpaper" - "ironbar" - "firefox" - "oxipaste_daemon" - # should be taken care of with the new systemd services - # "nextcloud --background" - "oxinoti" - ] ++ config.mods.hyprland.extra_autostart; - - # plugin = { - # hyprspace = { - # bind = [ - # "SUPER, W, overview:toggle, toggle" - # ]; - # }; - # }; - } - // config.mods.hyprland.custom_config; - # wayland.windowManager.hyprland.plugins = [ - # inputs.Hyprspace.packages.${pkgs.system}.Hyprspace - # ]; - } - ); -} diff --git a/modules/programs/hyprland/hyprlock.nix b/modules/programs/hyprland/hyprlock.nix deleted file mode 100644 index 091bb9e..0000000 --- a/modules/programs/hyprland/hyprlock.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - config, - lib, - options, - pkgs, - ... -}: -{ - options.mods = { - hyprland.hyprlock = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables Hyprlock"; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.hyprlock.enable ( - lib.optionalAttrs (options ? xdg.configFile) { - home.packages = with pkgs; [ hyprlock ]; - programs.hyprlock = lib.mkIf config.mods.hyprland.hyprlock.enable { - enable = true; - settings = { - background = [ - { - monitor = ""; - path = ""; - color = "rgba(26, 27, 38, 1.0)"; - } - ]; - - input-field = [ - { - monitor = "${config.conf.monitor}"; - - placeholder_text = "password or something"; - } - ]; - - label = [ - { - monitor = "${config.conf.monitor}"; - text = "$TIME"; - font_size = 50; - position = "0, 200"; - valign = "center"; - halign = "center"; - } - ]; - }; - }; - } - ); -} diff --git a/modules/programs/hyprland/hyprpaper.nix b/modules/programs/hyprland/hyprpaper.nix deleted file mode 100644 index d6eff04..0000000 --- a/modules/programs/hyprland/hyprpaper.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - config, - lib, - options, - pkgs, - ... -}: -{ - options.mods = { - hyprland.hyprpaper = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables Hyprpaper"; - }; - config = lib.mkOption { - default = ""; - example = '' - Hyprpaper config - ''; - type = lib.types.lines; - description = '' - Hyprpaper config - ''; - }; - }; - }; - - config = lib.mkIf config.mods.hyprland.hyprpaper.enable ( - lib.optionalAttrs (options ? xdg.configFile) { - home.packages = with pkgs; [ hyprpaper ]; - xdg.configFile."hypr/hyprpaper.conf" = lib.mkIf config.mods.hyprland.hyprpaper.enable { - text = config.mods.hyprland.hyprpaper.config; - }; - } - ); -} diff --git a/modules/programs/hyprland/ironbar.nix b/modules/programs/hyprland/ironbar.nix deleted file mode 100644 index dabf38f..0000000 --- a/modules/programs/hyprland/ironbar.nix +++ /dev/null @@ -1,280 +0,0 @@ -{ - lib, - config, - pkgs, - options, - ... -}: -let - username = config.conf.username; -in -{ - options.mods = { - hyprland.ironbar = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables ironbar"; - }; - }; - }; - config = lib.mkIf config.mods.hyprland.ironbar.enable ( - lib.optionalAttrs (options ? programs.ironbar) { - - programs.ironbar = { - enable = true; - style = '' - @import url("/home/${username}/.config/gtk-3.0/gtk.css"); - - * { - color: #71bbe6; - padding: 0px; - margin: 0px; - } - - .background { - background-color: rgba(0, 0, 0, 0); - } - - .workspaces { - margin: 2px 0px 0px 5px; - border-radius: 10px; - /* background-color: #2b2c3b; */ - background-color: #1E1E2E; - padding: 2px 5px 2px 5px; - } - - .workspaces .item { - margin: 0px 3px 0px 3px; - font-size: 13px; - border-radius: 100%; - padding: 0px 2px 0px 3px; - background-color: rgba(0, 0, 0, 0); - } - - .workspaces .item:hover { - background-color: #3e4152; - } - - .workspaces .item.focused { - background-color: #3e4152; - } - - .audio-box { - padding: 2em; - background-color: #1E1E2E; - border-radius: 5px; - } - - .audio-slider { - padding: 5px; - margin: 5px; - } - - .audio-button { - padding: 5px 10px 5px 10px; - margin: 0px 1em 20px 1em; - border-radius: 100%; - font-size: 17px; - } - - .audio-button-box { - padding: 0px 2.5em 0px 2.5em; - } - - .focused { - /* margin: 2px 0px 0px 0px; */ - padding: 0px 5px 0px 5px; - /* background-color: 1a1b26; */ - background-color: #1E1E2E; - font-size: 17px; - border-radius: 10px; - } - - #bar #end { - margin: 0px 5px 0px 0px; - padding: 0px 5px 0px 5px; - background-color: #1E1E2E; - border-radius: 10px; - } - - .popup-button { - padding: 0px 5px 0px 3px; - margin: 0em 3px; - border-radius: 100%; - font-size: 13px; - background-color: #1E1E2E; - } - - .popup-button-box { - padding: 2px 0px 2px 0px; - } - - .clock { - padding: 0px 5px 0px 5px; - font-size: 17px; - background-color: #1E1E2E; - } - - .clock:hover { - background-color: #3e4152; - } - - .custom button { - background-color: #1E1E2E; - } - - .custom button:hover { - background-color: #3e4152; - } - - .memory-usage { - font-size: 15px; - margin: 0px 5px 0px 0px; - } - - .memory-usage:hover { - background-color: #3e4152; - } - - .popup-clock { - background-color: #1E1E2E; - border-radius: 5px; - padding: 2px 8px 10px 8px; - } - - .popup-clock .calendar-clock { - font-size: 2.5em; - padding-bottom: 0.1em; - } - - .popup-clock .calendar { - border-radius: 5px; - font-size: 1.05em; - } - - .popup-clock .calendar:selected { - background-color: #3e4152; - } - ''; - features = [ - #"another_feature" - ]; - config = { - monitors."${config.conf.monitor}" = { - end = config.conf.ironbar.modules ++ [ - { - type = "sys_info"; - format = [ " {memory_percent}" ]; - interval.memory = 30; - class = "memory-usage"; - } - { - type = "custom"; - bar = [ - { - type = "button"; - class = "popup-button"; - label = ""; - on_click = "popup:toggle"; - } - ]; - class = "popup-button-box"; - popup = [ - { - type = "box"; - orientation = "vertical"; - class = "audio-box"; - widgets = [ - { - type = "box"; - orientation = "horizontal"; - widgets = [ - { - type = "button"; - class = "audio-button"; - label = ""; - on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh bluetooth"; - } - { - type = "button"; - class = "audio-button"; - label = "󰋋"; - on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh internal"; - } - ]; - class = "audio-button-box"; - } - { - type = "label"; - label = "Output"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; - } - { - type = "label"; - label = "Input"; - } - { - type = "slider"; - class = "audio-slider"; - step = 1.0; - length = 200; - value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; - on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; - } - ]; - } - ]; - } - { - type = "custom"; - bar = [ - { - type = "button"; - class = "popup-button"; - label = ""; - on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css"; - } - ]; - class = "popup-button-box"; - } - { - type = "clock"; - format = "%I:%M"; - format_popup = "%I:%M:%S"; - locale = "en_US"; - } - { type = "tray"; } - ]; - position = "top"; - height = 10; - anchor_to_edges = true; - start = [ - { - type = "workspaces"; - all_monitors = true; - } - ]; - center = [ - { - type = "focused"; - show_icon = true; - show_title = true; - icon_size = 20; - truncate = "end"; - } - ]; - }; - }; - }; - } - ); -} diff --git a/modules/programs/ironbar.nix b/modules/programs/ironbar.nix new file mode 100644 index 0000000..b955d51 --- /dev/null +++ b/modules/programs/ironbar.nix @@ -0,0 +1,552 @@ +{ + lib, + config, + pkgs, + inputs, + options, + mkDashDefault, + ... +}: let + inherit (config.conf) username; + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + ironbarDefaultConfig = useBatteryModule: { + end = [ + (lib.mkIf useBatteryModule + { + type = "battery"; + class = "battery"; + icon_size = 0; + format = "{percentage}%"; + thresholds = { + warning = 20; + critical = 5; + }; + }) + { + class = "music"; + type = "music"; + format = ""; + truncate = { + mode = "end"; + max_length = 0; + }; + icons = { + play = ""; + pause = ""; + }; + truncate_popup_title = { + mode = "end"; + max_length = 15; + }; + truncate_popup_album = { + mode = "end"; + max_length = 15; + }; + truncate_popup_artist = { + mode = "end"; + max_length = 15; + }; + } + { + bar = [ + { + class = "popup-button"; + label = ""; + on_click = "popup:toggle"; + type = "button"; + } + ]; + class = "popup-button-box"; + popup = [ + { + class = "audio-box"; + orientation = "vertical"; + type = "box"; + widgets = [ + { + class = "audio-button-box"; + orientation = "horizontal"; + type = "box"; + widgets = [ + { + class = "audio-button"; + label = ""; + on_click = "!audioControl bluetooth"; + type = "button"; + } + { + class = "audio-button"; + label = "󰋋"; + on_click = "!audioControl internal"; + type = "button"; + } + ]; + } + { + class = "audio-label"; + label = "Output"; + type = "label"; + } + { + class = "audio-slider"; + length = 200; + on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%"; + step = 1.0; + type = "slider"; + value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + label = "{{pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }'}}"; + } + { + class = "audio-label"; + label = "Input"; + type = "label"; + } + { + class = "audio-slider"; + length = 200; + on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%"; + step = 1.0; + type = "slider"; + value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'"; + } + ]; + } + ]; + type = "custom"; + } + { + bar = [ + { + class = "popup-button"; + label = ""; + on_click = "!oxidash"; + type = "button"; + } + ]; + class = "popup-button-box"; + type = "custom"; + } + { + bar = [ + { + class = "popup-button"; + label = ""; + on_click = "popup:toggle"; + type = "button"; + } + ]; + type = "custom"; + class = "popup-button-box"; + popup = [ + { + class = "system-box"; + type = "box"; + widgets = [ + { + class = "memory-usage"; + format = [ + " {cpu_percent}%" + " {memory_used} / {memory_total} GB ({memory_percent}%)" + " {swap_used} / {swap_total} GB ({swap_free} | {swap_percent}%)" + "󰥔 {uptime}" + ]; + direction = "vertical"; + interval = { + memory = 30; + cpu = 5; + temps = 5; + disks = 5; + network = 5; + }; + type = "sys_info"; + } + ]; + } + ]; + } + { + type = "tray"; + } + ]; + position = "top"; + height = 10; + anchor_to_edges = true; + start = [ + { + type = "workspaces"; + all_monitors = true; + } + ]; + center = [ + { + format = "%I:%M"; + format_popup = "%a %d:%m/%I:%M %p"; + locale = "en_US"; + type = "clock"; + } + ]; + }; + monitorConfig = useBatteryModule: + if config.mods.ironbar.ironbarSingleMonitor + then { + monitors.${ + if config.mods.wm.monitors != [] + then (builtins.elemAt config.mods.wm.monitors 0).name + else "" + } = + ironbarDefaultConfig useBatteryModule; + } + else ironbarDefaultConfig useBatteryModule; +in { + options.mods = { + ironbar = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables ironbar"; + }; + ironbarSingleMonitor = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Whether to use ironbar on a single monitor. + ''; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured ironbar config. + ''; + }; + useBatteryModule = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Whether to use the preconfigured battery module."; + }; + customConfig = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Custom ironbar configuration. + Will be merged with default configuration if enabled. + ''; + }; + useDefaultCss = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured ironbar css. + ''; + }; + customCss = lib.mkOption { + default = ''''; + example = '' + #window { + border-radius: none; + } + ''; + type = lib.types.lines; + description = '' + Custom ironbar css. + Will be merged with default css if enabled. + ''; + }; + }; + }; + config = lib.mkIf (config.mods.ironbar.enable || config.mods.hypr.hyprland.useIronbar) ( + lib.optionalAttrs (options ? programs.ironbar) { + programs.ironbar = { + package = mkDashDefault pkgs.ironbar; + enable = true; + style = + if config.mods.ironbar.useDefaultCss + then + /* + css + */ + '' + @import url("/home/${username}/.config/gtk-3.0/gtk.css"); + + @define-color primary #${scheme.base0D}; + @define-color warning #${scheme.base0F}; + @define-color muted-text #${scheme.base05}; + @define-color background #${scheme.base00}; + @define-color secondary-background #${scheme.base02}; + + * slider { + background-color: @muted-text; + } + + * { + transition: + background-color 0.15s ease-in-out, + color 0.15s ease-in-out, + border-color 0.15s ease-in-out; + } + + .background { + background-color: rgba(0, 0, 0, 0); + padding: 0px; + margin: 0px; + } + + .focused { + padding: 0px 5px; + background-color: @background; + font-size: 17px; + border-radius: 10px; + } + + #bar #end { + margin: 0px 5px; + padding: 0px 5px; + background-color: @background; + border-radius: 10px; + } + + .popup-button { + padding: 0px 5px 0px 2px; + border-radius: 100%; + font-size: 13px; + background-color: @background; + } + + .popup-button-box { + padding: 2px 0px; + margin-right: 4px; + } + + .custom button { + background-color: @background; + color: @primary; + } + + .custom button:hover { + background-color: @secondary-background; + } + + /* audio */ + .audio-box * { + color: @primary; + } + + .audio-box { + padding: 2em; + background-color: @background; + border-radius: 5px; + border: 1px solid @primary; + } + + .audio-slider { + padding: 5px; + margin: 5px 5px 15px; + } + + .audio-label { + font-size: 19px; + } + + .audio-button { + padding: 10px 10px 10px 8px; + min-height: 35px; + min-width: 35px; + margin: 0px 1em; + border-radius: 50%; + font-size: 25px; + } + + .audio-button-box { + padding: 0px 2.5em 0px 2.5em; + margin: 0em 0em 1.5em; + } + + /* clock */ + .clock { + padding: 0px 5px; + font-size: 20px; + border-radius: 5px; + background-color: @background; + color: @primary; + } + + .clock:hover { + background-color: @secondary-background; + } + + .popup-clock { + font-size: 2.5em; + background-color: @background; + border: 1px solid @primary; + padding: 0.5em; + border-radius: 8px; + color: @primary; + } + + .popup-clock .calendar-clock { + margin: 0.25em 0em 0.75em; + color: @primary; + } + + .popup-clock .calendar { + font-size: 24px; + color: @primary; + } + + .popup-clock .calendar:selected { + background-color: @secondary-background; + } + + /* workspaces */ + .workspaces { + margin: 0px 0px 0px 5px; + border-radius: 10px; + background-color: @background; + padding: 2px 5px; + } + + .workspaces .item { + margin: 0px 3px; + font-size: 13px; + border-radius: 100%; + padding: 0px 3px 0px 3px; + background-color: rgba(0, 0, 0, 0); + color: @primary; + } + + .workspaces .item:hover { + background-color: @secondary-background; + color: @primary; + } + + .workspaces .item:not(.visible) { + color: @warning; + } + + .workspaces .item.focused { + background-color: @primary; + color: @background; + } + + /* battery */ + .battery { + font-size: 13px; + padding: 0px 4px 0px 0px; + margin: 2px 0px 2px 0px; + background-color: @background; + color: @primary; + } + + .battery .icon { + opacity: 0.0; + } + + .battery .label { + margin: 2px 0px 0px -8px; + color: @primary; + } + + .battery:hover { + background-color: @secondary-background; + border-radius: 5px; + } + + .popup-battery { + background-color: @background; + color: @primary; + border-radius: 8px; + border: 1px solid @primary; + padding: 16px; + font-size: 20px; + } + + /* music */ + .music { + font-size: 13px; + padding: 0px 4px 0px 3px; + margin: 2px 0px 2px 0px; + background-color: @background; + color: @primary; + } + + .music:hover { + background-color: @secondary-background; + border-radius: 100%; + } + + .music .contents .icon { + margin: 0px 0px 0px 5px; + } + + .popup-music { + background-color: @background; + color: @primary; + border-radius: 8px; + border: 1px solid @primary; + padding: 16px; + font-size: 20px; + } + + .popup-music .controls .btn-prev { + color: @primary; + margin-right: 16px; + } + + .popup-music .controls .btn-next { + color: @primary; + margin-right: 16px; + } + + .popup-music .controls .btn-play { + color: @primary; + margin-right: 16px; + } + + .popup-music .controls .btn-pause { + color: @primary; + margin-right: 16px; + } + + /* system */ + .system-box { + padding: 16px; + color: @primary; + border: 1px solid @primary; + background-color: @background; + border-radius: 8px; + } + + .memory-usage { + font-size: 15px; + color: @primary; + } + + .memory-usage:hover { + background-color: @secondary-background; + } + '' + + config.mods.ironbar.customCss + else config.mods.ironbar.customCss; + features = [ + #"another_feature" + ]; + config = + if config.mods.ironbar.useDefaultConfig + then + lib.mkMerge + [ + (monitorConfig config.mods.ironbar.useBatteryModule) + config.mods.ironbar.customConfig + ] + else config.mods.ironbar.customConfig; + }; + } + ); +} diff --git a/modules/programs/kde.nix b/modules/programs/kde.nix index 1497094..f81194d 100644 --- a/modules/programs/kde.nix +++ b/modules/programs/kde.nix @@ -3,8 +3,7 @@ options, config, ... -}: -{ +}: { options.mods.kde = { enable = lib.mkOption { default = false; @@ -20,5 +19,4 @@ services.desktopManager.plasma6.enable = true; } ); - } diff --git a/modules/programs/kde_connect.nix b/modules/programs/kdeConnect.nix similarity index 73% rename from modules/programs/kde_connect.nix rename to modules/programs/kdeConnect.nix index 153a149..46b12e8 100644 --- a/modules/programs/kde_connect.nix +++ b/modules/programs/kdeConnect.nix @@ -4,11 +4,9 @@ options, pkgs, ... -}: -{ - +}: { options.mods = { - kde_connect.enable = lib.mkOption { + kdeConnect.enable = lib.mkOption { default = false; type = lib.types.bool; example = true; @@ -18,7 +16,7 @@ }; }; - config = lib.mkIf config.mods.kde_connect.enable ( + config = lib.mkIf config.mods.kdeConnect.enable ( lib.optionalAttrs (options ? networking.firewall) { networking.firewall = { allowedTCPPortRanges = [ @@ -37,6 +35,8 @@ ]; }; } - // lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ kdeconnect ]; } + // lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [kdePackages.kdeconnect-kde]; + } ); } diff --git a/modules/programs/keepassxc.nix b/modules/programs/keepassxc.nix index 6bff531..d8c0c6a 100644 --- a/modules/programs/keepassxc.nix +++ b/modules/programs/keepassxc.nix @@ -4,8 +4,7 @@ options, pkgs, ... -}: -{ +}: { options.mods.keepassxc = { enable = lib.mkOption { default = true; @@ -13,54 +12,63 @@ type = lib.types.bool; description = "Enables the piper program and its daemon"; }; - use_cache_config = lib.mkOption { + useConfig = lib.mkOption { default = true; example = false; type = lib.types.bool; - description = "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; + description = "Whether to overwrite the config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; }; - cache_config = lib.mkOption { + config = lib.mkOption { default = '' [General] - LastDatabases=/home/${config.conf.username}/Music/Passwords.kdbx - LastActiveDatabase=/home/${config.conf.username}/Music/Passwords.kdbx - LastOpenedDatabases=/home/${config.conf.username}/Music/Passwords.kdbx - LastKeyFiles=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x42\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0M\0u\0s\0i\0\x63\0/\0P\0\x61\0s\0s\0w\0o\0r\0\x64\0s\0.\0k\0\x64\0\x62\0x\0\0\0\n\0\0\0\x42\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0M\0u\0s\0i\0\x63\0/\0l\0o\0g\0i\0n\0_\0k\0\x65\0y\0.\0k\0\x65\0y\0x) + ConfigVersion=2 + + [Browser] + Enabled=true + + [GUI] + ApplicationTheme=classic + HidePasswords=true + MinimizeOnClose=true + MinimizeToTray=true + ShowTrayIcon=true + TrayIconAppearance=monochrome-light + + [PasswordGenerator] + Length=30 + + [Security] + EnableCopyOnDoubleClick=true ''; example = ""; type = lib.types.lines; description = "Cache config to be used."; }; + useCacheConfig = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Whether to overwrite the cache config of keepassxc. Note, this means that changes can't be applied via the program anymore!"; + }; + cacheConfig = lib.mkOption { + default = ''''; + example = '' + [General] + LastDatabases=/path/to/database + ''; + type = lib.types.lines; + description = "Cache config to be used."; + }; }; config = lib.mkIf config.mods.keepassxc.enable ( lib.optionalAttrs (options ? home.file) { - home.packages = [ pkgs.keepassxc ]; - xdg.configFile."keepassxc/keepassxc.ini" = { - text = '' - [General] - ConfigVersion=2 - - [Browser] - Enabled=true - - [GUI] - ApplicationTheme=classic - HidePasswords=true - MinimizeOnClose=true - MinimizeToTray=true - ShowTrayIcon=true - TrayIconAppearance=monochrome-light - - [PasswordGenerator] - Length=30 - - [Security] - EnableCopyOnDoubleClick=true - ''; + home.packages = [pkgs.keepassxc]; + xdg.configFile."keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.useConfig { + text = config.mods.keepassxc.config; }; - home.file.".cache/keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.use_cache_config { - text = config.mods.keepassxc.cache_config; + home.file.".cache/keepassxc/keepassxc.ini" = lib.mkIf config.mods.keepassxc.useCacheConfig { + text = config.mods.keepassxc.cacheConfig; }; } ); diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 335c132..ab2ae5a 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -5,10 +5,9 @@ pkgs, inputs, ... -}: -let - base16 = pkgs.callPackage inputs.base16.lib { }; - scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); +}: let + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; hexTable = { "0" = "1"; "1" = "0"; @@ -32,10 +31,9 @@ let "#" + lib.strings.concatStrings ( (lib.lists.take 5 (lib.strings.stringToCharacters scheme.base00)) - ++ [ hexTable."${(lib.lists.last (lib.strings.stringToCharacters scheme.base00))}" ] + ++ [hexTable."${(lib.lists.last (lib.strings.stringToCharacters scheme.base00))}"] ); -in -{ +in { options.mods.kitty = { enable = lib.mkOption { default = true; @@ -43,14 +41,20 @@ in type = lib.types.bool; description = "Enables kitty"; }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enable default config for kitty"; + }; additionalConfig = lib.mkOption { - default = { }; + default = {}; example = { # for the insane people out there :P enable_audio_bell = "yes"; }; type = with lib.types; attrsOf anything; - description = "Additional kitty configuration"; + description = "Additional kitty configuration. Will be the only configuration if useDefaultConfig is disabled."; }; }; config = lib.mkIf config.mods.kitty.enable ( @@ -60,54 +64,65 @@ in }; programs.kitty = { enable = true; - settings = { - enable_audio_bell = "no"; - window_alert_on_bell = "no"; - cursor_blink_interval = "0"; - window_padding_width = "1"; - shell_integration = "yes"; - sync_with_monitor = "no"; - background_opacity = "0.8"; + settings = + if config.mods.kitty.useDefaultConfig + then + { + enable_audio_bell = "no"; + window_alert_on_bell = "no"; + cursor_blink_interval = "0"; + window_padding_width = "1"; + shell_integration = "yes"; + sync_with_monitor = "no"; + background_opacity = "0.8"; - font_family = "${config.mods.stylix.fonts.monospace.name}"; - bold_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold"; - italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Italic"; - bold_italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold Italic"; + font_family = "${config.mods.stylix.fonts.monospace.name}"; + bold_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold"; + italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Italic"; + bold_italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold Italic"; - background = base; - foreground = "#" + scheme.base05; - selection_foreground = "#" + scheme.base05; - selection_background = base; - url_color = "#" + scheme.base04; - cursor = "#" + scheme.base05; - active_border_color = "#" + scheme.base03; - inactive_border_color = "#" + scheme.base01; - active_tab_background = base; - active_tab_foreground = "#" + scheme.base05; - inactive_tab_background = "#" + scheme.base01; - inactive_tab_foreground = "#" + scheme.base04; - tab_bar_background = "#" + scheme.base01; + background = base; + foreground = "#" + scheme.base05; + selection_foreground = "#" + scheme.base05; + selection_background = base; + url_color = "#" + scheme.base04; + cursor = "#" + scheme.base05; + active_border_color = "#" + scheme.base03; + inactive_border_color = "#" + scheme.base01; + active_tab_background = base; + active_tab_foreground = "#" + scheme.base05; + inactive_tab_background = "#" + scheme.base01; + inactive_tab_foreground = "#" + scheme.base04; + tab_bar_background = "#" + scheme.base01; - color0 = base; - color1 = "#" + scheme.base08; - color2 = "#" + scheme.base0B; - color3 = "#" + scheme.base0A; - color4 = "#" + scheme.base0D; - color5 = "#" + scheme.base0E; - color6 = "#" + scheme.base0C; - color7 = "#" + scheme.base05; + mark1_foreground = "#" + scheme.base00; + mark1_background = "#" + scheme.base07; + mark2_foreground = "#" + scheme.base00; + mark2_background = "#" + scheme.base0E; + mark3_foreground = "#" + scheme.base00; + mark3_background = "#" + scheme.base08; - color8 = "#" + scheme.base03; - color9 = "#" + scheme.base08; - color10 = "#" + scheme.base0B; - color11 = "#" + scheme.base0A; - color12 = "#" + scheme.base0D; - color13 = "#" + scheme.base0E; - color14 = "#" + scheme.base0C; - color15 = "#" + scheme.base07; + color0 = "#" + scheme.base03; + color1 = "#" + scheme.base08; + color2 = "#" + scheme.base0B; + color3 = "#" + scheme.base0A; + color4 = "#" + scheme.base0D; + color5 = "#" + scheme.base06; + color6 = "#" + scheme.base0C; + color7 = "#" + scheme.base07; - shell = lib.mkIf config.mods.fish.enable "fish"; - } // config.mods.kitty.additionalConfig; + color8 = "#" + scheme.base04; + color9 = "#" + scheme.base08; + color10 = "#" + scheme.base0B; + color11 = "#" + scheme.base0A; + color12 = "#" + scheme.base0D; + color13 = "#" + scheme.base06; + color14 = "#" + scheme.base0C; + color15 = "#" + scheme.base0B; + shell = lib.mkIf config.mods.fish.enable "fish"; + } + // config.mods.kitty.additionalConfig + else config.mods.kitty.additionalConfig; }; } ); diff --git a/modules/programs/media.nix b/modules/programs/media.nix index fcb5e10..c37d62b 100644 --- a/modules/programs/media.nix +++ b/modules/programs/media.nix @@ -4,8 +4,7 @@ config, pkgs, ... -}: -{ +}: { options.mods.media = { useBasePackages = lib.mkOption { default = true; @@ -14,50 +13,111 @@ description = "Default media packages (If disabled, only the additional packages will be installed)"; }; additionalPackages = lib.mkOption { - default = [ ]; - example = [ pkgs.flatpak ]; + default = []; + example = [pkgs.flatpak]; type = with lib.types; listOf package; description = '' Additional media packages. ''; }; + specialPrograms = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special program configuration to be added which require programs.something notation. + ''; + }; + specialServices = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + special services configuration to be added which require an services.something notation. + ''; + }; + filePickerPortal = lib.mkOption { + default = "Term"; + example = "Gnome"; + type = with lib.types; oneOf [(enum ["Gnome" "Kde" "Lxqt" "Gtk" "Term" "Default"]) str]; + description = '' + The file picker portal to use (set with shana). + Default removes the config, allowing you to set it yourself. + ''; + }; + termFileChooserConfig = lib.mkOption { + default = { + cmd = "${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh"; + default_dir = "$HOME"; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = '' + Termfilechooser config + ''; + }; + }; + config = lib.optionalAttrs (options ? home.packages) { + xdg.configFile."xdg-desktop-portal-termfilechooser/config" = lib.mkIf (config.mods.media.filePickerPortal != "Term") { + source = (pkgs.formats.ini {}).generate "termchooser" { + filechooser = config.mods.media.termFileChooserConfig; + }; + }; + xdg.configFile."xdg-desktop-portal-shana/config.toml" = lib.mkIf (config.mods.media.filePickerPortal != "Default") { + source = let + name = + if (config.mods.media.filePickerPortal == "Term") + then "org.freedesktop.impl.portal.desktop.termfilechooser" + else config.mods.media.filePickerPortal; + in + (pkgs.formats.toml {}).generate "shana" { + open_file = name; + save_file = name; + save_files = name; + }; + }; + home.packages = + if config.mods.media.useBasePackages + then + with pkgs; + [ + # base audio + pipewire + wireplumber + # audio control + playerctl + # images + eog + # videos + mpv + # pdf + zathura + evince + libreoffice-fresh + onlyoffice-desktopeditors + pdftk + pdfpc + polylux2pdfpc + # spotify + # video editing + kdePackages.kdenlive + # image creation + inkscape + gimp + krita + yt-dlp + ] + ++ config.mods.media.additionalPackages + else config.mods.media.additionalPackages; + programs = + if config.mods.media.useBasePackages + then + { + obs-studio.enable = true; + obs-studio.plugins = with pkgs; [obs-studio-plugins.obs-vaapi]; + } + // config.mods.media.specialPrograms + else config.mods.media.specialPrograms; + services = config.mods.media.specialServices; }; - config = ( - lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.media.additionalPackages; - } - // (lib.mkIf config.mods.media.useBasePackages ( - lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ - # base audio - pipewire - wireplumber - # audio control - playerctl - # images - imv - # videos - mpv - # pdf - zathura - evince - libreoffice-fresh - onlyoffice-bin - pdftk - pdfpc - polylux2pdfpc - # spotify - # video editing - kdenlive - # image creation - inkscape - gimp - krita - yt-dlp - ]; - programs.obs-studio.enable = true; - programs.obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; - } - )) - ); } diff --git a/modules/programs/mime.nix b/modules/programs/mime.nix new file mode 100644 index 0000000..4da7aff --- /dev/null +++ b/modules/programs/mime.nix @@ -0,0 +1,161 @@ +# Copyright (c) 2020-2021 Mihai Fufezan +# credits to fufexan https://github.com/fufexan/dotfiles/blob/main/home/terminal/programs/xdg.nix +{ + mkDashDefault, + config, + lib, + options, + ... +}: let + browserName = + if (builtins.isString config.mods.homePackages.browser) + then config.mods.homePackages.browser + else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram + then config.mods.homePackages.browser.meta.mainProgram + else config.mods.homePackages.browser.pname; +in { + options.mods.mime = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables mime handling with nix"; + }; + imageTypes = lib.mkOption { + default = [ + "png" + "svg" + "jpeg" + "gif" + ]; + example = []; + type = with lib.types; listOf str; + description = "Image mime handlers"; + }; + videoTypes = lib.mkOption { + default = [ + "mp4" + "avi" + "mkv" + ]; + example = []; + type = with lib.types; listOf str; + description = "Video mime handlers"; + }; + audioTypes = lib.mkOption { + default = [ + "mp3" + "flac" + "wav" + "aac" + ]; + example = []; + type = with lib.types; listOf str; + description = "Audio mime handlers"; + }; + browserTypes = lib.mkOption { + default = [ + "json" + "x-extension-htm" + "x-extension-html" + "x-extension-shtml" + "x-extension-xht" + "x-extension-xhtml" + ]; + example = []; + type = with lib.types; listOf str; + description = "Browser mime handlers"; + }; + browserXTypes = lib.mkOption { + default = [ + "about" + "ftp" + "http" + "https" + "unknown" + ]; + example = []; + type = with lib.types; listOf str; + description = "Browser X mime handlers"; + }; + browserApplications = lib.mkOption { + default = ["${browserName}"]; + example = []; + type = with lib.types; listOf str; + description = "Applications used for handling browser mime types"; + }; + imageApplications = lib.mkOption { + default = ["eog"]; + example = []; + type = with lib.types; listOf str; + description = "Applications used for handling image mime types"; + }; + videoApplications = lib.mkOption { + default = ["mpv"]; + example = []; + type = with lib.types; listOf str; + description = "Applications used for handling video mime types"; + }; + audioApplications = lib.mkOption { + default = ["io.bassi.Amberol"]; + example = []; + type = with lib.types; listOf str; + description = "Applications used for handling audio mime types"; + }; + # TODO additional config + }; + config = lib.optionalAttrs (options ? home) { + xdg = let + xdgAssociations = type: program: list: + builtins.listToAttrs ( + map (e: { + name = "${type}/${e}"; + value = program; + }) + list + ); + + imageAc = xdgAssociations "image" config.mods.mime.imageApplications config.mods.mime.imageTypes; + videoAc = xdgAssociations "video" config.mods.mime.videoApplications config.mods.mime.videoTypes; + audioAc = xdgAssociations "audio" config.mods.mime.audioApplications config.mods.mime.audioTypes; + browserAc = + (xdgAssociations "application" config.mods.mime.browserApplications config.mods.mime.browserTypes) + // ( + xdgAssociations "x-scheme-handler" config.mods.mime.browserApplications + config.mods.mime.browserXTypes + ); + associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) ( + # TODO make configurable + { + "application/pdf" = ["org.pwmt.zathura-pdf-mupdf"]; + "text/html" = config.mods.mime.browserApplications; + "text/plain" = ["neovide"]; + "x-scheme-handler/chrome" = ["com.brave.browser"]; + "inode/directory" = ["yazi"]; + } + // imageAc + // audioAc + // videoAc + // browserAc + ); + in + lib.mkIf config.mods.mime.enable { + enable = true; + cacheHome = config.home.homeDirectory + "/.local/cache"; + + mimeApps = { + enable = true; + defaultApplications = associations; + }; + + userDirs = { + enable = mkDashDefault true; + createDirectories = mkDashDefault true; + extraConfig = { + XDG_SCREENSHOTS_DIR = mkDashDefault "${config.xdg.userDirs.pictures}/Screenshots"; + pws = mkDashDefault "${config.home.homeDirectory}/pws"; + }; + }; + }; + }; +} diff --git a/modules/programs/ncspot.nix b/modules/programs/ncspot.nix index 98dfe96..b998942 100644 --- a/modules/programs/ncspot.nix +++ b/modules/programs/ncspot.nix @@ -4,8 +4,7 @@ options, pkgs, ... -}: -{ +}: { options.mods.ncspot = { enable = lib.mkOption { default = false; @@ -13,16 +12,13 @@ type = lib.types.bool; description = "Enables ncspot with a config"; }; - }; - config = lib.mkIf config.mods.ncspot.enable ( - lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ ncspot ]; - xdg.configFile."ncspot/config.toml".source = (pkgs.formats.toml { }).generate "ncspot" { + config = lib.mkOption { + default = { notify = true; shuffle = true; cover_max_scale = 2; initial_screen = "library"; - library_tabs = [ "playlists" ]; + library_tabs = ["playlists"]; theme = { background = "#1a1b26"; primary = "#9aa5ce"; @@ -53,6 +49,16 @@ body = "%title"; }; }; + example = {}; + type = with lib.types; attrsOf anything; + description = "config"; + }; + }; + config = lib.mkIf config.mods.ncspot.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ncspot]; + xdg.configFile."ncspot/config.toml".source = + lib.mkIf config.mods.ncspot.useConfig (pkgs.formats.toml {}).generate "ncspot" config.mods.ncspot.config; } ); } diff --git a/modules/programs/nextcloud.nix b/modules/programs/nextcloud.nix index ab2333a..31216ee 100644 --- a/modules/programs/nextcloud.nix +++ b/modules/programs/nextcloud.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{lib, ...}: { options.mods = { nextcloud = { enable = lib.mkOption { @@ -9,19 +8,19 @@ description = "Enable nextcloud"; }; username = lib.mkOption { - default = "DashieTM"; + default = ""; example = "globi"; type = lib.types.str; description = "Your username"; }; url = lib.mkOption { - default = "cloud.dashie.org"; + default = ""; example = "cloud.globi.org"; type = lib.types.str; description = "Your url"; }; synclist = lib.mkOption { - default = [ ]; + default = []; example = [ { name = "sync globi folder"; @@ -36,5 +35,4 @@ }; }; }; - } diff --git a/modules/programs/niri.nix b/modules/programs/niri.nix new file mode 100644 index 0000000..0531829 --- /dev/null +++ b/modules/programs/niri.nix @@ -0,0 +1,392 @@ +{ + mkDashDefault, + config, + lib, + options, + pkgs, + ... +}: let + defaultWmConf = import ../../lib/wm.nix; +in { + options.mods.niri = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enable Niri + ''; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Use preconfigured Niri config. + ''; + }; + customConfig = lib.mkOption { + default = ''''; + example = ''''; + type = lib.types.lines; + description = '' + Custom Niri configuration. + Will be merged with default configuration if enabled. + ''; + }; + }; + + config = lib.mkIf config.mods.niri.enable ( + lib.optionalAttrs (options ? wayland.windowManager.hyprland) { + # TODO deduplicate and abstract away base window management config + # install Niri related packages + home.packages = with pkgs; [ + xorg.xprop + grim + slurp + satty + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + kdePackages.xdg-desktop-portal-kde + xdg-desktop-portal-shana + copyq + wl-clipboard + + niri + xwayland-satellite + ]; + + xdg.configFile."niri/config.kdl" = let + mkNiriMod = mods: + builtins.map (mod: + if mod == "Mod" + then config.mods.wm.modKey + "+" + else "${mod}" + "+") + mods + |> lib.strings.concatStringsSep ""; + mkNiriArg = args: + if args != [] + then let + concatCommand = lib.strings.concatStringsSep " " args; + validCommand = builtins.replaceStrings [''"''] [''\"''] concatCommand; + in "\"${validCommand}\"" + else ""; + mkNiriCommand = bind: let + args = bind.args or []; + in + if bind.command == "quit" + then "quit;" + else if bind.command == "killActive" + then "close-window;" + else if bind.command == "moveFocusTop" + then "focus-window-up;" + else if bind.command == "focusWorkspace" + then "focus-workspace" + " " + mkNiriArg args + ";" + else if bind.command == "moveWindowRight" + then "move-column-right-or-to-monitor-right;" + else if bind.command == "moveWindowDown" + then "move-window-down;" + else if bind.command == "moveWindowLeft" + then "move-column-left-or-to-monitor-left;" + else if bind.command == "moveWindowUp" + then "move-window-up;" + else if bind.command == "moveFocusUp" + then "focus-window-up;" + else if bind.command == "moveFocusRight" + then "focus-column-or-monitor-right;" + else if bind.command == "moveFocusDown" + then "focus-window-down;" + else if bind.command == "moveFocusLeft" + then "focus-column-or-monitor-left;" + else if bind.command == "toggleFloating" + then "toggle-window-floating;" + else if bind.command == "toggleFullscreen" + then "fullscreen-window;" + else if bind.command == "moveToWorkspace" + then "move-window-to-workspace" + " " + mkNiriArg args + ";" + else if bind.command == "spawn" + then "spawn" + " " + mkNiriArg args + ";" + else if bind.command == "spawn-sh" + then "spawn-sh" + " " + mkNiriArg args + ";" + else if bind.command.niri != null + then bind.command.niri + " " + mkNiriArg args + ";" + else ""; + + mkNiriBinds = cfg: + '' binds { + '' + + ( + ( + builtins.map ( + bind: + /* + kdl + */ + if bind ? key && bind ? command + then '' + ${mkNiriMod (bind.modKeys or [])}${bind.key} ${ + if + bind ? meta + && bind.meta ? niri + then + ( + if + bind.meta.niri ? desc + && bind.meta.niri.desc != "" + then "hotkey-overlay-title=\"" + bind.meta.niri.desc + "\"" + else "" + ) + + " " + + ( + if + bind.meta.niri ? repeat + && bind.meta.niri.repeat + then "repeat=true" + else "repeat=false" + ) + + " " + + ( + if + bind.meta.niri ? allowWhileLocked + && bind.meta.niri.allowWhileLocked + then "allow-when-locked=true" + else "" + ) + + " " + + ( + if + bind.meta.niri ? allowInhibit + && bind.meta.niri.allowInhibit + then "allow-inhibiting=true" + else "allow-inhibiting=false" + ) + else "" + } { ${ + mkNiriCommand bind + } } + '' + else '''' + ) + (( + cfg.mods.wm.binds + ++ ( + if cfg.mods.wm.useDefaultBinds + then defaultWmConf.defaultBinds cfg + else [] + ) + ) + |> builtins.filter (bind: !(hasInvalidCustomCommand bind))) + ) + |> lib.strings.concatLines + ) + + '' + } + ''; + mkVrr = vrr: + if vrr + then "true" + else "false"; + mkNiriMonitors = cfg: + (builtins.map ( + monitor: + # TODO vrr + /* + kdl + */ + '' + output "${monitor.name}" { + variable-refresh-rate on-demand=${mkVrr monitor.vrr} + mode "${builtins.toString monitor.resolutionX}x${builtins.toString monitor.resolutionY}@${builtins.toString monitor.refreshrate}" + scale ${builtins.toString monitor.scale} + transform "${ + if (monitor.transform == "0") + then "normal" + else monitor.transform + }" + position x=${builtins.toString monitor.positionX} y=${builtins.toString monitor.positionY} + } + '' + ) + cfg.mods.wm.monitors) + |> lib.strings.concatLines; + mkNiriWorkspaces = cfg: + (builtins.map ( + workspace: + /* + kdl + */ + '' + workspace "${workspace.name}" { + open-on-output "${workspace.monitor}" + } + '' + ) + cfg.mods.wm.workspaces) + |> lib.strings.concatLines; + mkNiriWindowRules = cfg: ( + ( + builtins.map ( + rule: + /* + kdl + */ + '' + window-rule { + ${rule} + } + '' + ) + ( + cfg.mods.wm.windowRules.niri + ++ ( + if cfg.mods.wm.useDefaultWindowRules + then defaultWmConf.defaultWindowRules.niri + else [] + ) + ) + ) + |> lib.strings.concatLines + ); + hasInvalidCustomCommand = bind: !(bind ? command) || (!(builtins.isString bind.command) && bind.command.niri or null == null); + mkNiriEnv = config: let + defaultEnv = + if config.mods.wm.useDefaultEnv + then defaultWmConf.defaultEnv config + else { + all = {}; + niri = {}; + }; + userEnv = + if config.mods.wm.env ? all + then config.mods.wm.env.all // config.mods.wm.env.niri + else config.mods.wm.env; + env = + userEnv + // defaultEnv.all + // defaultEnv.niri; + in + '' + environment { + '' + + ( + lib.attrsets.mapAttrsToList ( + name: value: "${name} \"${value}\"" + ) + env + |> lib.strings.concatLines + ) + + '' + } + ''; + mkNiriAutoStart = config: let + defaultStartup = + if config.mods.wm.useDefaultStartup + then defaultWmConf.defaultStartup config + else { + all = {}; + niri = {}; + }; + userStartup = + if config.mods.wm.startup ? all + then config.mods.wm.startup.all ++ config.mods.wm.startup.niri + else config.mods.wm.startup; + autoStart = userStartup ++ defaultStartup.all ++ defaultStartup.niri; + in + (builtins.map (value: "spawn-at-startup \"${value}\"") + autoStart) + |> lib.strings.concatLines; + defaultConfig = + /* + kdl + */ + '' + input { + keyboard { + xkb { + layout "enIntUmlaut" + } + repeat-delay 200 + repeat-rate 25 + numlock + } + + touchpad { + tap + natural-scroll + } + + mouse { + accel-speed 0.2 + accel-profile "flat" + } + + focus-follows-mouse max-scroll-amount="25%" + } + + layout { + // Set gaps around windows in logical pixels. + gaps 10 + center-focused-column "never" + always-center-single-column + + preset-column-widths { + proportion 0.33333 + proportion 0.5 + proportion 1.0 + } + + default-column-width { proportion 0.5; } + focus-ring { + width 3 + inactive-color "#505050" + active-gradient from="#ff0000" to="#00ff00" angle=45 + } + + border { + off + } + + // You can enable drop shadows for windows. + shadow { + on + softness 30 + spread 5 + offset x=0 y=5 + color "#0007" + } + } + + ${ + if config.mods.gpu.nvidia.enable + then '' + debug { + wait-for-frame-completion-before-queueing + } + '' + else '''' + } + + // Autostart + + hotkey-overlay { + skip-at-startup + } + + prefer-no-csd + '' + + mkNiriMonitors config + + mkNiriBinds config + + mkNiriWorkspaces config + + mkNiriWindowRules config + + mkNiriEnv config + + mkNiriAutoStart config; + in + mkDashDefault { + text = + if config.mods.niri.useDefaultConfig + then defaultConfig + config.mods.niri.customConfig + else config.mods.niri.customConfig; + }; + } + ); +} diff --git a/modules/programs/onedrive.nix b/modules/programs/onedrive.nix new file mode 100644 index 0000000..56bd79d --- /dev/null +++ b/modules/programs/onedrive.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + options, + pkgs, + ... +}: { + options.mods = { + onedrive = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enable onedrive program and service"; + }; + }; + }; + config = lib.mkIf config.mods.onedrive.enable ( + lib.optionalAttrs (options ? environment) { + services.onedrive.enable = true; + environment.systemPackages = [pkgs.onedrive]; + } + ); +} diff --git a/modules/programs/oxi/default.nix b/modules/programs/oxi/default.nix index 7dee3fd..83c4f23 100644 --- a/modules/programs/oxi/default.nix +++ b/modules/programs/oxi/default.nix @@ -4,13 +4,13 @@ options, inputs, ... -}: -{ +}: { imports = [ ./oxidash.nix ./oxinoti.nix - ./oxishut.nix ./oxipaste.nix + ./oxirun.nix + ./oxishut.nix ]; options.mods.oxi = { enable = lib.mkOption { @@ -34,6 +34,12 @@ type = lib.types.bool; description = "Enables hyprdock"; }; + settings = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = "settings for hyprdock"; + }; }; oxicalc = { enable = lib.mkOption { @@ -47,7 +53,10 @@ config = lib.mkIf config.mods.oxi.enable ( lib.optionalAttrs (options ? home.packages) { programs = { - hyprdock.enable = lib.mkIf config.mods.oxi.hyprdock.enable true; + hyprdock = { + inherit (config.mods.oxi.hyprdock) enable; + inherit (config.mods.oxi.hyprdock) settings; + }; oxicalc.enable = lib.mkIf config.mods.oxi.oxicalc.enable true; ReSet = lib.mkIf config.mods.oxi.ReSet.enable { enable = true; @@ -65,5 +74,8 @@ }; }; } + // lib.optionalAttrs (options ? services.logind && options ? services.logind.settings) { + services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore"; + } ); } diff --git a/modules/programs/oxi/oxidash.nix b/modules/programs/oxi/oxidash.nix index 03cb684..9ea519e 100644 --- a/modules/programs/oxi/oxidash.nix +++ b/modules/programs/oxi/oxidash.nix @@ -2,9 +2,15 @@ lib, config, options, + pkgs, + inputs, ... -}: -{ +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; +in { options.mods.oxi.oxidash = { enable = lib.mkOption { default = true; @@ -18,52 +24,54 @@ programs.oxidash.enable = true; xdg.configFile."oxidash/style.css" = { text = '' + @define-color bg #${scheme.base00}; + @define-color primary #${scheme.base0D}; + #MainWindow { border-radius: 10px; + background-color: transparent; } #MainBox { border-radius: 10px; + border: 1px solid @primary; + background-color: @bg; } #MainButtonBox { padding: 10px; margin: 5px 0px 5px 0px; border-radius: 5px; - border: solid 2px #327cd5; + border: solid 1px @primary; } - #DoNotDisturbButton { - } + #DoNotDisturbButton {} - #ExitButton { - } + #ExitButton {} - #ClearNotificationsButton { - } + #ClearNotificationsButton {} - #NotificationsWindow { - } + #NotificationsWindow {} .debugimage { - border: solid 3px blue; + border: solid 3px @primary; } .Notification { padding: 10px; margin: 5px 0px 5px 0px; - border: solid 2px #327cd5; + border: solid 1px @primary; border-radius: 5px; } .CloseNotificationButton { margin: 0px 5px 0px 10px; } - .PictureButtonBox { + + .PictureButtonBox {} + + .BaseBox {} } - .BaseBox { - } - } ''; }; } diff --git a/modules/programs/oxi/oxinoti.nix b/modules/programs/oxi/oxinoti.nix index 188ec11..d265af3 100644 --- a/modules/programs/oxi/oxinoti.nix +++ b/modules/programs/oxi/oxinoti.nix @@ -2,9 +2,15 @@ lib, config, options, + pkgs, + inputs, ... -}: -{ +}: let + # at time of using this here, stylix might not be evaluated yet + # hence ensure it is by using base16 mkSchemeAttrs + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; +in { options.mods.oxi.oxinoti = { enable = lib.mkOption { default = true; @@ -17,9 +23,16 @@ lib.optionalAttrs (options ? xdg.configFile) { programs.oxinoti.enable = true; xdg.configFile."oxinoti/style.css" = { - text = # css + text = + # css '' - @import url("/home/${config.conf.username}/.config/gtk-3.0/gtk.css"); + @import url("/home/dashie/.config/gtk-3.0/gtk.css"); + + @define-color bg #${scheme.base00}; + @define-color bghover #${scheme.base02}; + @define-color primary #${scheme.base0D}; + @define-color red #${scheme.base08}; + @define-color green #${scheme.base0B}; #MainWindow { background-color: transparent; @@ -34,31 +47,37 @@ } .NotificationBox { - background-color: #353747; + background-color: @bg; border-radius: 5px; border: solid 1px; margin: 0px; - padding: 5px; + } + + .NotificationBox button { + background-color: @bg; + } + + .NotificationBox button:hover { + background-color: @bghover; } .NotificationLow { - border-color: green; + border-color: @green; } .NotificationNormal { - border-color: purple; + border-color: @primary; } .NotificationUrgent { - border-color: red; + border-color: @red; } .miscbox { margin: 0px 10px 0px 0px; } - .bodybox { - } + .bodybox {} .imagebox { margin: 0px 0px 0px 10px; @@ -84,8 +103,7 @@ font-size: 2rem; } - .image { - } + .image {} .bold { font-weight: bold; diff --git a/modules/programs/oxi/oxipaste.nix b/modules/programs/oxi/oxipaste.nix index aa4af70..4ec7b1d 100644 --- a/modules/programs/oxi/oxipaste.nix +++ b/modules/programs/oxi/oxipaste.nix @@ -3,8 +3,7 @@ config, options, ... -}: -{ +}: { options.mods.oxi.oxipaste = { enable = lib.mkOption { default = true; diff --git a/modules/programs/oxi/oxirun.nix b/modules/programs/oxi/oxirun.nix new file mode 100644 index 0000000..55f4d75 --- /dev/null +++ b/modules/programs/oxi/oxirun.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + options, + ... +}: { + options.mods.oxi.oxirun = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables OxiRun"; + }; + }; + config = lib.mkIf (config.mods.oxi.oxirun.enable && config.mods.oxi.enable) ( + lib.optionalAttrs (options ? xdg.configFile) { + programs.oxirun.enable = true; + } + ); +} diff --git a/modules/programs/oxi/oxishut.nix b/modules/programs/oxi/oxishut.nix index 466be06..25ebe0b 100644 --- a/modules/programs/oxi/oxishut.nix +++ b/modules/programs/oxi/oxishut.nix @@ -3,8 +3,7 @@ config, options, ... -}: -{ +}: { options.mods.oxi.oxishut = { enable = lib.mkOption { default = true; diff --git a/modules/programs/piper.nix b/modules/programs/piper.nix index dac9ece..24beced 100644 --- a/modules/programs/piper.nix +++ b/modules/programs/piper.nix @@ -4,8 +4,7 @@ options, pkgs, ... -}: -{ +}: { options.mods.piper = { enable = lib.mkOption { default = false; @@ -15,7 +14,7 @@ }; }; config = lib.mkIf config.mods.piper.enable ( - lib.optionalAttrs (options ? services.ratbagd) { services.ratbagd.enable = true; } - // lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ piper ]; } + lib.optionalAttrs (options ? services.ratbagd) {services.ratbagd.enable = true;} + // lib.optionalAttrs (options ? home.packages) {home.packages = with pkgs; [piper];} ); } diff --git a/modules/programs/plymouth.nix b/modules/programs/plymouth.nix new file mode 100644 index 0000000..af9c615 --- /dev/null +++ b/modules/programs/plymouth.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + options, + ... +}: { + options.mods.plymouth = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables the plymouth"; + }; + }; + config = lib.mkIf config.mods.plymouth.enable ( + lib.optionalAttrs (options ? boot.plymouth) {boot.plymouth.enable = true;} + ); +} diff --git a/modules/programs/podman.nix b/modules/programs/podman.nix deleted file mode 100644 index 58441e4..0000000 --- a/modules/programs/podman.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - lib, - config, - options, - pkgs, - ... -}: -{ - options.mods.podman = { - enable = lib.mkOption { - default = true; - example = false; - type = lib.types.bool; - description = "Enables and configures podman"; - }; - }; - config = lib.mkIf config.mods.podman.enable ( - lib.optionalAttrs (options ? virtualisation.podman) { - environment.systemPackages = with pkgs; [ - podman-tui - podman-compose - dive - ]; - virtualisation = { - containers.enable = true; - podman = { - enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; - }; - }; - } - ); -} diff --git a/modules/programs/printing.nix b/modules/programs/printing.nix index 80144b8..98bbe4f 100644 --- a/modules/programs/printing.nix +++ b/modules/programs/printing.nix @@ -4,8 +4,7 @@ options, pkgs, ... -}: -{ +}: { options.mods.printing = { enable = lib.mkOption { default = true; @@ -17,14 +16,22 @@ config = lib.mkIf config.mods.printing.enable ( lib.optionalAttrs (options ? services.printing) { # Enable CUPS to print documents. - services.printing.enable = true; - services.printing.browsing = true; - services.printing.drivers = [ pkgs.hplip ]; - services.printing.startWhenNeeded = true; # optional - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; + environment.systemPackages = with pkgs; [ + simple-scan + ]; + hardware.sane.enable = true; + services = { + printing = { + enable = true; + browsing = true; + drivers = [pkgs.hplip]; + startWhenNeeded = true; # optional + }; + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; }; } ); diff --git a/modules/programs/scripts.nix b/modules/programs/scripts.nix index 8a3889e..98eb26b 100644 --- a/modules/programs/scripts.nix +++ b/modules/programs/scripts.nix @@ -4,45 +4,38 @@ options, pkgs, ... -}: -{ +}: { options.mods.scripts = { - change-brightness = lib.mkOption { + changeBrightness = lib.mkOption { default = true; example = false; type = lib.types.bool; description = "Enables the change-brightness script"; }; - audio-control = lib.mkOption { + audioControl = lib.mkOption { default = true; example = false; type = lib.types.bool; - description = "Enables the audio-control script"; + description = "Enables the audioControl script"; }; scripts = lib.mkOption { - default = [ ]; - example = [ ]; + default = []; + example = []; description = "More scripts to be passed. (check existing ones for types and examples)"; }; }; - config = ( - lib.optionalAttrs (options ? home.packages) { - home.packages = [ - (lib.mkIf config.mods.scripts.change-brightness ( - pkgs.writeShellScriptBin "change-brightness" '' - set_brightness() { + config = lib.optionalAttrs (options ? home.packages) { + home.packages = + [ + (lib.mkIf config.mods.scripts.changeBrightness ( + pkgs.writeShellScriptBin "changeBrightness" '' brightnessctl set "$1" CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') - dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" - } - - if [ "$1" == "brightness" ]; then - set_brightness "$2" - fi + notify-send -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" '' )) - (lib.mkIf config.mods.scripts.audio-control ( - pkgs.writeShellScriptBin "audio-control" '' + (lib.mkIf config.mods.scripts.audioControl ( + pkgs.writeShellScriptBin "audioControl" '' ncspot() { NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n') CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') @@ -124,7 +117,7 @@ fi '' )) - ] ++ config.mods.scripts.scripts; - } - ); + ] + ++ config.mods.scripts.scripts; + }; } diff --git a/modules/programs/sddm.nix b/modules/programs/sddm.nix index d358777..57328d4 100644 --- a/modules/programs/sddm.nix +++ b/modules/programs/sddm.nix @@ -3,8 +3,7 @@ options, config, ... -}: -{ +}: { options.mods.sddm = { enable = lib.mkOption { default = false; @@ -19,7 +18,7 @@ description = "Use default options provided by module. If disabled, will only apply extraOptions."; }; extraOptions = lib.mkOption { - default = { }; + default = {}; example = { wayland.enable = false; }; diff --git a/modules/programs/sops.nix b/modules/programs/sops.nix index b4b9657..5897eaa 100644 --- a/modules/programs/sops.nix +++ b/modules/programs/sops.nix @@ -5,8 +5,7 @@ options, root, ... -}: -{ +}: { options.mods.sops = { enable = lib.mkOption { default = true; @@ -15,31 +14,48 @@ description = "Enable sops secrets"; }; secrets = lib.mkOption { - default = { }; + default = {}; example = { - hub = { }; - lab = { }; - ${config.conf.username} = { }; - nextcloud = { }; - access = { }; + hub = {}; + lab = {}; + ${config.conf.username} = {}; + nextcloud = {}; + access = {}; }; type = with lib.types; attrsOf anything; description = "secrets for sops"; }; + sopsPath = lib.mkOption { + default = root + /secrets/secrets.yaml; + example = "/your/path"; + type = with lib.types; + oneOf [ + str + path + ]; + description = "sops secrets path"; + }; + validateSopsFile = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to validate the sops file -> set this to false when using full paths"; + }; }; config = lib.mkIf config.mods.sops.enable ( lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ sops ]; + home.packages = with pkgs; [sops]; sops = { gnupg = { home = "~/.gnupg"; - sshKeyPaths = [ ]; + sshKeyPaths = []; }; - defaultSopsFile = root + /secrets/secrets.yaml; + defaultSopsFile = config.mods.sops.sopsPath; + validateSopsFiles = config.mods.sops.validateSopsFile; secrets = config.mods.sops.secrets; }; - systemd.user.services.mbsync.Unit.After = [ "sops-nix.service" ]; + systemd.user.services.mbsync.Unit.After = ["sops-nix.service"]; } ); } diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 04f877e..de86504 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -1,12 +1,12 @@ { + mkDashDefault, lib, config, options, pkgs, inputs, ... -}: -{ +}: { options.mods = { starship = { enable = lib.mkOption { @@ -17,7 +17,7 @@ Enables starship prompt ''; }; - use_default_prompt = lib.mkOption { + useDefaultPrompt = lib.mkOption { default = true; example = false; type = lib.types.bool; @@ -25,9 +25,9 @@ Enables preconfigured prompt ''; }; - custom_prompt = lib.mkOption { - default = { }; - example = { }; + customPrompt = lib.mkOption { + default = {}; + example = {}; type = with lib.types; attrsOf anything; description = '' Custom configuration for prompt. @@ -40,138 +40,136 @@ # environment.systemPackages needed in order to configure systemwide config = lib.mkIf config.mods.starship.enable ( lib.optionalAttrs (options ? environment.systemPackages) { - programs.starship = - let - base16 = pkgs.callPackage inputs.base16.lib { }; - scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); - code_format = "[](bg:prev_bg fg:#5256c3)[ $symbol ($version)](bg:#5256c3)"; - in - { - enable = true; - interactiveOnly = true; - presets = lib.mkIf config.mods.starship.use_default_prompt [ "pastel-powerline" ]; - settings = - lib.mkIf config.mods.starship.use_default_prompt { - # derived from https://starship.rs/presets/pastel-powerline - format = "$username$directory$git_branch$git_status$git_metrics[ ](bg:none fg:prev_bg)"; - right_format = "$c$elixir$elm$golang$gradle$haskell$java$julia$nodejs$nim$rust$scala$python$ocaml$opa$perl$zig$dart$dotnet$nix_shell$shell$solidity[](bg:prev_bg fg:#3465A4)$time$os"; - username = { - show_always = false; - style_user = "bg:#5277C3 fg:#${scheme.base05}"; - style_root = "bg:#5277C3 fg:#${scheme.base05}"; - format = "[ $user ]($style)[](bg:#3465A4 fg:#5277C3)"; - disabled = false; + programs.starship = let + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; + code_format = "[](bg:prev_bg fg:#5256c3)[ $symbol ($version)](bg:#5256c3)"; + in { + enable = true; + interactiveOnly = mkDashDefault true; + presets = lib.mkIf config.mods.starship.useDefaultPrompt ["pastel-powerline"]; + settings = + lib.mkIf config.mods.starship.useDefaultPrompt { + # derived from https://starship.rs/presets/pastel-powerline + format = "$username$directory$git_branch$git_status$git_metrics[ ](bg:none fg:prev_bg)"; + right_format = "$c$elixir$elm$golang$gradle$haskell$java$julia$nodejs$nim$rust$scala$python$ocaml$opa$perl$zig$dart$dotnet$nix_shell$shell$solidity[](bg:prev_bg fg:#3465A4)$time$os"; + username = { + show_always = false; + style_user = "bg:#5277C3 fg:#${scheme.base05}"; + style_root = "bg:#5277C3 fg:#${scheme.base05}"; + format = "[ $user ]($style)[](bg:#3465A4 fg:#5277C3)"; + disabled = false; + }; + os = { + symbols = { + NixOS = "  "; }; - os = { - symbols = { - NixOS = "  "; - }; - style = "bg:#3465A4 fg:#${scheme.base05}"; - disabled = false; - }; - directory = { - style = "bg:#3465A4 fg:#${scheme.base05}"; - format = "[ $path ]($style)"; - truncation_length = 3; - truncation_symbol = "…/"; - }; - git_branch = { - always_show_remote = true; - symbol = ""; - style = "bg:#5256c3 fg:#${scheme.base05}"; - format = "[ ](bg:#5256c3 fg:prev_bg)[$symbol ($remote_name )$branch ]($style)"; - }; - git_status = { - staged = "+\${count} (fg:#C4A000)"; - ahead = "⇡\${count} (fg:#C4A000)"; - diverged = "⇕⇡\${count} (fg:#C4A000)"; - behind = "⇣\${count} (fg:#C4A000)"; - stashed = " "; - untracked = "?\${count} (fg:#C4A000)"; - modified = "!\${count} (fg:#C4A000)"; - deleted = "✘\${count} (fg:#C4A000)"; - conflicted = "=\${count} (fg:#C4A000)"; - renamed = "»\${count} (fg:#C4A000)"; - style = "bg:#5256c3 fg:fg:#C4A000"; - format = "[$all_status$ahead_behind]($style)"; - }; - git_metrics = { - disabled = false; - format = "([| ](bg:#5256c3)[+$added]($added_style bg:#5256c3)[ -$deleted]($deleted_style bg:#5256c3))"; - }; - c = { - format = code_format; - }; - elixir = { - format = code_format; - }; - elm = { - format = code_format; - }; - golang = { - format = code_format; - }; - gradle = { - format = code_format; - }; - haskell = { - format = code_format; - }; - java = { - format = code_format; - }; - julia = { - format = code_format; - }; - nodejs = { - format = code_format; - }; - nim = { - format = code_format; - }; - nix_shell = { - symbol = ""; - format = code_format; - }; - rust = { - format = code_format; - }; - scala = { - format = code_format; - }; - typst = { - format = code_format; - }; - python = { - format = code_format; - }; - ocaml = { - format = code_format; - }; - opa = { - format = code_format; - }; - perl = { - format = code_format; - }; - zig = { - format = code_format; - }; - dart = { - format = code_format; - }; - dotnet = { - format = code_format; - }; - time = { - disabled = false; - time_format = "%R"; # Hour:Minute Format - style = "bg:#3465A4 fg:#${scheme.base05}"; - format = "[ $time ]($style)"; - }; - } - // config.mods.starship.custom_prompt; - }; + style = "bg:#3465A4 fg:#${scheme.base05}"; + disabled = false; + }; + directory = { + style = "bg:#3465A4 fg:#${scheme.base05}"; + format = "[ $path ]($style)"; + truncation_length = 3; + truncation_symbol = "…/"; + }; + git_branch = { + always_show_remote = true; + symbol = ""; + style = "bg:#5256c3 fg:#${scheme.base05}"; + format = "[ ](bg:#5256c3 fg:prev_bg)[$symbol ($remote_name )$branch ]($style)"; + }; + git_status = { + staged = "+\${count} (fg:#C4A000)"; + ahead = "⇡\${count} (fg:#C4A000)"; + diverged = "⇕⇡\${count} (fg:#C4A000)"; + behind = "⇣\${count} (fg:#C4A000)"; + stashed = " "; + untracked = "?\${count} (fg:#C4A000)"; + modified = "!\${count} (fg:#C4A000)"; + deleted = "✘\${count} (fg:#C4A000)"; + conflicted = "=\${count} (fg:#C4A000)"; + renamed = "»\${count} (fg:#C4A000)"; + style = "bg:#5256c3 fg:fg:#C4A000"; + format = "[$all_status$ahead_behind]($style)"; + }; + git_metrics = { + disabled = false; + format = "([| ](bg:#5256c3)[+$added]($added_style bg:#5256c3)[ -$deleted]($deleted_style bg:#5256c3))"; + }; + c = { + format = code_format; + }; + elixir = { + format = code_format; + }; + elm = { + format = code_format; + }; + golang = { + format = code_format; + }; + gradle = { + format = code_format; + }; + haskell = { + format = code_format; + }; + java = { + format = code_format; + }; + julia = { + format = code_format; + }; + nodejs = { + format = code_format; + }; + nim = { + format = code_format; + }; + nix_shell = { + symbol = ""; + format = code_format; + }; + rust = { + format = code_format; + }; + scala = { + format = code_format; + }; + typst = { + format = code_format; + }; + python = { + format = code_format; + }; + ocaml = { + format = code_format; + }; + opa = { + format = code_format; + }; + perl = { + format = code_format; + }; + zig = { + format = code_format; + }; + dart = { + format = code_format; + }; + dotnet = { + format = code_format; + }; + time = { + disabled = false; + time_format = "%R"; # Hour:Minute Format + style = "bg:#3465A4 fg:#${scheme.base05}"; + format = "[ $time ]($style)"; + }; + } + // config.mods.starship.customPrompt; + }; } ); } diff --git a/modules/programs/streamcontroller.nix b/modules/programs/streamcontroller.nix new file mode 100644 index 0000000..544367f --- /dev/null +++ b/modules/programs/streamcontroller.nix @@ -0,0 +1,39 @@ +{ + lib, + config, + options, + ... +}: { + options.mods = { + streamcontroller = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables streamcontroller + ''; + }; + 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" = + lib.mkIf + (!isNull config.mods.streamcontroller.configFilePath) + {source = config.mods.streamcontroller.configFilePath;}; + }) + ); +} diff --git a/modules/programs/stylix.nix b/modules/programs/stylix.nix index 9a84760..dd11e8c 100644 --- a/modules/programs/stylix.nix +++ b/modules/programs/stylix.nix @@ -1,18 +1,37 @@ { + mkDashDefault, lib, config, options, + unstable, + inputs, pkgs, ... -}: -{ +}: let + svg = ../../assets/rainbow.svg; + sd = lib.getExe pkgs.sd; + base16 = pkgs.callPackage inputs.base16.lib {}; + mkWallpaper = schemeStr: let + scheme = base16.mkSchemeAttrs schemeStr; + in + pkgs.runCommand "rainbow.png" {} '' + cat ${svg} \ + | ${sd} '#f9e2af' '#${scheme.base0A}' \ + | ${sd} '#fab387' '#${scheme.base09}' \ + | ${sd} '#f38ba8' '#${scheme.base08}' \ + | ${sd} '#89b4fa' '#${scheme.base0D}' \ + | ${sd} '#cba6f7' '#${scheme.base0E}' \ + | ${sd} '#a6e3a1' '#${scheme.base0B}' \ + | ${sd} '#1e1e2e' '#${scheme.base00}' \ + | ${lib.getExe pkgs.imagemagick} svg:- png:$out + ''; +in { options.mods.stylix = { colorscheme = lib.mkOption { - default = { + default = "catppuccin-mocha"; + example = { # custom tokyo night base00 = "1A1B26"; - # base01 = "16161E"; - # base01 = "15161e"; base01 = "191a25"; base02 = "2F3549"; base03 = "444B6A"; @@ -21,21 +40,15 @@ base06 = "CBCCD1"; base07 = "D5D6DB"; base08 = "C0CAF5"; - base09 = "A9B1D6"; + base09 = "A9B1D7"; base0A = "0DB9D7"; base0B = "9ECE6A"; base0C = "B4F9F8"; - # base0D = "2AC3DE"; - # base0D = "A9B1D6"; - # base0D = "62A0EA"; - # base0D = "779EF1"; base0D = "366fea"; base0E = "BB9AF7"; base0F = "F7768E"; }; - example = "catppuccin-mocha"; - type = - with lib.types; + type = with lib.types; oneOf [ str attrs @@ -46,6 +59,8 @@ Can be an attribute set with base00 to base0F, a string that leads to a yaml file in base16-schemes path, or a path to a custom yaml file. + + Also supports the oxiced theme in an oxiced attrset. ''; }; cursor = lib.mkOption { @@ -54,55 +69,55 @@ name = "Bibata-Modern-Classic"; size = 24; }; - example = { }; + example = {}; type = with lib.types; attrsOf anything; description = "Xcursor config"; }; fonts = lib.mkOption { default = { serif = { - package = pkgs.cantarell-fonts; - name = "Cantarell"; + package = unstable.adwaita-fonts; + name = "Adwaita Sans"; }; sansSerif = { - package = pkgs.cantarell-fonts; - name = "Cantarell"; + package = unstable.adwaita-fonts; + name = "Adwaita Sans"; }; monospace = { - package = (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }); + package = unstable.nerd-fonts.jetbrains-mono; name = "JetBrainsMono Nerd Font Mono"; }; emoji = { - package = pkgs.noto-fonts-emoji; + package = pkgs.noto-fonts-color-emoji; name = "Noto Color Emoji"; }; }; - example = { }; + example = {}; type = with lib.types; attrsOf anything; description = "font config"; }; }; - config = + config = let + scheme = + if builtins.isAttrs config.mods.stylix.colorscheme + then config.mods.stylix.colorscheme + else "${pkgs.base16-schemes}/share/themes/${config.mods.stylix.colorscheme}.yaml"; + in (lib.optionalAttrs (options ? stylix) { stylix = { enable = true; - image = ../../base/black.jpg; - polarity = "dark"; + image = mkDashDefault (mkWallpaper scheme); + polarity = mkDashDefault "dark"; targets = { - nixvim.enable = false; - fish.enable = false; + nixvim.enable = mkDashDefault false; + fish.enable = mkDashDefault false; }; fonts = config.mods.stylix.fonts; cursor = config.mods.stylix.cursor; - base16Scheme = ( - if builtins.isAttrs config.mods.stylix.colorscheme then - config.mods.stylix.colorscheme - else - "${pkgs.base16-schemes}/share/themes/${config.mods.stylix.colorscheme}.yaml" - ); + base16Scheme = scheme; }; }) // lib.optionalAttrs (options ? environment.systemPackages) { diff --git a/modules/programs/superfreq.nix b/modules/programs/superfreq.nix new file mode 100644 index 0000000..f031e2f --- /dev/null +++ b/modules/programs/superfreq.nix @@ -0,0 +1,28 @@ +{ + lib, + options, + config, + ... +}: { + options.mods.superfreq = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = ''Enables superfreq''; + }; + settings = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = ''Superfreq config''; + }; + }; + + config = lib.optionalAttrs (options ? services.superfreq) { + services.superfreq = { + enable = config.mods.superfreq.enable; + settings = config.mods.superfreq.settings; + }; + }; +} diff --git a/modules/programs/supersonic.nix b/modules/programs/supersonic.nix new file mode 100644 index 0000000..3b732df --- /dev/null +++ b/modules/programs/supersonic.nix @@ -0,0 +1,73 @@ +{ + lib, + config, + options, + pkgs, + inputs, + ... +}: let + base16 = pkgs.callPackage inputs.base16.lib {}; + scheme = base16.mkSchemeAttrs config.stylix.base16Scheme; +in { + options.mods.supersonic = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables and configures supersonic"; + }; + variant = lib.mkOption { + default = "wayland"; + example = "x11"; + type = lib.types.enum [ + "wayland" + "x11" + ]; + description = "The variant of supersonic"; + }; + }; + config = lib.mkIf config.mods.supersonic.enable ( + lib.optionalAttrs (options ? home.packages) { + home.packages = with pkgs; [ + ( + if config.mods.supersonic.variant == "wayland" + then supersonic-wayland + else supersonic + ) + ]; + xdg.configFile."supersonic/themes/custom.toml".source = + (pkgs.formats.toml {}).generate "customTheme" + { + SupersonicTheme = { + Name = "Custom"; + Version = "0.2"; + SupportsDark = true; + SupportsLight = true; + }; + + DarkColors = { + PageBackground = "#${scheme.base00}"; + ListHeader = "#${scheme.base02}"; + PageHeader = "#${scheme.base02}"; + Background = "#${scheme.base01}"; + ScrollBar = "#${scheme.base02}"; + Button = "#${scheme.base02}"; + Foreground = "#${scheme.base04}"; + InputBackground = "#${scheme.base02}"; + }; + + # just define the same as base 16 doesn't define if it is light or not + LightColors = { + PageBackground = "#${scheme.base00}"; + ListHeader = "#${scheme.base02}"; + PageHeader = "#${scheme.base02}"; + Background = "#${scheme.base01}"; + ScrollBar = "#${scheme.base02}"; + Button = "#${scheme.base02}"; + Foreground = "#${scheme.base04}"; + InputBackground = "#${scheme.base02}"; + }; + }; + } + ); +} diff --git a/modules/programs/sway.nix b/modules/programs/sway.nix new file mode 100644 index 0000000..eef6025 --- /dev/null +++ b/modules/programs/sway.nix @@ -0,0 +1,30 @@ +{ + lib, + config, + options, + ... +}: { + options.mods.sway = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = "Enables sway"; + }; + config = lib.mkOption { + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = "sway config"; + }; + }; + config = lib.mkIf config.mods.sway.enable ( + lib.optionalAttrs (options ? wayland.windowManger.sway) { + wayland.windowManager.sway = + { + enable = true; + } + // config.mods.sway.config; + } + ); +} diff --git a/modules/programs/teams.nix b/modules/programs/teams.nix index 15b8748..e9d843a 100644 --- a/modules/programs/teams.nix +++ b/modules/programs/teams.nix @@ -4,11 +4,9 @@ options, pkgs, ... -}: -let +}: let callPackage = lib.callPackageWith pkgs; -in -{ +in { options.mods.teams = { enable = lib.mkOption { default = false; @@ -25,12 +23,12 @@ in }; config = lib.mkIf config.mods.teams.enable ( lib.optionalAttrs (options ? home.packages) { - home.packages = [ (callPackage ../../override/teams.nix { }) ]; + home.packages = [(callPackage ../../override/teams.nix {inherit (pkgs) chromium;})]; } // (lib.optionalAttrs (options ? boot.kernelModules) { boot = { - extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - kernelModules = [ "v4l2loopback" ]; + extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; + kernelModules = ["v4l2loopback"]; extraModprobeConfig = '' options v4l2loopback exclusive_caps=1 card_label="Virtual Camera" ''; diff --git a/modules/programs/virtmanager.nix b/modules/programs/virtmanager.nix new file mode 100644 index 0000000..de38848 --- /dev/null +++ b/modules/programs/virtmanager.nix @@ -0,0 +1,67 @@ +{ + mkDashDefault, + lib, + config, + options, + pkgs, + ... +}: let + module = + if config.conf.cpu == "intel" + then "kvm-intel" + else if config.conf.cpu == "amd" + then "kvm-amd" + else ""; +in { + options.mods = { + virtmanager.enable = lib.mkOption { + default = false; + type = lib.types.bool; + example = true; + description = '' + + + Enables virt-manager kvm. + ''; + }; + }; + + config = + lib.optionalAttrs (options ? virtualisation.libvirtd) { + boot.kernelModules = [ + module + ]; + programs.virt-manager.enable = true; + environment.systemPackages = with pkgs; [ + spice + spice-gtk + spice-protocol + virt-viewer + ]; + virtualisation = { + libvirtd = { + enable = true; + qemu = { + package = mkDashDefault pkgs.qemu_kvm; + swtpm.enable = mkDashDefault true; + }; + }; + spiceUSBRedirection.enable = mkDashDefault true; + }; + services.spice-vdagentd.enable = mkDashDefault true; + + users.users.${config.conf.username}.extraGroups = [ + "libvirtd" + "kvm" + "qemu-libvirtd" + ]; + } + // lib.optionalAttrs (options ? dconf.settings) { + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; + }; +} diff --git a/modules/programs/virtualbox.nix b/modules/programs/virtualbox.nix deleted file mode 100644 index 1639305..0000000 --- a/modules/programs/virtualbox.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - lib, - config, - options, - ... -}: -{ - - options.mods = { - virtualbox.enable = lib.mkOption { - default = false; - type = lib.types.bool; - example = true; - description = '' - Enables virtualbox. - ''; - }; - }; - - config = lib.optionalAttrs (options ? virtualisation.virtualbox.host) { - virtualisation.virtualbox.host.enable = lib.mkIf config.mods.virtualbox.enable true; - }; -} diff --git a/modules/programs/wm.nix b/modules/programs/wm.nix new file mode 100644 index 0000000..0f794d3 --- /dev/null +++ b/modules/programs/wm.nix @@ -0,0 +1,403 @@ +{lib, ...}: let + wmWorkspace = with lib.types; { + options = { + name = lib.mkOption { + default = ""; + example = "1"; + type = str; + description = "Name of the workspace"; + }; + default = lib.mkOption { + default = false; + example = true; + type = bool; + description = "Whether the workspace is the default workspace. (Currently doesn't do anything on niri)"; + }; + monitor = lib.mkOption { + default = ""; + example = "DP-1"; + type = str; + description = "Name of the monitor to bind the workspace to"; + }; + }; + }; + + wmOptions = with lib.types; { + options = { + name = lib.mkOption { + default = "DP-1"; + example = "DP-1"; + type = str; + description = "Name of the monitor"; + }; + resolutionX = lib.mkOption { + default = 1920; + example = 2560; + type = number; + description = "ResolutionX of the monitor"; + }; + resolutionY = lib.mkOption { + default = 1080; + example = 1440; + type = number; + description = "ResolutionY of the monitor"; + }; + refreshrate = lib.mkOption { + default = 60; + example = 144; + type = number; + description = "Refreshrate of the monitor"; + }; + positionX = lib.mkOption { + default = 0; + example = 1920; + type = number; + description = "PositionX of the monitor"; + }; + positionY = lib.mkOption { + default = 0; + example = 1080; + type = number; + description = "PositionY of the monitor"; + }; + scale = lib.mkOption { + default = 1; + example = 2; + type = number; + description = "Scale of the monitor"; + }; + transform = lib.mkOption { + default = "0"; + example = "90"; + type = enum ["0" "90" "180" "270" "360"]; + description = "Transform of the monitor"; + }; + vrr = lib.mkOption { + default = false; + example = true; + type = bool; + description = "VRR status of the monitor"; + }; + }; + }; + + modKeys = lib.types.enum ["Mod" "Super" "Alt" "Shift" "Ctrl"]; + + customCommand = with lib.types; { + options = { + niri = lib.mkOption { + default = null; + example = "kitty"; + type = either null str; + description = "Command to use in niri"; + }; + hyprland = lib.mkOption { + default = null; + example = "kitty"; + type = either null str; + description = "Command to use in hyprland"; + }; + }; + }; + + envOptions = with lib.types; { + options = { + all = lib.mkOption { + default = {}; + example = {}; + type = attrsOf str; + description = "General Env"; + }; + niri = lib.mkOption { + default = {}; + example = {}; + type = attrsOf str; + description = "Niri Env"; + }; + hyprland = lib.mkOption { + default = {}; + example = {}; + type = attrsOf str; + description = "Hyprland Env"; + }; + }; + }; + + startupOptions = with lib.types; { + options = { + all = lib.mkOption { + default = []; + example = []; + type = listOf str; + description = "General Startup commands"; + }; + niri = lib.mkOption { + default = []; + example = []; + type = listOf str; + description = "Niri Startup commands"; + }; + hyprland = lib.mkOption { + default = []; + example = []; + type = listOf str; + description = "Hyprland Startup commands"; + }; + }; + }; + + windowRuleOptions = with lib.types; { + options = { + niri = lib.mkOption { + default = []; + example = []; + type = listOf lines; + description = "Niri window rules"; + }; + hyprland = lib.mkOption { + default = []; + example = []; + type = listOf str; + description = "Hyprland window rules"; + }; + }; + }; + + bindOptions = with lib.types; { + options = { + modKeys = lib.mkOption { + default = []; + example = ["Mod"]; + type = listOf modKeys; + description = "List of modifier keys"; + }; + key = lib.mkOption { + default = ""; + example = "Q"; + type = str; + description = "Key to bind"; + }; + command = lib.mkOption { + default = ""; + example = "killActive"; + type = either (submodule customCommand) (enum [ + "spawn" + "spawn-sh" + "quit" + "killActive" + "moveFocusUp" + "moveFocusRight" + "moveFocusDown" + "moveFocusLeft" + "moveWindowUp" + "moveWindowRight" + "moveWindowDown" + "moveWindowLeft" + "focusWorkspace" + "moveToWorkspace" + "toggleFloating" + "toggleFullscreen" + ]); + description = "Command to execute"; + }; + args = lib.mkOption { + default = []; + example = []; + type = listOf str; + description = "Additional arguments for the command"; + }; + meta = lib.mkOption { + default = {}; + example = {}; + type = submodule { + options = { + niri = lib.mkOption { + default = {}; + type = submodule { + options = { + desc = lib.mkOption { + default = ""; + type = str; + description = "Description for Hotkey overview"; + }; + repeat = lib.mkOption { + type = bool; + default = true; + description = "Whether to repeat the keybind on hold"; + }; + allowInhibit = lib.mkOption { + type = bool; + default = true; + description = "Whether to allow inhibiting"; + }; + allowWhileLocked = lib.mkOption { + type = bool; + default = false; + description = "Whether to allow while locked"; + }; + cooldown = lib.mkOption { + type = number; + default = 0; + description = "Cooldown on bind"; + }; + }; + }; + description = "Niri meta for keybinds"; + }; + hyprland = lib.mkOption { + default = {}; + type = submodule { + options = { + repeat = lib.mkOption { + type = bool; + default = true; + description = "Whether to repeat the keybind on hold"; + }; + }; + }; + description = "Niri meta for keybinds"; + }; + }; + }; + description = "Custom metadata per bind. Note, only supported environments are taken into account."; + }; + }; + }; +in { + options.mods.wm = { + modKey = lib.mkOption { + default = "Super"; + example = "Alt"; + type = modKeys; + description = "Mod key"; + }; + + env = lib.mkOption { + default = {}; + example = { + all = { + EDITOR = "Neovim"; + }; + niri = { + EDITOR = "Emacs"; + }; + }; + type = with lib.types; either (submodule envOptions) (attrsOf str); + description = "Environment configuration"; + }; + + useDefaultEnv = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to use default env variables"; + }; + + startup = lib.mkOption { + default = []; + example = { + all = ["oxinoti"]; + niri = ["someniricommand"]; + hyprland = ["somehyprlandcommand"]; + }; + type = with lib.types; either (submodule startupOptions) (listOf str); + description = "Start commands"; + }; + + useDefaultStartup = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to use default autostart commands"; + }; + + useDefaultWindowRules = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to use default window rules"; + }; + + windowRules = lib.mkOption { + default = {}; + example = { + niri = [ + '' + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# + + block-out-from "screen-capture" + '' + '' + match app-id=r#"^steam$"# + open-on-workspace "0" + '' + ]; + }; + type = lib.types.submodule windowRuleOptions; + description = "Window rules"; + }; + + workspaces = lib.mkOption { + default = []; + example = [ + { + name = "chat"; + monitor = "DP-1"; + } + ]; + type = + lib.types.listOf (lib.types.submodule wmWorkspace); + description = "Workspace configuration"; + }; + + monitors = lib.mkOption { + default = []; + example = [ + { + name = "DP-1"; + resolutionX = 1920; + resolutionY = 1080; + refreshrate = 144; + positionX = 0; + positionY = 0; + scale = 1; + transform = "0"; + vrr = false; + } + ]; + type = + lib.types.listOf (lib.types.submodule wmOptions); + description = "Monitor configuration"; + }; + + useDefaultBinds = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Whether to use default keybinds"; + }; + + binds = lib.mkOption { + default = []; + example = [ + { + modKeys = ["Mod"]; + key = "Q"; + command = "killActive"; + args = []; + meta = { + niri = { + desc = "Kill the active window"; + repeat = false; + }; + hyprland = {}; + }; + } + ]; + type = + lib.types.listOf (lib.types.submodule bindOptions); + description = "Bind configuration"; + }; + }; +} diff --git a/modules/programs/xkb.nix b/modules/programs/xkb.nix index c0e162c..ebb1bda 100644 --- a/modules/programs/xkb.nix +++ b/modules/programs/xkb.nix @@ -3,11 +3,10 @@ options, config, ... -}: -{ +}: { options.mods.xkb = { layout = lib.mkOption { - default = "dashie"; + default = "enIntUmlaut"; example = "us"; type = lib.types.str; description = "Your layout"; @@ -19,13 +18,11 @@ description = "Your variant"; }; }; - config = ( - lib.optionalAttrs (options ? services.xserver) { - # Configure keymap in X11 - services.xserver = { - xkb.layout = "${config.mods.xkb.layout}"; - xkb.variant = "${config.mods.xkb.variant}"; - }; - } - ); + config = lib.optionalAttrs (options ? services.xserver) { + # Configure keymap in X11 + services.xserver = { + xkb.layout = "${config.mods.xkb.layout}"; + xkb.variant = "${config.mods.xkb.variant}"; + }; + }; } diff --git a/modules/programs/xone.nix b/modules/programs/xone.nix index 0779744..84ecd48 100644 --- a/modules/programs/xone.nix +++ b/modules/programs/xone.nix @@ -3,9 +3,7 @@ config, options, ... -}: -{ - +}: { options.mods = { xone.enable = lib.mkOption { default = false; @@ -17,5 +15,5 @@ }; }; - config = lib.optionalAttrs (options ? hardware) { hardware.xone.enable = true; }; + config = lib.optionalAttrs (options ? hardware) {hardware.xone.enable = config.mods.xone.enable;}; } diff --git a/modules/programs/yazi/default.nix b/modules/programs/yazi/default.nix index 692b72d..d890a81 100644 --- a/modules/programs/yazi/default.nix +++ b/modules/programs/yazi/default.nix @@ -1,10 +1,10 @@ { + pkgs, lib, config, options, ... -}: -{ +}: { options.mods.yazi = { enable = lib.mkOption { default = true; @@ -19,8 +19,8 @@ description = "Use default yazi config (if disabled only additionalConfig is used)"; }; additionalConfig = lib.mkOption { - default = { }; - example = { }; + default = {}; + example = {}; type = with lib.types; attrsOf anything; description = "Additional config for yazi"; }; @@ -31,19 +31,32 @@ description = "Use default yazi keymap (if disabled only additionalKeymap is used)"; }; additionalKeymap = lib.mkOption { - default = { }; - example = { }; + default = {}; + example = {}; + type = with lib.types; attrsOf anything; + description = "Additional keymap for yazi"; + }; + plugins = lib.mkOption { + default = { + inherit (pkgs.yaziPlugins) piper diff gitui wl-clipboard; + }; + example = {}; type = with lib.types; attrsOf anything; description = "Additional keymap for yazi"; }; }; - config = lib.mkIf config.mods.yazi.enable ( - lib.optionalAttrs (options ? home.packages) { programs.yazi = import ./yazi.nix; } - // { - programs.yazi.settings = { - settings = config.mods.yazi.additionalKeymap; - keymap = config.mods.yazi.additionalConfig; - }; - } - ); + config = let + conf = import ./yazi.nix; + in + lib.optionalAttrs (options ? home.packages) ( + lib.mkIf config.mods.yazi.enable { + home.packages = [pkgs.glow]; + programs.yazi = { + inherit (conf) enable; + settings = conf.settings // config.mods.yazi.additionalKeymap; + keymap = conf.keymap // config.mods.yazi.additionalConfig; + inherit (config.mods.yazi) plugins; + }; + } + ); } diff --git a/modules/programs/yazi/yazi.nix b/modules/programs/yazi/yazi.nix index 236d422..22e3169 100644 --- a/modules/programs/yazi/yazi.nix +++ b/modules/programs/yazi/yazi.nix @@ -1,4 +1,3 @@ -{ lib, config, ... }: { # don't ask.... enable = true; @@ -32,7 +31,7 @@ ]; image = [ { - run = ''imv "$@"''; + run = ''eog "$@"''; orphan = true; display_name = "Open"; } @@ -86,139 +85,148 @@ }; plugin = { prepend_previewers = [ + { + name = "*.tar"; + run = ''piper --format=url -- tar tf "$1"''; + } { name = "*.md"; - run = "glow"; + run = ''piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"''; } { mime = "text/csv"; - run = "miller"; + run = ''piper -- bat -p --color=always "$1"''; } ]; }; }; keymap = { - manager.keymap = [ + mgr.keymap = [ { - on = [ "" ]; + on = ""; + run = "backspace"; + desc = "Delete the character before the cursor"; + } + { + on = [""]; run = "escape"; desc = "Exit visual mode clear selected or cancel search"; } { - on = [ "q" ]; + on = ["q"]; run = "quit"; desc = "Exit the process"; } { - on = [ "Q" ]; + on = ["Q"]; run = "quit --no-cwd-file"; desc = "Exit the process without writing cwd-file"; } { - on = [ "" ]; + on = [""]; run = "close"; desc = "Close the current tab or quit if it is last tab"; } { - on = [ "" ]; + on = [""]; run = "suspend"; desc = "Suspend the process"; } # Navigation { - on = [ "l" ]; + on = ["l"]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "k" ]; + on = ["k"]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "L" ]; + on = ["L"]; run = "arrow -5"; desc = "Move cursor up 5 lines"; } { - on = [ "K" ]; + on = ["K"]; run = "arrow 5"; desc = "Move cursor down 5 lines"; } { - on = [ "" ]; + on = [""]; run = "arrow -50%"; desc = "Move cursor up half page"; } { - on = [ "" ]; + on = [""]; run = "arrow 50%"; desc = "Move cursor down half page"; } { - on = [ "" ]; + on = [""]; run = "arrow -100%"; desc = "Move cursor up one page"; } { - on = [ "" ]; + on = [""]; run = "arrow 100%"; desc = "Move cursor down one page"; } { - on = [ "j" ]; + on = ["j"]; run = "leave"; desc = "Go back to the parent directory"; } { - on = [ ";" ]; + on = [";"]; run = "enter"; desc = "Enter the child directory"; } { - on = [ "J" ]; + on = ["J"]; run = "back"; desc = "Go back to the previous directory"; } { - on = [ "P" ]; + on = ["P"]; run = "forward"; desc = "Go forward to the next directory"; } { - on = [ "" ]; + on = [""]; run = "peek -5"; desc = "Peek up 5 units in the preview"; } { - on = [ "" ]; + on = [""]; run = "peek 5"; desc = "Peek down 5 units in the preview"; } { - on = [ "" ]; + on = [""]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "" ]; + on = [""]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "" ]; + on = [""]; run = "leave"; desc = "Go back to the parent directory"; } { - on = [ "" ]; + on = [""]; run = "enter"; desc = "Enter the child directory"; } @@ -232,116 +240,116 @@ desc = "Move cursor to the top"; } { - on = [ "G" ]; + on = ["G"]; run = "arrow 99999999"; desc = "Move cursor to the bottom"; } # Selection { - on = [ "v" ]; + on = ["v"]; run = "visual_mode"; desc = "Enter visual mode (selection mode)"; } { - on = [ "V" ]; + on = ["V"]; run = "visual_mode --unset"; desc = "Enter visual mode (unset mode)"; } { - on = [ "" ]; + on = [""]; run = "select_all --state=true"; desc = "Select all files"; } { - on = [ "" ]; + on = [""]; run = "select_all --state=none"; desc = "Inverse selection of all files"; } # Operation { - on = [ "o" ]; + on = ["o"]; run = "open"; desc = "Open the selected files"; } { - on = [ "O" ]; + on = ["O"]; run = "open --interactive"; desc = "Open the selected files interactively"; } { - on = [ "" ]; + on = [""]; run = "open"; desc = "Open the selected files"; } { - on = [ "" ]; + on = [""]; run = "open --interactive"; desc = "Open the selected files interactively"; } # It's cool if you're using a terminal that supports CSI u { - on = [ "y" ]; + on = ["y"]; run = "yank"; desc = "Copy the selected files"; } { - on = [ "x" ]; + on = ["x"]; run = "yank --cut"; desc = "Cut the selected files"; } { - on = [ "p" ]; + on = ["p"]; run = "paste"; desc = "Paste the files"; } { - on = [ "P" ]; + on = ["P"]; run = "paste --force"; desc = "Paste the files (overwrite if the destination exists)"; } { - on = [ "-" ]; + on = ["-"]; run = "link"; desc = "Symlink the absolute path of files"; } { - on = [ "_" ]; + on = ["_"]; run = "link --relative"; desc = "Symlink the relative path of files"; } { - on = [ "d" ]; + on = ["d"]; run = "remove"; desc = "Move the files to the trash"; } { - on = [ "D" ]; + on = ["D"]; run = "remove --permanently"; desc = "Permanently delete the files"; } { - on = [ "a" ]; + on = ["a"]; run = "create"; desc = "Create a file or directory (ends with / for directories)"; } { - on = [ "r" ]; + on = ["r"]; run = "rename"; desc = "Rename a file or directory"; } { - on = [ ";" ]; + on = [";"]; run = "shell"; desc = "Run a shell command"; } { - on = [ ":" ]; + on = [":"]; run = "shell --block"; desc = "Run a shell command (block the UI until the command finishes)"; } { - on = [ "." ]; + on = ["."]; run = "hidden toggle"; desc = "Toggle the visibility of hidden files"; } @@ -364,18 +372,18 @@ desc = "Search files by content using ripgrep"; } { - on = [ "" ]; + on = [""]; run = "search none"; desc = "Cancel the ongoing search"; } { - on = [ "z" ]; - run = "jump zoxide"; + on = ["Z"]; + run = "plugin zoxide"; desc = "Jump to a directory using zoxide"; } { - on = [ "Z" ]; - run = "jump fzf"; + on = ["z"]; + run = "plugin fzf"; desc = "Jump to a directory or reveal a file using fzf"; } @@ -415,19 +423,19 @@ # Find { - on = [ "/" ]; + on = ["/"]; run = "find --smart"; } { - on = [ "?" ]; + on = ["?"]; run = "find --previous --smart"; } { - on = [ "n" ]; + on = ["n"]; run = "find_arrow"; } { - on = [ "N" ]; + on = ["N"]; run = "find_arrow --previous"; } @@ -515,82 +523,82 @@ # Tabs { - on = [ "t" ]; + on = ["t"]; run = "tab_create --current"; desc = "Create a new tab using the current path"; } { - on = [ "1" ]; + on = ["1"]; run = "tab_switch 0"; desc = "Switch to the first tab"; } { - on = [ "2" ]; + on = ["2"]; run = "tab_switch 1"; desc = "Switch to the second tab"; } { - on = [ "3" ]; + on = ["3"]; run = "tab_switch 2"; desc = "Switch to the third tab"; } { - on = [ "4" ]; + on = ["4"]; run = "tab_switch 3"; desc = "Switch to the fourth tab"; } { - on = [ "5" ]; + on = ["5"]; run = "tab_switch 4"; desc = "Switch to the fifth tab"; } { - on = [ "6" ]; + on = ["6"]; run = "tab_switch 5"; desc = "Switch to the sixth tab"; } { - on = [ "7" ]; + on = ["7"]; run = "tab_switch 6"; desc = "Switch to the seventh tab"; } { - on = [ "8" ]; + on = ["8"]; run = "tab_switch 7"; desc = "Switch to the eighth tab"; } { - on = [ "9" ]; + on = ["9"]; run = "tab_switch 8"; desc = "Switch to the ninth tab"; } { - on = [ "[" ]; + on = ["["]; run = "tab_switch -1 --relative"; desc = "Switch to the previous tab"; } { - on = [ "]" ]; + on = ["]"]; run = "tab_switch 1 --relative"; desc = "Switch to the next tab"; } { - on = [ "{" ]; + on = ["{"]; run = "tab_swap -1"; desc = "Swap the current tab with the previous tab"; } { - on = [ "}" ]; + on = ["}"]; run = "tab_swap 1"; desc = "Swap the current tab with the next tab"; } # Tasks { - on = [ "w" ]; + on = ["w"]; run = "tasks_show"; desc = "Show the tasks manager"; } @@ -639,7 +647,7 @@ # Help { - on = [ "~" ]; + on = ["~"]; run = "help"; desc = "Open help"; } @@ -647,56 +655,56 @@ tasks.keymap = [ { - on = [ "" ]; + on = [""]; run = "close"; desc = "Hide the task manager"; } { - on = [ "" ]; + on = [""]; run = "close"; desc = "Hide the task manager"; } { - on = [ "w" ]; + on = ["w"]; run = "close"; desc = "Hide the task manager"; } { - on = [ "k" ]; + on = ["k"]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "j" ]; + on = ["j"]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "" ]; + on = [""]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "" ]; + on = [""]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "" ]; + on = [""]; run = "inspect"; desc = "Inspect the task"; } { - on = [ "x" ]; + on = ["x"]; run = "cancel"; desc = "Cancel the task"; } { - on = [ "~" ]; + on = ["~"]; run = "help"; desc = "Open help"; } @@ -704,56 +712,56 @@ select.keymap = [ { - on = [ "" ]; + on = [""]; run = "close"; desc = "Cancel selection"; } { - on = [ "" ]; + on = [""]; run = "close"; desc = "Cancel selection"; } { - on = [ "" ]; + on = [""]; run = "close --submit"; desc = "Submit the selection"; } { - on = [ "k" ]; + on = ["k"]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "j" ]; + on = ["j"]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "K" ]; + on = ["K"]; run = "arrow -5"; desc = "Move cursor up 5 lines"; } { - on = [ "J" ]; + on = ["J"]; run = "arrow 5"; desc = "Move cursor down 5 lines"; } { - on = [ "" ]; + on = [""]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "" ]; + on = [""]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "~" ]; + on = ["~"]; run = "help"; desc = "Open help"; } @@ -761,39 +769,44 @@ input.keymap = [ { - on = [ "" ]; + on = ""; + run = "backspace"; + desc = "Delete the character before the cursor"; + } + { + on = [""]; run = "close"; desc = "Cancel input"; } { - on = [ "" ]; + on = [""]; run = "close --submit"; desc = "Submit the input"; } { - on = [ "" ]; + on = [""]; run = "escape"; desc = "Go back the normal mode or cancel input"; } # Mode { - on = [ "i" ]; + on = ["i"]; run = "insert"; desc = "Enter insert mode"; } { - on = [ "a" ]; + on = ["a"]; run = "insert --append"; desc = "Enter append mode"; } { - on = [ "v" ]; + on = ["v"]; run = "visual"; desc = "Enter visual mode"; } { - on = [ "V" ]; + on = ["V"]; run = [ "move -999" "visual" @@ -804,28 +817,28 @@ # Navigation { - on = [ "h" ]; + on = ["h"]; run = "move -1"; desc = "Move cursor left"; } { - on = [ "l" ]; + on = ["l"]; run = "move 1"; desc = "Move cursor right"; } { - on = [ "0" ]; + on = ["0"]; run = "move -999"; desc = "Move to the BOL"; } { - on = [ "$" ]; + on = ["$"]; run = "move 999"; desc = "Move to the EOL"; } { - on = [ "I" ]; + on = ["I"]; run = [ "move -999" "insert" @@ -833,7 +846,7 @@ desc = "Move to the BOL and enter insert mode"; } { - on = [ "A" ]; + on = ["A"]; run = [ "move 999" "insert --append" @@ -842,40 +855,40 @@ } { - on = [ "" ]; + on = [""]; run = "move -1"; desc = "Move cursor left"; } { - on = [ "" ]; + on = [""]; run = "move 1"; desc = "Move cursor right"; } { - on = [ "b" ]; + on = ["b"]; run = "backward"; desc = "Move to the beginning of the previous word"; } { - on = [ "w" ]; + on = ["w"]; run = "forward"; desc = "Move to the beginning of the next word"; } { - on = [ "e" ]; + on = ["e"]; run = "forward --end-of-word"; desc = "Move to the end of the next word"; } # Deletion { - on = [ "d" ]; + on = ["d"]; run = "delete --cut"; desc = "Cut the selected characters"; } { - on = [ "D" ]; + on = ["D"]; run = [ "delete --cut" "move 999" @@ -883,12 +896,12 @@ desc = "Cut until the EOL"; } { - on = [ "c" ]; + on = ["c"]; run = "delete --cut --insert"; desc = "Cut the selected characters and enter insert mode"; } { - on = [ "C" ]; + on = ["C"]; run = [ "delete --cut --insert" "move 999" @@ -896,7 +909,7 @@ desc = "Cut until the EOL and enter insert mode"; } { - on = [ "x" ]; + on = ["x"]; run = [ "delete --cut" "move 1 --in-operating" @@ -906,36 +919,36 @@ # Yank/Paste { - on = [ "y" ]; + on = ["y"]; run = "yank"; desc = "Copy the selected characters"; } { - on = [ "p" ]; + on = ["p"]; run = "paste"; desc = "Paste the copied characters after the cursor"; } { - on = [ "P" ]; + on = ["P"]; run = "paste --before"; desc = "Paste the copied characters before the cursor"; } # Undo/Redo { - on = [ "u" ]; + on = ["u"]; run = "undo"; desc = "Undo the last operation"; } { - on = [ "" ]; + on = [""]; run = "redo"; desc = "Redo the last operation"; } # Help { - on = [ "~" ]; + on = ["~"]; run = "help"; desc = "Open help"; } @@ -943,58 +956,58 @@ help.keymap = [ { - on = [ "" ]; + on = [""]; run = "escape"; desc = "Clear the filter or hide the help"; } { - on = [ "q" ]; + on = ["q"]; run = "close"; desc = "Exit the process"; } { - on = [ "" ]; + on = [""]; run = "close"; desc = "Hide the help"; } # Navigation { - on = [ "k" ]; + on = ["k"]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "j" ]; + on = ["j"]; run = "arrow 1"; desc = "Move cursor down"; } { - on = [ "K" ]; + on = ["K"]; run = "arrow -5"; desc = "Move cursor up 5 lines"; } { - on = [ "J" ]; + on = ["J"]; run = "arrow 5"; desc = "Move cursor down 5 lines"; } { - on = [ "" ]; + on = [""]; run = "arrow -1"; desc = "Move cursor up"; } { - on = [ "" ]; + on = [""]; run = "arrow 1"; desc = "Move cursor down"; } # Filtering { - on = [ "/" ]; + on = ["/"]; run = "filter"; desc = "Apply a filter for the help items"; } diff --git a/override/teams.nix b/override/teams.nix index 4370d7a..7d4f454 100644 --- a/override/teams.nix +++ b/override/teams.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation (final: { pname = "teams-pwa"; name = final.pname; - nativeBuildInputs = [ copyDesktopItems ]; + nativeBuildInputs = [copyDesktopItems]; dontUnpack = true; desktopItems = [ @@ -21,15 +21,15 @@ stdenv.mkDerivation (final: { } --app=https://teams.microsoft.com"; desktopName = "Microsoft Teams PWA"; genericName = "Progressive Web App for Microsoft Teams"; - categories = [ "Network" ]; - mimeTypes = [ "x-scheme-handler/msteams" ]; + categories = ["Network"]; + mimeTypes = ["x-scheme-handler/msteams"]; }) ]; meta = with lib; { description = "Microsoft Teams PWA"; homepage = "https://teams.microsoft.com"; - maintainers = with maintainers; [ ners ]; + maintainers = with maintainers; [ners]; platforms = chromium.meta.platforms; }; }) diff --git a/patches/darkeader.patch b/patches/darkeader.patch new file mode 100644 index 0000000..f1663df --- /dev/null +++ b/patches/darkeader.patch @@ -0,0 +1,456 @@ +diff --git a/src/background/user-storage.ts b/src/background/user-storage.ts +index 54612fb3b1f6..298e5032fc94 100644 +--- a/src/background/user-storage.ts ++++ b/src/background/user-storage.ts +@@ -5,7 +5,7 @@ import {PromiseBarrier} from '../utils/promise-barrier'; + import {isURLMatched} from '../utils/url'; + import {validateSettings} from '../utils/validation'; + +-import {readSyncStorage, readLocalStorage, writeSyncStorage, writeLocalStorage, removeSyncStorage, removeLocalStorage} from './utils/extension-api'; ++import {readManagedStorage, readSyncStorage, readLocalStorage, writeSyncStorage, writeLocalStorage, removeSyncStorage, removeLocalStorage} from './utils/extension-api'; + import {logWarn} from './utils/log'; + + +@@ -78,12 +78,7 @@ export default class UserStorage { + return settings; + } + +- private static async loadSettingsFromStorage(): Promise { +- if (UserStorage.loadBarrier) { +- return await UserStorage.loadBarrier.entry(); +- } +- UserStorage.loadBarrier = new PromiseBarrier(); +- ++ private static async loadSettingsFromStorageWithoutManaged(): Promise { + let local = await readLocalStorage(DEFAULT_SETTINGS); + + if (local.schemeVersion < 2) { +@@ -113,10 +108,8 @@ export default class UserStorage { + if (local.syncSettings == null) { + local.syncSettings = DEFAULT_SETTINGS.syncSettings; + } ++ + if (!local.syncSettings) { +- UserStorage.migrateAutomationSettings(local); +- UserStorage.fillDefaults(local); +- UserStorage.loadBarrier.resolve(local); + return local; + } + +@@ -126,18 +119,34 @@ export default class UserStorage { + local.syncSettings = false; + UserStorage.set({syncSettings: false}); + UserStorage.saveSyncSetting(false); +- UserStorage.loadBarrier.resolve(local); + return local; + } + + const {errors: syncCfgErrors} = validateSettings($sync); + syncCfgErrors.forEach((err) => logWarn(err)); ++ return $sync; ++ } ++ ++ private static async loadSettingsFromStorage(): Promise { ++ if (UserStorage.loadBarrier) { ++ return await UserStorage.loadBarrier.entry(); ++ } ++ UserStorage.loadBarrier = new PromiseBarrier(); + +- UserStorage.migrateAutomationSettings($sync); +- UserStorage.fillDefaults($sync); ++ let settings = await UserStorage.loadSettingsFromStorageWithoutManaged(); + +- UserStorage.loadBarrier.resolve($sync); +- return $sync; ++ const managed = await readManagedStorage(settings); ++ const {errors: managedCfgErrors} = validateSettings(managed); ++ if (managedCfgErrors.length === 0) { ++ settings = managed; ++ } else { ++ managedCfgErrors.forEach((err) => logWarn(err)); ++ } ++ ++ UserStorage.migrateAutomationSettings(settings); ++ UserStorage.fillDefaults(settings); ++ UserStorage.loadBarrier.resolve(settings); ++ return settings; + } + + static async saveSettings(): Promise { +diff --git a/src/background/utils/extension-api.ts b/src/background/utils/extension-api.ts +index 6d18fc0919df..6812ac2e4224 100644 +--- a/src/background/utils/extension-api.ts ++++ b/src/background/utils/extension-api.ts +@@ -97,6 +97,19 @@ export async function readLocalStorage(defaults: + }); + } + ++export async function readManagedStorage(defaults: T): Promise { ++ return new Promise((resolve) => { ++ chrome.storage.managed.get(defaults, (managed: T) => { ++ if (chrome.runtime.lastError) { ++ console.error(chrome.runtime.lastError.message); ++ resolve(defaults); ++ return; ++ } ++ resolve(managed); ++ }); ++ }); ++} ++ + function prepareSyncStorage(values: T): {[key: string]: any} { + for (const key in values) { + const value = values[key]; +diff --git a/src/managed-storage.json b/src/managed-storage.json +new file mode 100644 +index 000000000000..e394d0f1ff60 +--- /dev/null ++++ b/src/managed-storage.json +@@ -0,0 +1,304 @@ ++{ ++ ++ "$schema": "http://json-schema.org/draft-07/schema#", ++ "type": "object", ++ "properties": { ++ "schemeVersion": { ++ "type": "integer" ++ }, ++ "enabled": { ++ "type": "boolean" ++ }, ++ "fetchNews": { ++ "type": "boolean" ++ }, ++ "theme": { ++ "$ref": "Theme" ++ }, ++ "presets": { ++ "type": "array", ++ "items": { ++ "$ref": "ThemePreset" ++ } ++ }, ++ "customThemes": { ++ "type": "array", ++ "items": { ++ "$ref": "CustomSiteConfig" ++ } ++ }, ++ "enabledByDefault": { ++ "type": "boolean" ++ }, ++ "enabledFor": { ++ "type": "array", ++ "items": { ++ "type": "string", ++ "minLength": 1 ++ } ++ }, ++ "disabledFor": { ++ "type": "array", ++ "items": { ++ "type": "string", ++ "minLength": 1 ++ } ++ }, ++ "changeBrowserTheme": { ++ "type": "boolean" ++ }, ++ "syncSettings": { ++ "type": "boolean" ++ }, ++ "syncSitesFixes": { ++ "type": "boolean" ++ }, ++ "automation": { ++ "$ref": "Automation" ++ }, ++ "time": { ++ "$ref": "TimeSettings" ++ }, ++ "location": { ++ "$ref": "LocationSettings" ++ }, ++ "previewNewDesign": { ++ "type": "boolean" ++ }, ++ "previewNewestDesign": { ++ "type": "boolean" ++ }, ++ "enableForPDF": { ++ "type": "boolean" ++ }, ++ "enableForProtectedPages": { ++ "type": "boolean" ++ }, ++ "enableContextMenus": { ++ "type": "boolean" ++ }, ++ "detectDarkTheme": { ++ "type": "boolean" ++ }, ++ // Chrome's JSON schema format is weird and doesn't support `definitions` property and thus `#/definitions` references ++ // https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03 ++ // This "property" mimics it ++ "definitions": { ++ "type": "object", ++ "properties": { ++ "Theme": { ++ "id": "Theme", ++ "type": "object", ++ "properties": { ++ "mode": { ++ "$ref": "FilterMode" ++ }, ++ "brightness": { ++ "type": "integer", ++ "minimum": 0, ++ "maximum": 200 ++ }, ++ "contrast": { ++ "type": "integer", ++ "minimum": 0, ++ "maximum": 200 ++ }, ++ "grayscale": { ++ "type": "integer", ++ "minimum": 0, ++ "maximum": 100 ++ }, ++ "sepia": { ++ "type": "integer", ++ "minimum": 0, ++ "maximum": 100 ++ }, ++ "useFont": { ++ "type": "boolean" ++ }, ++ "fontFamily": { ++ "type": "string", ++ "minLength": 1 ++ }, ++ "textStroke": { ++ "type": "number" ++ }, ++ "engine": { ++ "type": "string", ++ "enum": [ ++ "cssFilter", ++ "svgFilter", ++ "staticTheme", ++ "dynamicTheme" ++ ] ++ }, ++ "stylesheet": { ++ "type": "string" ++ }, ++ "darkSchemeBackgroundColor": { ++ "$ref": "HexColor" ++ }, ++ "darkSchemeTextColor": { ++ "$ref": "HexColor" ++ }, ++ "lightSchemeBackgroundColor": { ++ "$ref": "HexColor" ++ }, ++ "lightSchemeTextColor": { ++ "$ref": "HexColor" ++ }, ++ "scrollbarColor": { ++ "$ref": "HexColorOrAuto" ++ }, ++ "selectionColor": { ++ "$ref": "HexColorOrAuto" ++ }, ++ "styleSystemControls": { ++ "type": "boolean" ++ }, ++ "lightColorScheme": { ++ "type": "string", ++ "minLength": 1 ++ }, ++ "darkColorScheme": { ++ "type": "string", ++ "minLength": 1 ++ }, ++ "immediateModify": { ++ "type": "boolean" ++ } ++ } ++ }, ++ "HexColor": { ++ "id": "HexColor", ++ "type": "string", ++ "pattern": "^[0-9a-f]{6}$" ++ }, ++ "HexColorOrAuto": { ++ "id": "HexColorOrAuto", ++ "type": "string", ++ "pattern": "^([0-9a-f]{6}|auto)$" ++ }, ++ "FilterMode": { ++ "id": "FilterMode", ++ "type": "integer", ++ "enum": [ ++ 0, ++ 1 ++ ] ++ }, ++ "ThemePreset": { ++ "id": "ThemePreset", ++ "type": "object", ++ "properties": { ++ "id": { ++ "type": "string", ++ "minLength": 1 ++ }, ++ "name": { ++ "type": "string", ++ "minLength": 1 ++ }, ++ "urls": { ++ "type": "array", ++ "items": { ++ "type": "string", ++ "minLength": 1 ++ } ++ }, ++ "theme": { ++ "$ref": "Theme" ++ } ++ }, ++ "required": [ ++ "id", ++ "name", ++ "urls", ++ "theme" ++ ] ++ }, ++ "CustomSiteConfig": { ++ "id": "CustomSiteConfig", ++ "type": "object", ++ "properties": { ++ "url": { ++ "type": "array", ++ "items": { ++ "type": "string", ++ "minLength": 1 ++ } ++ }, ++ "theme": { ++ "$ref": "Theme" ++ }, ++ "builtin": { ++ "type": "boolean" ++ } ++ }, ++ "required": [ ++ "url", ++ "theme" ++ ] ++ }, ++ "Automation": { ++ "id": "Automation", ++ "type": "object", ++ "properties": { ++ "enabled": { ++ "type": "boolean" ++ }, ++ "mode": { ++ "$ref": "AutomationMode" ++ }, ++ "behavior": { ++ "type": "string", ++ "enum": [ ++ "OnOff", ++ "Scheme" ++ ] ++ } ++ } ++ }, ++ "AutomationMode": { ++ "id": "AutomationMode", ++ "type": "string", ++ "enum": [ ++ "", ++ "time", ++ "system", ++ "location" ++ ] ++ }, ++ "TimeSettings": { ++ "id": "TimeSettings", ++ "type": "object", ++ "properties": { ++ "activation": { ++ "$ref": "Time" ++ }, ++ "deactivation": { ++ "$ref": "Time" ++ } ++ } ++ }, ++ "Time": { ++ "id": "Time", ++ "type": "string", ++ "pattern": "^((0?[0-9])|(1[0-9])|(2[0-3])):([0-5][0-9])$" ++ }, ++ "LocationSettings": { ++ "id": "LocationSettings", ++ "type": "object", ++ "properties": { ++ "latitude": { ++ "type": "number" ++ }, ++ "longitude": { ++ "type": "number" ++ } ++ } ++ } ++ } ++ } ++ } ++} +diff --git a/tasks/bundle-manifest.js b/tasks/bundle-manifest.js +index ae29531e67b7..f4058a129f52 100644 +--- a/tasks/bundle-manifest.js ++++ b/tasks/bundle-manifest.js +@@ -4,6 +4,7 @@ import {PLATFORM} from './platform.js'; + import * as reload from './reload.js'; + import {createTask} from './task.js'; + import {readJSON, writeJSON} from './utils.js'; ++import {copyFile} from 'node:fs/promises'; + + async function patchManifest(platform, debug, watch, test) { + const manifest = await readJSON(absolutePath('src/manifest.json')); +@@ -16,6 +17,11 @@ async function patchManifest(platform, debug, watch, test) { + if (platform === PLATFORM.CHROMIUM_MV3) { + patched.browser_action = undefined; + } ++ if (platform === PLATFORM.CHROMIUM_MV2 || platform === PLATFORM.CHROMIUM_MV3) { ++ patched.storage = { ++ managed_schema: 'managed-storage.json', ++ }; ++ } + if (debug) { + patched.version = '1'; + patched.description = `Debug build, platform: ${platform}, watch: ${watch ? 'yes' : 'no'}.`; +@@ -42,6 +48,9 @@ async function manifests({platforms, debug, watch, test}) { + const manifest = await patchManifest(platform, debug, watch, test); + const destDir = getDestDir({debug, platform}); + await writeJSON(`${destDir}/manifest.json`, manifest); ++ if (platform === PLATFORM.CHROMIUM_MV2 || platform === PLATFORM.CHROMIUM_MV3) { ++ await copyFile(absolutePath('src/managed-storage.json'), `${destDir}/managed-storage.json`); ++ } + } + } + +@@ -49,7 +58,7 @@ const bundleManifestTask = createTask( + 'bundle-manifest', + manifests, + ).addWatcher( +- ['src/manifest*.json'], ++ ['src/manifest*.json', 'src/managed-storage.json'], + async (changedFiles, _, buildPlatforms) => { + const chrome = changedFiles.some((file) => file.endsWith('manifest.json')); + const platforms = {}; diff --git a/patches/darkreader.nix b/patches/darkreader.nix new file mode 100644 index 0000000..ef2c19f --- /dev/null +++ b/patches/darkreader.nix @@ -0,0 +1,25 @@ +# credits to Voronind for darkreader config https://github.com/voronind-com/nix/blob/main/home/program/firefox/default.nix +{ + lib, + dashNixAdditionalProps, + ... +}: let + stable = dashNixAdditionalProps.pkgsDarkreader; +in + stable.buildNpmPackage rec { + version = "4.9.99"; + pname = "dark-reader"; + npmDepsHash = "sha256-m41HkwgbeRRmxJALQFJl/grYjjIqFOc47ltaesob1FA="; + env.ESBUILD_BINARY_PATH = lib.getExe stable.esbuild; + patches = [./darkeader.patch]; + src = stable.fetchFromGitHub { + hash = "sha256-K375/4qOyE1Tp/T5V5uCGcNd1IVVbT1Pjdnq/8oRHj0="; + owner = "darkreader"; + repo = "darkreader"; + rev = "v${version}"; + }; + installPhase = '' + mkdir -p $out + cp build/release/darkreader-firefox.xpi $out/latest.xpi + ''; + } diff --git a/result b/result deleted file mode 120000 index f3888e2..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/9snhsj18w6vyi4f25sq93az859yigcdp-DashNix.iso \ No newline at end of file