diff --git a/flake.nix b/flake.nix index c8042a0..4ffcc2b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,46 +1,53 @@ { description = "A simple NixOS flakes"; - outputs = { - flake-parts, - flake-utils, - home-manager, - treefmt-nix, - nixpkgs, - ... - } @ inputs: let - nixpkgs-lib = nixpkgs.lib; - lib = nixpkgs-lib.extend (import ./lib); - in - flake-parts.lib.mkFlake { - inherit inputs; - specialArgs = { - inherit lib; - rootPath = ./.; - }; - } ({lib, ...}: { - systems = flake-utils.lib.defaultSystems; - imports = - [ - home-manager.flakeModules.home-manager - treefmt-nix.flakeModule - ] - ++ lib.youthlic.loadImports ./flake; - flake = { - inherit lib; - nix.settings = { - # substituters shared in home-manager and nixos configuration - substituters = let - cachix = x: "https://${x}.cachix.org"; - in - lib.flatten [ - (cachix "nix-community") - "https://cache.nixos.org" - (cachix "cosmic") - ]; + outputs = + { + flake-parts, + flake-utils, + home-manager, + treefmt-nix, + nixpkgs, + ... + }@inputs: + let + nixpkgs-lib = nixpkgs.lib; + lib = nixpkgs-lib.extend (import ./lib); + in + flake-parts.lib.mkFlake + { + inherit inputs; + specialArgs = { + inherit lib; + rootPath = ./.; }; - }; - }); + } + ( + { lib, ... }: + { + systems = flake-utils.lib.defaultSystems; + imports = [ + home-manager.flakeModules.home-manager + treefmt-nix.flakeModule + ] + ++ lib.youthlic.loadImports ./flake; + flake = { + inherit lib; + nix.settings = { + # substituters shared in home-manager and nixos configuration + substituters = + let + cachix = x: "https://${x}.cachix.org"; + in + lib.flatten [ + (cachix "nix-community") + "https://cache.nixos.org" + (cachix "cosmic") + ]; + }; + }; + } + ); inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; diff --git a/flake/deploy.nix b/flake/deploy.nix index 3f86808..8ebe2b4 100644 --- a/flake/deploy.nix +++ b/flake/deploy.nix @@ -4,30 +4,32 @@ flake-parts-lib, self, ... -}: let +}: +let inherit (self) outputs; inherit (inputs) deploy-rs; - mkDeployNode = { - hostName, - unixName ? "deploy", - system ? "x86_64-linux", - sshName ? hostName, - }: { - "${hostName}" = { - hostname = "${sshName}"; - sshUser = "${unixName}"; - interactiveSudo = true; - profiles = { - system = { - user = "root"; - path = - deploy-rs.lib."${system}".activate.nixos - outputs.nixosConfigurations."${hostName}"; + mkDeployNode = + { + hostName, + unixName ? "deploy", + system ? "x86_64-linux", + sshName ? hostName, + }: + { + "${hostName}" = { + hostname = "${sshName}"; + sshUser = "${unixName}"; + interactiveSudo = true; + profiles = { + system = { + user = "root"; + path = deploy-rs.lib."${system}".activate.nixos outputs.nixosConfigurations."${hostName}"; + }; }; }; }; - }; -in { +in +{ options = { flake = flake-parts-lib.mkSubmoduleOptions { deploy = lib.mkOption { @@ -43,10 +45,10 @@ in { ] |> map ( hostName: - mkDeployNode { - inherit hostName; - } + mkDeployNode { + inherit hostName; + } ) - |> lib.foldr (a: b: a // b) {}; + |> lib.foldr (a: b: a // b) { }; }; } diff --git a/flake/home.nix b/flake/home.nix index 4937c9d..9b8ae22 100644 --- a/flake/home.nix +++ b/flake/home.nix @@ -4,7 +4,8 @@ self, rootPath, ... -}: let +}: +let inherit (self) outputs; homeModules = ( @@ -13,10 +14,10 @@ |> lib.filterAttrs (_key: value: value == "directory") |> lib.filterAttrs ( key: _value: - !builtins.elem key [ - "modules" - "extra" - ] + !builtins.elem key [ + "modules" + "extra" + ] ) |> builtins.attrNames |> (with lib; flip genAttrs (name: import (rootPath + "/home/${name}/modules"))) @@ -25,19 +26,20 @@ default = import "${toString rootPath}/home/modules"; extra = import "${toString rootPath}/home/extra"; }; - makeHomeConfiguration = { - hostName, - unixName ? "david", - system ? "x86_64-linux", - nixpkgs ? inputs.nixpkgs, - home-manager ? inputs.home-manager, - }: { - "${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - inherit system; - }; - modules = - [ + makeHomeConfiguration = + { + hostName, + unixName ? "david", + system ? "x86_64-linux", + nixpkgs ? inputs.nixpkgs, + home-manager ? inputs.home-manager, + }: + { + "${unixName}@${hostName}" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + inherit system; + }; + modules = [ (rootPath + "/home/${unixName}/configurations/${hostName}") ] ++ (with homeModules; [ @@ -49,28 +51,29 @@ ] ++ [ { - lib = {inherit (lib) youthlic;}; + lib = { inherit (lib) youthlic; }; } ]; - extraSpecialArgs = { - inherit - inputs - outputs - unixName - hostName - system - rootPath - ; + extraSpecialArgs = { + inherit + inputs + outputs + unixName + hostName + system + rootPath + ; + }; }; }; - }; -in { +in +{ flake = { - homeConfigurations = lib.foldr (a: b: a // b) {} ( + homeConfigurations = lib.foldr (a: b: a // b) { } ( [ # Hostname ] - |> map (hostName: makeHomeConfiguration {inherit hostName;}) + |> map (hostName: makeHomeConfiguration { inherit hostName; }) ); inherit homeModules; }; diff --git a/flake/nixos.nix b/flake/nixos.nix index 2d6c41d..aad7864 100644 --- a/flake/nixos.nix +++ b/flake/nixos.nix @@ -4,31 +4,37 @@ self, rootPath, ... -}: let +}: +let inherit (self) outputs; -in { +in +{ flake = { nixosModules = { default = import (rootPath + "/nixos/modules/top-level"); gui = import (rootPath + "/nixos/modules/top-level/gui.nix"); }; - nixosConfigurations = let - makeNixosConfiguration = hostName: - lib.nixosSystem { - modules = [(rootPath + "/nixos/configurations/${hostName}")]; - specialArgs = { - inherit inputs outputs rootPath lib; + nixosConfigurations = + let + makeNixosConfiguration = + hostName: + lib.nixosSystem { + modules = [ (rootPath + "/nixos/configurations/${hostName}") ]; + specialArgs = { + inherit + inputs + outputs + rootPath + lib + ; + }; }; - }; - in + in [ "Tytonidae" "Cape" "Akun" ] - |> ( - with lib; - flip genAttrs makeNixosConfiguration - ); + |> (with lib; flip genAttrs makeNixosConfiguration); }; } diff --git a/flake/overlays.nix b/flake/overlays.nix index c47dc4c..eb44391 100644 --- a/flake/overlays.nix +++ b/flake/overlays.nix @@ -4,10 +4,12 @@ lib, rootPath, ... -}: let +}: +let inherit (self) outputs; - importWithArgs = lib.flip import {inherit inputs outputs;}; -in { + importWithArgs = lib.flip import { inherit inputs outputs; }; +in +{ flake.overlays = [ "modifications" diff --git a/flake/perSystem.nix b/flake/perSystem.nix index 875c94a..a026f30 100644 --- a/flake/perSystem.nix +++ b/flake/perSystem.nix @@ -2,66 +2,72 @@ inputs, rootPath, ... -}: { +}: +{ imports = [ (rootPath + "/treefmt.nix") ]; - perSystem = { - pkgs, - system, - lib, - self', - inputs', - ... - }: let - inherit (inputs) nixpkgs; - in { - _module.args.pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - }; - overlays = [(_final: _prev: {inherit lib;})]; - }; - devShells.default = pkgs.mkShell { - name = "nixos-shell"; - packages = with pkgs; [ - nixd - nil - typos - typos-lsp - just - nvfetcher - ]; - }; - legacyPackages = let - inputsScope = lib.makeScope pkgs.newScope (self: { - inherit inputs rootPath; - srcs = self.callPackage (rootPath + "/_sources/generated.nix") {}; - inherit (inputs'.nixvim.legacyPackages) makeNixvim makeNixvimWithModule; - inherit (self'.legacyPackages) nixvimPlugins; - neovim_git = inputs'.neovim-nightly.packages.default; - }); + perSystem = + { + pkgs, + system, + lib, + self', + inputs', + ... + }: + let + inherit (inputs) nixpkgs; in - lib.packagesFromDirectoryRecursive { - inherit (inputsScope) callPackage; - directory = rootPath + "/pkgs"; + { + _module.args.pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + overlays = [ (_final: _prev: { inherit lib; }) ]; }; - packages = let - flattenPkgs = path: value: - if lib.isDerivation value - then { - ${lib.concatStringsSep "/" path} = value; - } - else if lib.isAttrs value - then lib.concatMapAttrs (name: flattenPkgs (path ++ [name])) value - else {}; - in - flattenPkgs [] self'.legacyPackages; - checks = - lib.concatMapAttrs (name: value: { + devShells.default = pkgs.mkShell { + name = "nixos-shell"; + packages = with pkgs; [ + nixd + nil + typos + typos-lsp + just + nvfetcher + ]; + }; + legacyPackages = + let + inputsScope = lib.makeScope pkgs.newScope (self: { + inherit inputs rootPath; + srcs = self.callPackage (rootPath + "/_sources/generated.nix") { }; + inherit (inputs'.nixvim.legacyPackages) makeNixvim makeNixvimWithModule; + inherit (self'.legacyPackages) nixvimPlugins; + neovim_git = inputs'.neovim-nightly.packages.default; + }); + in + lib.packagesFromDirectoryRecursive { + inherit (inputsScope) callPackage; + directory = rootPath + "/pkgs"; + }; + packages = + let + flattenPkgs = + path: value: + if lib.isDerivation value then + { + ${lib.concatStringsSep "/" path} = value; + } + else if lib.isAttrs value then + lib.concatMapAttrs (name: flattenPkgs (path ++ [ name ])) value + else + { }; + in + flattenPkgs [ ] self'.legacyPackages; + checks = lib.concatMapAttrs (name: value: { "package-${name}" = value; - }) - self'.packages; - }; + }) self'.packages; + }; } diff --git a/flake/templates.nix b/flake/templates.nix index 22b75a4..0530097 100644 --- a/flake/templates.nix +++ b/flake/templates.nix @@ -3,7 +3,8 @@ lib, rootPath, ... -}: { +}: +{ options = { flake = flake-parts-lib.mkSubmoduleOptions { templates = lib.mkOption { diff --git a/home/alice/configurations/Cape/default.nix b/home/alice/configurations/Cape/default.nix index 244289b..c7f56f2 100644 --- a/home/alice/configurations/Cape/default.nix +++ b/home/alice/configurations/Cape/default.nix @@ -2,7 +2,8 @@ pkgs, unixName, ... -}: { +}: +{ youthlic = { xdg-dirs.enable = true; programs = { diff --git a/home/alice/modules/default.nix b/home/alice/modules/default.nix index 6462967..c915eb0 100644 --- a/home/alice/modules/default.nix +++ b/home/alice/modules/default.nix @@ -1 +1 @@ -{...}: {} +{ ... }: { } diff --git a/home/david/configurations/Akun/default.nix b/home/david/configurations/Akun/default.nix index 9023533..3199691 100644 --- a/home/david/configurations/Akun/default.nix +++ b/home/david/configurations/Akun/default.nix @@ -4,32 +4,35 @@ unixName, config, ... -}: { +}: +{ imports = lib.youthlic.loadImports ./.; youthlic = { xdg-dirs.enable = true; - programs = let - email = config.accounts.email.accounts.ulic-youthlic; - inherit (email) address name; - signKey = email.gpg.key; - in { - gpg.enable = true; - git = { - inherit name signKey; - email = address; - encrypt-credential = true; + programs = + let + email = config.accounts.email.accounts.ulic-youthlic; + inherit (email) address name; + signKey = email.gpg.key; + in + { + gpg.enable = true; + git = { + inherit name signKey; + email = address; + encrypt-credential = true; + }; + fish.enable = true; + bash.enable = true; + jujutsu = { + enable = true; + inherit name signKey; + email = address; + }; + starship.enable = true; + sops.enable = true; + atuin.enable = true; }; - fish.enable = true; - bash.enable = true; - jujutsu = { - enable = true; - inherit name signKey; - email = address; - }; - starship.enable = true; - sops.enable = true; - atuin.enable = true; - }; }; david = { diff --git a/home/david/configurations/Akun/niri.nix b/home/david/configurations/Akun/niri.nix index afbae9b..ae40cea 100644 --- a/home/david/configurations/Akun/niri.nix +++ b/home/david/configurations/Akun/niri.nix @@ -2,13 +2,17 @@ config, inputs, ... -}: let +}: +let inherit (inputs.niri-flake.lib.kdl) node leaf flag; -in { +in +{ david.programs.niri = { - waybar.settings = let - cfg = config.david.programs.niri.waybar; - in [(cfg.template // (cfg.helper.mkBacklight "intel_backlight") // {output = "eDP-1";})]; + waybar.settings = + let + cfg = config.david.programs.niri.waybar; + in + [ (cfg.template // (cfg.helper.mkBacklight "intel_backlight") // { output = "eDP-1"; }) ]; wluma.extraSettings = { output = { backlight = [ @@ -20,21 +24,26 @@ in { ]; }; }; - extraConfig = let - output = node "output"; - in [ - (output ["eDP-1"] [ - (leaf "mode" ["1920x1200@60.018"]) - (leaf "scale" [1.0]) - (flag "focus-at-startup") - (leaf "position" [ - { - x = 0; - y = 0; - } - ]) - (leaf "transform" ["normal"]) - ]) - ]; + extraConfig = + let + output = node "output"; + in + [ + (output + [ "eDP-1" ] + [ + (leaf "mode" [ "1920x1200@60.018" ]) + (leaf "scale" [ 1.0 ]) + (flag "focus-at-startup") + (leaf "position" [ + { + x = 0; + y = 0; + } + ]) + (leaf "transform" [ "normal" ]) + ] + ) + ]; }; } diff --git a/home/david/configurations/Tytonidae/default.nix b/home/david/configurations/Tytonidae/default.nix index 18516ce..993ec68 100644 --- a/home/david/configurations/Tytonidae/default.nix +++ b/home/david/configurations/Tytonidae/default.nix @@ -4,40 +4,43 @@ config, unixName, ... -}: { +}: +{ imports = lib.youthlic.loadImports ./.; youthlic = { xdg-dirs.enable = true; - programs = let - email = config.accounts.email.accounts.ulic-youthlic; - inherit (email) name address; - signKey = email.gpg.key; - in { - rustypaste-cli.enable = true; - gpg.enable = true; - jujutsu = { - enable = true; - inherit name signKey; - email = address; + programs = + let + email = config.accounts.email.accounts.ulic-youthlic; + inherit (email) name address; + signKey = email.gpg.key; + in + { + rustypaste-cli.enable = true; + gpg.enable = true; + jujutsu = { + enable = true; + inherit name signKey; + email = address; + }; + git = { + inherit name signKey; + email = address; + encrypt-credential = true; + }; + fish.enable = true; + bash.enable = true; + starship.enable = true; + sops.enable = true; + kvm.enable = true; + atuin.enable = true; + ion.enable = true; + awscli = { + enable = true; + url = "http://localhost:8491"; + }; + doom.enable = true; }; - git = { - inherit name signKey; - email = address; - encrypt-credential = true; - }; - fish.enable = true; - bash.enable = true; - starship.enable = true; - sops.enable = true; - kvm.enable = true; - atuin.enable = true; - ion.enable = true; - awscli = { - enable = true; - url = "http://localhost:8491"; - }; - doom.enable = true; - }; }; david = { diff --git a/home/david/configurations/Tytonidae/niri.nix b/home/david/configurations/Tytonidae/niri.nix index d95c717..a153d45 100644 --- a/home/david/configurations/Tytonidae/niri.nix +++ b/home/david/configurations/Tytonidae/niri.nix @@ -1,11 +1,14 @@ -{config, ...}: { +{ config, ... }: +{ david.programs.niri = { - waybar.settings = let - cfg = config.david.programs.niri.waybar; - in [ - (cfg.template // (cfg.helper.mkBacklight "ddcci13") // {output = "DP-3";}) - (cfg.template // (cfg.helper.mkBacklight "nvidia_0") // {output = "eDP-1";}) - ]; + waybar.settings = + let + cfg = config.david.programs.niri.waybar; + in + [ + (cfg.template // (cfg.helper.mkBacklight "ddcci13") // { output = "DP-3"; }) + (cfg.template // (cfg.helper.mkBacklight "nvidia_0") // { output = "eDP-1"; }) + ]; wluma.extraSettings = { output = { backlight = [ @@ -28,6 +31,6 @@ } ]; }; - extraConfig = []; + extraConfig = [ ]; }; } diff --git a/home/david/modules/default.nix b/home/david/modules/default.nix index 903eb35..774935e 100644 --- a/home/david/modules/default.nix +++ b/home/david/modules/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ imports = lib.youthlic.loadImports ./.; config = { youthlic.programs = { diff --git a/home/david/modules/emails.nix b/home/david/modules/emails.nix index 7c0ef73..f3727a1 100644 --- a/home/david/modules/emails.nix +++ b/home/david/modules/emails.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.accounts.email; -in { +in +{ options = { david.accounts.email = { enable = lib.mkEnableOption "emails"; diff --git a/home/david/modules/programs/alacritty/default.nix b/home/david/modules/programs/alacritty/default.nix index f4be6c2..69551d6 100644 --- a/home/david/modules/programs/alacritty/default.nix +++ b/home/david/modules/programs/alacritty/default.nix @@ -3,9 +3,11 @@ config, pkgs, ... -}: let +}: +let cfg = config.david.programs.alacritty; -in { +in +{ options = { david.programs.alacritty = { enable = lib.mkEnableOption "alacritty"; @@ -15,16 +17,14 @@ in { programs.alacritty = { enable = true; package = pkgs.alacritty_git; - settings = - (./alacritty.toml |> builtins.readFile |> builtins.fromTOML) - // { - colors = lib.mkForce {}; - font.size = lib.mkForce 16; - window.opacity = lib.mkForce 0.8; - general.import = [ - "${pkgs.alacritty-theme}/share/alacritty-theme/gruvbox_dark.toml" - ]; - }; + settings = (./alacritty.toml |> builtins.readFile |> builtins.fromTOML) // { + colors = lib.mkForce { }; + font.size = lib.mkForce 16; + window.opacity = lib.mkForce 0.8; + general.import = [ + "${pkgs.alacritty-theme}/share/alacritty-theme/gruvbox_dark.toml" + ]; + }; }; }; } diff --git a/home/david/modules/programs/chromium.nix b/home/david/modules/programs/chromium.nix index 9d07e86..69da8f5 100644 --- a/home/david/modules/programs/chromium.nix +++ b/home/david/modules/programs/chromium.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.david.programs.chromium; -in { +in +{ options = { david.programs.chromium = { enable = lib.mkEnableOption "chromium"; diff --git a/home/david/modules/programs/espanso.nix b/home/david/modules/programs/espanso.nix index 56d3d72..ceaa139 100644 --- a/home/david/modules/programs/espanso.nix +++ b/home/david/modules/programs/espanso.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.david.programs.espanso; -in { +in +{ options = { david.programs.espanso = { enable = lib.mkEnableOption "espanso"; @@ -16,7 +18,7 @@ in { enable = true; package = pkgs.espanso-wayland; configs = { - default = {}; + default = { }; }; matches = { base = { diff --git a/home/david/modules/programs/firefox.nix b/home/david/modules/programs/firefox.nix index 1883754..b5f9258 100644 --- a/home/david/modules/programs/firefox.nix +++ b/home/david/modules/programs/firefox.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.david.programs.firefox; -in { +in +{ options = { david.programs.firefox = { enable = lib.mkEnableOption "firefox"; @@ -92,7 +94,7 @@ in { } ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = ["@np"]; + definedAliases = [ "@np" ]; }; "Nix Options" = { urls = [ @@ -110,7 +112,7 @@ in { ]; } ]; - definedAliases = ["@no"]; + definedAliases = [ "@no" ]; }; "Home Manager Options" = { urls = [ @@ -128,7 +130,7 @@ in { ]; } ]; - definedAliases = ["hm"]; + definedAliases = [ "hm" ]; }; "NUR Packages" = { urls = [ @@ -136,7 +138,7 @@ in { template = "https://nur.nix-community.org/"; } ]; - definedAliases = ["nu"]; + definedAliases = [ "nu" ]; }; "Nix Flakes" = { urls = [ @@ -154,7 +156,7 @@ in { ]; } ]; - definedAliases = ["nf"]; + definedAliases = [ "nf" ]; }; "NixOS Wiki" = { urls = [ @@ -168,7 +170,7 @@ in { ]; } ]; - definedAliases = ["nw"]; + definedAliases = [ "nw" ]; }; "bing".metaData.hidden = true; "google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias diff --git a/home/david/modules/programs/foot/default.nix b/home/david/modules/programs/foot/default.nix index 0772f33..c7f6bd1 100644 --- a/home/david/modules/programs/foot/default.nix +++ b/home/david/modules/programs/foot/default.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.foot; -in { +in +{ options = { david.programs.foot = { enable = lib.mkEnableOption "foot"; diff --git a/home/david/modules/programs/fuzzel.nix b/home/david/modules/programs/fuzzel.nix index 135c170..39bb031 100644 --- a/home/david/modules/programs/fuzzel.nix +++ b/home/david/modules/programs/fuzzel.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.fuzzel; -in { +in +{ options = { david.programs.fuzzel = { enable = lib.mkEnableOption "fuzzel"; diff --git a/home/david/modules/programs/ghostty.nix b/home/david/modules/programs/ghostty.nix index 338cc3f..10976b0 100644 --- a/home/david/modules/programs/ghostty.nix +++ b/home/david/modules/programs/ghostty.nix @@ -3,58 +3,61 @@ config, lib, ... -}: { +}: +{ options = { david.programs.ghostty = { enable = lib.mkEnableOption "ghostty"; }; }; - config = let - cfg = config.david.programs.ghostty; - in (lib.mkIf cfg.enable { - programs.ghostty = lib.mkMerge [ - { - enable = true; - package = pkgs.ghostty; - settings = { - # font-family = "FiraCode Nerd Font"; - # font-feature = [ - # "calt=1" - # "clig=1" - # "liga=1" - # "cv01" - # "cv02" - # "cv06" - # "zero" - # "onum" - # "cv17" - # "ss05" - # "ss03" - # "cv16" - # "cv31" - # "cv29" - # "cv30" - # ]; + config = + let + cfg = config.david.programs.ghostty; + in + (lib.mkIf cfg.enable { + programs.ghostty = lib.mkMerge [ + { + enable = true; + package = pkgs.ghostty; + settings = { + # font-family = "FiraCode Nerd Font"; + # font-feature = [ + # "calt=1" + # "clig=1" + # "liga=1" + # "cv01" + # "cv02" + # "cv06" + # "zero" + # "onum" + # "cv17" + # "ss05" + # "ss03" + # "cv16" + # "cv31" + # "cv29" + # "cv30" + # ]; - # font-family = "Maple Mono NF CN"; - font-feature = [ - "calt" - "zero" - "cv03" - "ss08" - ]; - font-size = lib.mkForce 17; - # theme = "ayu"; - background-opacity = lib.mkForce 0.8; - confirm-close-surface = "false"; - }; - } - (lib.mkIf config.youthlic.programs.fish.enable { - enableFishIntegration = true; - }) - (lib.mkIf config.youthlic.programs.bash.enable { - enableBashIntegration = true; - }) - ]; - }); + # font-family = "Maple Mono NF CN"; + font-feature = [ + "calt" + "zero" + "cv03" + "ss08" + ]; + font-size = lib.mkForce 17; + # theme = "ayu"; + background-opacity = lib.mkForce 0.8; + confirm-close-surface = "false"; + }; + } + (lib.mkIf config.youthlic.programs.fish.enable { + enableFishIntegration = true; + }) + (lib.mkIf config.youthlic.programs.bash.enable { + enableBashIntegration = true; + }) + ]; + }); } diff --git a/home/david/modules/programs/helix.nix b/home/david/modules/programs/helix.nix index 7c232a5..41149af 100644 --- a/home/david/modules/programs/helix.nix +++ b/home/david/modules/programs/helix.nix @@ -3,9 +3,11 @@ config, pkgs, ... -}: let +}: +let cfg = config.david.programs.helix; -in { +in +{ options = { david.programs.helix = { enable = lib.mkEnableOption "helix"; diff --git a/home/david/modules/programs/kanshi.nix b/home/david/modules/programs/kanshi.nix index 28d302b..158f619 100644 --- a/home/david/modules/programs/kanshi.nix +++ b/home/david/modules/programs/kanshi.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.david.programs.kanshi; -in { +in +{ options = { david.programs.kanshi = { enable = lib.mkEnableOption "kanshi"; diff --git a/home/david/modules/programs/mpv.nix b/home/david/modules/programs/mpv.nix index 4fe19fa..b0ff2b1 100644 --- a/home/david/modules/programs/mpv.nix +++ b/home/david/modules/programs/mpv.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.david.programs.mpv; -in { +in +{ options = { david.programs.mpv = { enable = lib.mkEnableOption "mpv"; diff --git a/home/david/modules/programs/niri/config.nix b/home/david/modules/programs/niri/config.nix index 11810fe..b8dc792 100644 --- a/home/david/modules/programs/niri/config.nix +++ b/home/david/modules/programs/niri/config.nix @@ -5,10 +5,10 @@ inputs, osConfig ? null, ... -}: let +}: +let inherit (lib) getExe getExe'; - inherit - (inputs.niri-flake.lib.kdl) + inherit (inputs.niri-flake.lib.kdl) # node with args, props and children # node:: \lambda name -> [argOrProp] -> [child] -> Output # arg: single value @@ -41,524 +41,625 @@ cliphist-fuzzel-img = getExe' pkgs.cliphist "cliphist-fuzzel-img"; wl-clip-persist = getExe pkgs.wl-clip-persist; in - ( - let - spawn = leaf "spawn"; - in [ - (plain "binds" [ - (plain "Mod+V" [ - (spawn [cliphist-fuzzel-img]) +( + let + spawn = leaf "spawn"; + in + [ + (plain "binds" [ + (plain "Mod+V" [ + (spawn [ cliphist-fuzzel-img ]) + ]) + (plain "Mod+Shift+P" [ + (spawn [ + swaylock + "--screenshots" + "--clock" + "--indicator" + "--indicator-radius" + "100" + "--indicator-thickness" + "7" + "--effect-blur" + "7x5" + "--effect-vignette" + "0.5:0.5" + "--grace" + "2" + "--fade-in" + "0.5" ]) - (plain "Mod+Shift+P" [ - (spawn [swaylock "--screenshots" "--clock" "--indicator" "--indicator-radius" "100" "--indicator-thickness" "7" "--effect-blur" "7x5" "--effect-vignette" "0.5:0.5" "--grace" "2" "--fade-in" "0.5"]) + ]) + (plain "Mod+Shift+Slash" [ + (flag "show-hotkey-overlay") + ]) + (plain "Mod+T" [ + (spawn [ + alacritty ]) - (plain "Mod+Shift+Slash" [ - (flag "show-hotkey-overlay") - ]) - (plain "Mod+T" [ + ]) + (plain "Mod+Shift+T" [ + (flag "toggle-column-tabbed-display") + ]) + (plain "Mod+Space" [ + (spawn [ fuzzel ]) + ]) + (node "XF86AudioRaiseVolume" + [ { allow-when-locked = true; } ] + [ (spawn [ - alacritty + wpctl + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1+" ]) - ]) - (plain "Mod+Shift+T" [ - (flag "toggle-column-tabbed-display") - ]) - (plain "Mod+Space" [ - (spawn [fuzzel]) - ]) - (node "XF86AudioRaiseVolume" [{allow-when-locked = true;}] [ - (spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"]) - ]) - (node "XF86AudioLowerVolume" [{allow-when-locked = true;}] [ - (spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"]) - ]) - (node "XF86AudioMute" [{allow-when-locked = true;}] [ - (spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "toggle"]) - ]) - (node "XF86AudioMicMute" [{allow-when-locked = true;}] [ - (spawn [wpctl "set-volume" "@DEFAULT_AUDIO_SOURCE@" "toggle"]) - ]) - (plain "Mod+Q" [ - (flag "close-window") - ]) - (node "Mod+O" [{repeat = false;}] [ + ] + ) + (node "XF86AudioLowerVolume" + [ { allow-when-locked = true; } ] + [ + (spawn [ + wpctl + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1-" + ]) + ] + ) + (node "XF86AudioMute" + [ { allow-when-locked = true; } ] + [ + (spawn [ + wpctl + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "toggle" + ]) + ] + ) + (node "XF86AudioMicMute" + [ { allow-when-locked = true; } ] + [ + (spawn [ + wpctl + "set-volume" + "@DEFAULT_AUDIO_SOURCE@" + "toggle" + ]) + ] + ) + (plain "Mod+Q" [ + (flag "close-window") + ]) + (node "Mod+O" + [ { repeat = false; } ] + [ (flag "toggle-overview") - ]) - (plain "Mod+Left" [ - (flag "focus-column-left") - ]) - (plain "Mod+Down" [ - (flag "focus-window-down") - ]) - (plain "Mod+Up" [ - (flag "focus-window-up") - ]) - (plain "Mod+Right" [ - (flag "focus-column-right") - ]) - (plain "Mod+H" [ - (flag "focus-column-or-monitor-left") - ]) - (plain "Mod+J" [ - (flag "focus-window-or-workspace-down") - ]) - (plain "Mod+K" [ - (flag "focus-window-or-workspace-up") - ]) - (plain "Mod+L" [ - (flag "focus-column-or-monitor-right") - ]) - (plain "Mod+Shift+Left" [ - (flag "move-column-left") - ]) - (plain "Mod+Shift+Down" [ - (flag "move-window-down") - ]) - (plain "Mod+Shift+Up" [ - (flag "move-window-up") - ]) - (plain "Mod+Shift+Right" [ - (flag "move-column-right") - ]) - (plain "Mod+Shift+H" [ - (flag "move-column-left-or-to-monitor-left") - ]) - (plain "Mod+Shift+J" [ - (flag "move-window-down-or-to-workspace-down") - ]) - (plain "Mod+Shift+K" [ - (flag "move-window-up-or-to-workspace-up") - ]) - (plain "Mod+Shift+L" [ - (flag "move-column-right-or-to-monitor-right") - ]) - (plain "Mod+Home" [ - (flag "focus-column-first") - ]) - (plain "Mod+End" [ - (flag "focus-column-last") - ]) - (plain "Mod+Ctrl+Home" [ - (flag "move-column-to-first") - ]) - (plain "Mod+Ctrl+End" [ - (flag "move-column-to-last") - ]) - (plain "Mod+Ctrl+Left" [ - (flag "focus-monitor-left") - ]) - (plain "Mod+Ctrl+Down" [ - (flag "focus-monitor-down") - ]) - (plain "Mod+Ctrl+Up" [ - (flag "focus-monitor-up") - ]) - (plain "Mod+Ctrl+Right" [ - (flag "focus-monitor-right") - ]) - (plain "Mod+Ctrl+H" [ - (flag "focus-monitor-left") - ]) - (plain "Mod+Ctrl+J" [ - (flag "focus-monitor-down") - ]) - (plain "Mod+Ctrl+K" [ - (flag "focus-monitor-up") - ]) - (plain "Mod+Ctrl+L" [ - (flag "focus-monitor-right") - ]) - (plain "Mod+Shift+Ctrl+Left" [ - (flag "move-column-to-monitor-left") - ]) - (plain "Mod+Shift+Ctrl+Down" [ - (flag "move-column-to-monitor-down") - ]) - (plain "Mod+Shift+Ctrl+Up" [ - (flag "move-column-to-monitor-up") - ]) - (plain "Mod+Shift+Ctrl+Right" [ - (flag "move-column-to-monitor-right") - ]) - (plain "Mod+Shift+Ctrl+H" [ - (flag "move-column-to-monitor-left") - ]) - (plain "Mod+Shift+Ctrl+J" [ - (flag "move-column-to-monitor-down") - ]) - (plain "Mod+Shift+Ctrl+K" [ - (flag "move-column-to-monitor-up") - ]) - (plain "Mod+Shift+Ctrl+L" [ - (flag "move-column-to-monitor-right") - ]) - (plain "Mod+Page_Down" [ + ] + ) + (plain "Mod+Left" [ + (flag "focus-column-left") + ]) + (plain "Mod+Down" [ + (flag "focus-window-down") + ]) + (plain "Mod+Up" [ + (flag "focus-window-up") + ]) + (plain "Mod+Right" [ + (flag "focus-column-right") + ]) + (plain "Mod+H" [ + (flag "focus-column-or-monitor-left") + ]) + (plain "Mod+J" [ + (flag "focus-window-or-workspace-down") + ]) + (plain "Mod+K" [ + (flag "focus-window-or-workspace-up") + ]) + (plain "Mod+L" [ + (flag "focus-column-or-monitor-right") + ]) + (plain "Mod+Shift+Left" [ + (flag "move-column-left") + ]) + (plain "Mod+Shift+Down" [ + (flag "move-window-down") + ]) + (plain "Mod+Shift+Up" [ + (flag "move-window-up") + ]) + (plain "Mod+Shift+Right" [ + (flag "move-column-right") + ]) + (plain "Mod+Shift+H" [ + (flag "move-column-left-or-to-monitor-left") + ]) + (plain "Mod+Shift+J" [ + (flag "move-window-down-or-to-workspace-down") + ]) + (plain "Mod+Shift+K" [ + (flag "move-window-up-or-to-workspace-up") + ]) + (plain "Mod+Shift+L" [ + (flag "move-column-right-or-to-monitor-right") + ]) + (plain "Mod+Home" [ + (flag "focus-column-first") + ]) + (plain "Mod+End" [ + (flag "focus-column-last") + ]) + (plain "Mod+Ctrl+Home" [ + (flag "move-column-to-first") + ]) + (plain "Mod+Ctrl+End" [ + (flag "move-column-to-last") + ]) + (plain "Mod+Ctrl+Left" [ + (flag "focus-monitor-left") + ]) + (plain "Mod+Ctrl+Down" [ + (flag "focus-monitor-down") + ]) + (plain "Mod+Ctrl+Up" [ + (flag "focus-monitor-up") + ]) + (plain "Mod+Ctrl+Right" [ + (flag "focus-monitor-right") + ]) + (plain "Mod+Ctrl+H" [ + (flag "focus-monitor-left") + ]) + (plain "Mod+Ctrl+J" [ + (flag "focus-monitor-down") + ]) + (plain "Mod+Ctrl+K" [ + (flag "focus-monitor-up") + ]) + (plain "Mod+Ctrl+L" [ + (flag "focus-monitor-right") + ]) + (plain "Mod+Shift+Ctrl+Left" [ + (flag "move-column-to-monitor-left") + ]) + (plain "Mod+Shift+Ctrl+Down" [ + (flag "move-column-to-monitor-down") + ]) + (plain "Mod+Shift+Ctrl+Up" [ + (flag "move-column-to-monitor-up") + ]) + (plain "Mod+Shift+Ctrl+Right" [ + (flag "move-column-to-monitor-right") + ]) + (plain "Mod+Shift+Ctrl+H" [ + (flag "move-column-to-monitor-left") + ]) + (plain "Mod+Shift+Ctrl+J" [ + (flag "move-column-to-monitor-down") + ]) + (plain "Mod+Shift+Ctrl+K" [ + (flag "move-column-to-monitor-up") + ]) + (plain "Mod+Shift+Ctrl+L" [ + (flag "move-column-to-monitor-right") + ]) + (plain "Mod+Page_Down" [ + (flag "focus-workspace-down") + ]) + (plain "Mod+Page_Up" [ + (flag "focus-workspace-up") + ]) + (plain "Mod+U" [ + (flag "focus-workspace-down") + ]) + (plain "Mod+I" [ + (flag "focus-workspace-up") + ]) + (plain "Mod+Shift+Page_Down" [ + (flag "move-column-to-workspace-down") + ]) + (plain "Mod+Shift+Page_Up" [ + (flag "move-column-to-workspace-up") + ]) + (plain "Mod+Shift+U" [ + (flag "move-column-to-workspace-down") + ]) + (plain "Mod+Shift+I" [ + (flag "move-column-to-workspace-up") + ]) + (plain "Mod+Ctrl+Page_Down" [ + (flag "move-workspace-down") + ]) + (plain "Mod+Ctrl+Page_Up" [ + (flag "move-workspace-up") + ]) + (plain "Mod+Ctrl+U" [ + (flag "move-workspace-down") + ]) + (plain "Mod+Ctrl+I" [ + (flag "move-workspace-up") + ]) + (node "Mod+Shift+WheelScrollDown" + [ { cooldown-ms = 150; } ] + [ (flag "focus-workspace-down") - ]) - (plain "Mod+Page_Up" [ + ] + ) + (node "Mod+Shift+WheelScrollUp" + [ { cooldown-ms = 150; } ] + [ (flag "focus-workspace-up") - ]) - (plain "Mod+U" [ - (flag "focus-workspace-down") - ]) - (plain "Mod+I" [ - (flag "focus-workspace-up") - ]) - (plain "Mod+Shift+Page_Down" [ - (flag "move-column-to-workspace-down") - ]) - (plain "Mod+Shift+Page_Up" [ - (flag "move-column-to-workspace-up") - ]) - (plain "Mod+Shift+U" [ - (flag "move-column-to-workspace-down") - ]) - (plain "Mod+Shift+I" [ - (flag "move-column-to-workspace-up") - ]) - (plain "Mod+Ctrl+Page_Down" [ - (flag "move-workspace-down") - ]) - (plain "Mod+Ctrl+Page_Up" [ - (flag "move-workspace-up") - ]) - (plain "Mod+Ctrl+U" [ - (flag "move-workspace-down") - ]) - (plain "Mod+Ctrl+I" [ - (flag "move-workspace-up") - ]) - (node "Mod+Shift+WheelScrollDown" [{cooldown-ms = 150;}] [ - (flag "focus-workspace-down") - ]) - (node "Mod+Shift+WheelScrollUp" [{cooldown-ms = 150;}] [ - (flag "focus-workspace-up") - ]) - (plain "Mod+WheelScrollDown" [ - (flag "focus-column-right") - ]) - (plain "Mod+WheelScrollUp" [ - (flag "focus-column-left") - ]) - (plain "Mod+1" [ - (leaf "focus-workspace" [1]) - ]) - (plain "Mod+2" [ - (leaf "focus-workspace" [2]) - ]) - (plain "Mod+3" [ - (leaf "focus-workspace" [3]) - ]) - (plain "Mod+4" [ - (leaf "focus-workspace" [4]) - ]) - (plain "Mod+5" [ - (leaf "focus-workspace" [5]) - ]) - (plain "Mod+6" [ - (leaf "focus-workspace" [6]) - ]) - (plain "Mod+7" [ - (leaf "focus-workspace" [7]) - ]) - (plain "Mod+8" [ - (leaf "focus-workspace" [8]) - ]) - (plain "Mod+9" [ - (leaf "focus-workspace" [9]) - ]) - (plain "Mod+Shift+1" [ - (leaf "move-column-to-workspace" [1]) - ]) - (plain "Mod+Shift+2" [ - (leaf "move-column-to-workspace" [2]) - ]) - (plain "Mod+Shift+3" [ - (leaf "move-column-to-workspace" [3]) - ]) - (plain "Mod+Shift+4" [ - (leaf "move-column-to-workspace" [4]) - ]) - (plain "Mod+Shift+5" [ - (leaf "move-column-to-workspace" [5]) - ]) - (plain "Mod+Shift+6" [ - (leaf "move-column-to-workspace" [6]) - ]) - (plain "Mod+Shift+7" [ - (leaf "move-column-to-workspace" [7]) - ]) - (plain "Mod+Shift+8" [ - (leaf "move-column-to-workspace" [8]) - ]) - (plain "Mod+Shift+9" [ - (leaf "move-column-to-workspace" [9]) - ]) - (plain "Mod+F" [ - (flag "toggle-window-floating") - ]) - (plain "Mod+Shift+F" [ - (flag "toggle-windowed-fullscreen") - ]) - (plain "Mod+Tab" [ - (flag "focus-window-previous") - ]) - (plain "Mod+Shift+Tab" [ - (flag "switch-focus-between-floating-and-tiling") - ]) - (plain "Mod+BracketLeft" [ - (flag "consume-or-expel-window-left") - ]) - (plain "Mod+BracketRight" [ - (flag "consume-or-expel-window-right") - ]) - (plain "Mod+Comma" [ - (flag "consume-window-into-column") - ]) - (plain "Mod+Period" [ - (flag "expel-window-from-column") - ]) - (node "Mod+R" [{repeat = false;}] [ + ] + ) + (plain "Mod+WheelScrollDown" [ + (flag "focus-column-right") + ]) + (plain "Mod+WheelScrollUp" [ + (flag "focus-column-left") + ]) + (plain "Mod+1" [ + (leaf "focus-workspace" [ 1 ]) + ]) + (plain "Mod+2" [ + (leaf "focus-workspace" [ 2 ]) + ]) + (plain "Mod+3" [ + (leaf "focus-workspace" [ 3 ]) + ]) + (plain "Mod+4" [ + (leaf "focus-workspace" [ 4 ]) + ]) + (plain "Mod+5" [ + (leaf "focus-workspace" [ 5 ]) + ]) + (plain "Mod+6" [ + (leaf "focus-workspace" [ 6 ]) + ]) + (plain "Mod+7" [ + (leaf "focus-workspace" [ 7 ]) + ]) + (plain "Mod+8" [ + (leaf "focus-workspace" [ 8 ]) + ]) + (plain "Mod+9" [ + (leaf "focus-workspace" [ 9 ]) + ]) + (plain "Mod+Shift+1" [ + (leaf "move-column-to-workspace" [ 1 ]) + ]) + (plain "Mod+Shift+2" [ + (leaf "move-column-to-workspace" [ 2 ]) + ]) + (plain "Mod+Shift+3" [ + (leaf "move-column-to-workspace" [ 3 ]) + ]) + (plain "Mod+Shift+4" [ + (leaf "move-column-to-workspace" [ 4 ]) + ]) + (plain "Mod+Shift+5" [ + (leaf "move-column-to-workspace" [ 5 ]) + ]) + (plain "Mod+Shift+6" [ + (leaf "move-column-to-workspace" [ 6 ]) + ]) + (plain "Mod+Shift+7" [ + (leaf "move-column-to-workspace" [ 7 ]) + ]) + (plain "Mod+Shift+8" [ + (leaf "move-column-to-workspace" [ 8 ]) + ]) + (plain "Mod+Shift+9" [ + (leaf "move-column-to-workspace" [ 9 ]) + ]) + (plain "Mod+F" [ + (flag "toggle-window-floating") + ]) + (plain "Mod+Shift+F" [ + (flag "toggle-windowed-fullscreen") + ]) + (plain "Mod+Tab" [ + (flag "focus-window-previous") + ]) + (plain "Mod+Shift+Tab" [ + (flag "switch-focus-between-floating-and-tiling") + ]) + (plain "Mod+BracketLeft" [ + (flag "consume-or-expel-window-left") + ]) + (plain "Mod+BracketRight" [ + (flag "consume-or-expel-window-right") + ]) + (plain "Mod+Comma" [ + (flag "consume-window-into-column") + ]) + (plain "Mod+Period" [ + (flag "expel-window-from-column") + ]) + (node "Mod+R" + [ { repeat = false; } ] + [ (flag "switch-preset-column-width") - ]) - (node "Mod+Shift+R" [{repeat = false;}] [ + ] + ) + (node "Mod+Shift+R" + [ { repeat = false; } ] + [ (flag "switch-preset-window-height") - ]) - (plain "Mod+Ctrl+R" [ - (flag "reset-window-height") - ]) - (node "Mod+M" [{repeat = false;}] [ + ] + ) + (plain "Mod+Ctrl+R" [ + (flag "reset-window-height") + ]) + (node "Mod+M" + [ { repeat = false; } ] + [ (flag "maximize-column") - ]) - (node "Mod+Shift+M" [{repeat = false;}] [ + ] + ) + (node "Mod+Shift+M" + [ { repeat = false; } ] + [ (flag "fullscreen-window") - ]) - (plain "Mod+Z" [ - (flag "center-column") - ]) - (node "Mod+Minus" [{repeat = false;}] [ - (leaf "set-column-width" ["-10%"]) - ]) - (node "Mod+Equal" [{repeat = false;}] [ - (leaf "set-column-width" ["+10%"]) - ]) - (node "Mod+Shift+Minus" [{repeat = false;}] [ - (leaf "set-window-height" ["-10%"]) - ]) - (node "Mod+Shift+Equal" [{repeat = false;}] [ - (leaf "set-window-height" ["+10%"]) - ]) - (plain "Print" [ - (flag "screenshot") - ]) - (plain "Ctrl+Print" [ - (flag "screenshot-screen") - ]) - (plain "Alt+Print" [ - (flag "screenshot-window") - ]) - (plain "Mod+Shift+Q" [ - (flag "quit") - ]) - (plain "Mod+E" [ - (flag "expand-column-to-available-width") - ]) - (plain "Mod+Shift+S" [ - (flag "toggle-keyboard-shortcuts-inhibit") - ]) - (plain "Mod+Shift+C" [ - (flag "set-dynamic-cast-window") - ]) - (plain "Mod+Shift+Ctrl+C" [ - (flag "clear-dynamic-cast-target") - ]) + ] + ) + (plain "Mod+Z" [ + (flag "center-column") ]) - ] # binds - ) - ++ ( - let - spawn-at-startup = leaf "spawn-at-startup"; - in [ - (leaf "screenshot-path" ["${config.xdg.userDirs.pictures}/screenshots/%Y-%m-%d_%H:%M:%S.png"]) - (plain "hotkey-overlay" [ - (flag "skip-at-startup") + (node "Mod+Minus" + [ { repeat = false; } ] + [ + (leaf "set-column-width" [ "-10%" ]) + ] + ) + (node "Mod+Equal" + [ { repeat = false; } ] + [ + (leaf "set-column-width" [ "+10%" ]) + ] + ) + (node "Mod+Shift+Minus" + [ { repeat = false; } ] + [ + (leaf "set-window-height" [ "-10%" ]) + ] + ) + (node "Mod+Shift+Equal" + [ { repeat = false; } ] + [ + (leaf "set-window-height" [ "+10%" ]) + ] + ) + (plain "Print" [ + (flag "screenshot") ]) - (flag "prefer-no-csd") - (spawn-at-startup [waybar]) - (spawn-at-startup [swaync]) - (spawn-at-startup [waypaper "--restore"]) - (spawn-at-startup [polkit-kde-agent]) - (spawn-at-startup [wl-paste "--watch" cliphist "store"]) - (spawn-at-startup [wl-clip-persist "--clipboard" "regular"]) - (spawn-at-startup [fcitx5 "--replace"]) - (plain "input" [ - (plain "touchpad" [ - (leaf "click-method" ["clickfinger"]) - (flag "dwt") - (leaf "scroll-method" ["two-finger"]) - (leaf "tap-button-map" ["left-right-middle"]) - ]) + (plain "Ctrl+Print" [ + (flag "screenshot-screen") ]) - (plain "cursor" [ - (leaf "hide-after-inactive-ms" [3000]) - (flag "hide-when-typing") + (plain "Alt+Print" [ + (flag "screenshot-window") ]) - (plain "layout" [ - (leaf "background-color" ["transparent"]) - (plain "border" [ - (flag "off") - (leaf "width" [4]) - (leaf "active-color" ["#7fc8ff"]) - (leaf "inactive-color" ["#505050"]) - ]) - (plain "focus-ring" [ - # (flag "off") - (leaf "width" [4]) - (leaf "active-color" ["#7fc8ff"]) - (leaf "inactive-color" ["#505050"]) - ]) - (plain "tab-indicator" [ - (flag "hide-when-single-tab") - ]) - (plain "preset-column-widths" [ - (leaf "proportion" [(1. / 4.)]) - (leaf "proportion" [(1. / 3.)]) - (leaf "proportion" [(1. / 2.)]) - (leaf "proportion" [(2. / 3.)]) - (leaf "proportion" [(3. / 4.)]) - (leaf "proportion" [(4. / 4.)]) - ]) - (flag "always-center-single-column") - (leaf "center-focused-column" ["never"]) - (leaf "default-column-display" ["tabbed"]) - (plain "default-column-width" [ - (leaf "proportion" [(1. / 2.)]) - ]) - (flag "empty-workspace-above-first") - (leaf "gaps" [16]) + (plain "Mod+Shift+Q" [ + (flag "quit") ]) - (plain "animations" [ - (plain "window-close" [ - (leaf "spring" [ - { - damping-ratio = 1.0; - stiffness = 800; - epsilon = 0.0001; - } - ]) - ]) + (plain "Mod+E" [ + (flag "expand-column-to-available-width") ]) - (plain "overview" [ - (plain "workspace-shadow" [ - (flag "off") - ]) + (plain "Mod+Shift+S" [ + (flag "toggle-keyboard-shortcuts-inhibit") ]) - ] # others - ) - ++ ( - let - window-rule = plain "window-rule"; - match = leaf "match"; - in [ - (window-rule [ - (leaf "draw-border-with-background" [true]) - (leaf "geometry-corner-radius" [12.0]) - (leaf "clip-to-geometry" [true]) + (plain "Mod+Shift+C" [ + (flag "set-dynamic-cast-window") ]) - (window-rule [ - (match [{app-id = "^org\\.keepassxc\\.KeePassXC$";}]) - (match [{app-id = "^org\\.gnome\\.World\\.Secrets$";}]) - (leaf "block-out-from" ["screen-capture"]) + (plain "Mod+Shift+Ctrl+C" [ + (flag "clear-dynamic-cast-target") ]) - (window-rule [ - (match [{is-active = true;}]) - (leaf "opacity" [0.95]) + ]) + ] # binds +) +++ ( + let + spawn-at-startup = leaf "spawn-at-startup"; + in + [ + (leaf "screenshot-path" [ "${config.xdg.userDirs.pictures}/screenshots/%Y-%m-%d_%H:%M:%S.png" ]) + (plain "hotkey-overlay" [ + (flag "skip-at-startup") + ]) + (flag "prefer-no-csd") + (spawn-at-startup [ waybar ]) + (spawn-at-startup [ swaync ]) + (spawn-at-startup [ + waypaper + "--restore" + ]) + (spawn-at-startup [ polkit-kde-agent ]) + (spawn-at-startup [ + wl-paste + "--watch" + cliphist + "store" + ]) + (spawn-at-startup [ + wl-clip-persist + "--clipboard" + "regular" + ]) + (spawn-at-startup [ + fcitx5 + "--replace" + ]) + (plain "input" [ + (plain "touchpad" [ + (leaf "click-method" [ "clickfinger" ]) + (flag "dwt") + (leaf "scroll-method" [ "two-finger" ]) + (leaf "tap-button-map" [ "left-right-middle" ]) ]) - (window-rule [ - (match [{is-active = false;}]) - (leaf "opacity" [0.8]) - (leaf "draw-border-with-background" [false]) + ]) + (plain "cursor" [ + (leaf "hide-after-inactive-ms" [ 3000 ]) + (flag "hide-when-typing") + ]) + (plain "layout" [ + (leaf "background-color" [ "transparent" ]) + (plain "border" [ + (flag "off") + (leaf "width" [ 4 ]) + (leaf "active-color" [ "#7fc8ff" ]) + (leaf "inactive-color" [ "#505050" ]) ]) - (window-rule [ - (match [{app-id = "^Alacritty$";}]) - (match [{app-id = "^com\\.mitchellh\\.ghostty$";}]) - (match [{app-id = "^neovide$";}]) - (leaf "draw-border-with-background" [false]) + (plain "focus-ring" [ + # (flag "off") + (leaf "width" [ 4 ]) + (leaf "active-color" [ "#7fc8ff" ]) + (leaf "inactive-color" [ "#505050" ]) ]) - (window-rule [ - (match [{app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$";}]) - (leaf "open-floating" [true]) + (plain "tab-indicator" [ + (flag "hide-when-single-tab") ]) - (window-rule [ - (match [{app-id = "^swayimg$";}]) - (leaf "draw-border-with-background" [false]) - (leaf "open-floating" [true]) + (plain "preset-column-widths" [ + (leaf "proportion" [ (1. / 4.) ]) + (leaf "proportion" [ (1. / 3.) ]) + (leaf "proportion" [ (1. / 2.) ]) + (leaf "proportion" [ (2. / 3.) ]) + (leaf "proportion" [ (3. / 4.) ]) + (leaf "proportion" [ (4. / 4.) ]) ]) - (window-rule [ - (match [{is-window-cast-target = true;}]) - (plain "focus-ring" [ - (leaf "active-color" ["#f38ba8"]) - (leaf "inactive-color" ["#7d0d2d"]) - ]) - (plain "border" [ - (leaf "active-color" ["#f38ba8"]) - (leaf "inactive-color" ["#7d0d2d"]) - ]) - (plain "tab-indicator" [ - (leaf "active-color" ["#f38ba8"]) - (leaf "inactive-color" ["#7d0d2d"]) - ]) - (plain "shadow" [ - (flag "on") - ]) + (flag "always-center-single-column") + (leaf "center-focused-column" [ "never" ]) + (leaf "default-column-display" [ "tabbed" ]) + (plain "default-column-width" [ + (leaf "proportion" [ (1. / 2.) ]) ]) - (window-rule [ - (match [ + (flag "empty-workspace-above-first") + (leaf "gaps" [ 16 ]) + ]) + (plain "animations" [ + (plain "window-close" [ + (leaf "spring" [ { - app-id = "^org\\.telegram\\.desktop$"; - title = "Media viewer"; + damping-ratio = 1.0; + stiffness = 800; + epsilon = 0.0001; } ]) - (match [ - { - app-id = "^QQ$"; - title = "图片查看器"; - } - ]) - (leaf "open-floating" [true]) - (leaf "open-fullscreen" [false]) ]) - (window-rule [ - (match [ - { - app-id = "^wechat$"; - title = "^wechat$"; - } - ]) - (leaf "open-focused" [false]) + ]) + (plain "overview" [ + (plain "workspace-shadow" [ + (flag "off") ]) - ] # window-rule - ) - ++ ( - let - layer-rule = plain "layer-rule"; - match = leaf "match"; - in [ - (layer-rule [ - (match [{namespace = "^swaync-notification-window$";}]) - (match [{namespace = "^swaync-control-center$";}]) - (leaf "block-out-from" ["screen-capture"]) + ]) + ] # others +) +++ ( + let + window-rule = plain "window-rule"; + match = leaf "match"; + in + [ + (window-rule [ + (leaf "draw-border-with-background" [ true ]) + (leaf "geometry-corner-radius" [ 12.0 ]) + (leaf "clip-to-geometry" [ true ]) + ]) + (window-rule [ + (match [ { app-id = "^org\\.keepassxc\\.KeePassXC$"; } ]) + (match [ { app-id = "^org\\.gnome\\.World\\.Secrets$"; } ]) + (leaf "block-out-from" [ "screen-capture" ]) + ]) + (window-rule [ + (match [ { is-active = true; } ]) + (leaf "opacity" [ 0.95 ]) + ]) + (window-rule [ + (match [ { is-active = false; } ]) + (leaf "opacity" [ 0.8 ]) + (leaf "draw-border-with-background" [ false ]) + ]) + (window-rule [ + (match [ { app-id = "^Alacritty$"; } ]) + (match [ { app-id = "^com\\.mitchellh\\.ghostty$"; } ]) + (match [ { app-id = "^neovide$"; } ]) + (leaf "draw-border-with-background" [ false ]) + ]) + (window-rule [ + (match [ { app-id = "^org\\.kde\\.polkit-kde-authentication-agent-1$"; } ]) + (leaf "open-floating" [ true ]) + ]) + (window-rule [ + (match [ { app-id = "^swayimg$"; } ]) + (leaf "draw-border-with-background" [ false ]) + (leaf "open-floating" [ true ]) + ]) + (window-rule [ + (match [ { is-window-cast-target = true; } ]) + (plain "focus-ring" [ + (leaf "active-color" [ "#f38ba8" ]) + (leaf "inactive-color" [ "#7d0d2d" ]) ]) - (layer-rule [ - (match [{namespace = "^launcher$";}]) - (plain "shadow" [ - (flag "on") - ]) - (leaf "geometry-corner-radius" [10.0]) + (plain "border" [ + (leaf "active-color" [ "#f38ba8" ]) + (leaf "inactive-color" [ "#7d0d2d" ]) ]) - (layer-rule [ - (match [{namespace = "^mpvpaper$";}]) - (leaf "place-within-backdrop" [true]) + (plain "tab-indicator" [ + (leaf "active-color" [ "#f38ba8" ]) + (leaf "inactive-color" [ "#7d0d2d" ]) ]) - ] # layer-rule - ) + (plain "shadow" [ + (flag "on") + ]) + ]) + (window-rule [ + (match [ + { + app-id = "^org\\.telegram\\.desktop$"; + title = "Media viewer"; + } + ]) + (match [ + { + app-id = "^QQ$"; + title = "图片查看器"; + } + ]) + (leaf "open-floating" [ true ]) + (leaf "open-fullscreen" [ false ]) + ]) + (window-rule [ + (match [ + { + app-id = "^wechat$"; + title = "^wechat$"; + } + ]) + (leaf "open-focused" [ false ]) + ]) + ] # window-rule +) +++ ( + let + layer-rule = plain "layer-rule"; + match = leaf "match"; + in + [ + (layer-rule [ + (match [ { namespace = "^swaync-notification-window$"; } ]) + (match [ { namespace = "^swaync-control-center$"; } ]) + (leaf "block-out-from" [ "screen-capture" ]) + ]) + (layer-rule [ + (match [ { namespace = "^launcher$"; } ]) + (plain "shadow" [ + (flag "on") + ]) + (leaf "geometry-corner-radius" [ 10.0 ]) + ]) + (layer-rule [ + (match [ { namespace = "^mpvpaper$"; } ]) + (leaf "place-within-backdrop" [ true ]) + ]) + ] # layer-rule +) diff --git a/home/david/modules/programs/niri/default.nix b/home/david/modules/programs/niri/default.nix index 8946b0c..76d72d3 100644 --- a/home/david/modules/programs/niri/default.nix +++ b/home/david/modules/programs/niri/default.nix @@ -6,10 +6,12 @@ osConfig ? null, options, ... -} @ args: let +}@args: +let cfg = config.david.programs.niri; niri = osConfig.programs.niri.package; -in { +in +{ options = { david.programs.niri = { enable = lib.mkEnableOption "niri"; @@ -40,37 +42,37 @@ in { { david.programs.niri.enable = osConfig.youthlic.gui.enabled == "niri"; } - ( - lib.mkIf cfg.enable { - home.packages = - (with pkgs; [ - swaynotificationcenter - kdePackages.polkit-kde-agent-1 - wl-clipboard - cliphist - swayimg - ]) - ++ [niri]; - qt = { - enable = true; - }; - xdg.portal = { - configPackages = [niri]; - enable = true; - extraPortals = lib.mkIf ( - !niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures - ) [pkgs.xdg-desktop-portal-gnome]; - }; - xdg.configFile = let - qtctConf = - '' - [Appearance] - standard_dialogs=xdgdesktopportal - '' - + lib.optionalString (config.qt.style ? name) '' - style=${config.qt.style.name} - ''; - in { + (lib.mkIf cfg.enable { + home.packages = + (with pkgs; [ + swaynotificationcenter + kdePackages.polkit-kde-agent-1 + wl-clipboard + cliphist + swayimg + ]) + ++ [ niri ]; + qt = { + enable = true; + }; + xdg.portal = { + configPackages = [ niri ]; + enable = true; + extraPortals = lib.mkIf ( + !niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures + ) [ pkgs.xdg-desktop-portal-gnome ]; + }; + xdg.configFile = + let + qtctConf = '' + [Appearance] + standard_dialogs=xdgdesktopportal + '' + + lib.optionalString (config.qt.style ? name) '' + style=${config.qt.style.name} + ''; + in + { "qt5ct/qt5ct.conf" = lib.mkForce { text = qtctConf; }; @@ -78,28 +80,26 @@ in { text = qtctConf; }; }; - david.programs = { - fuzzel.enable = true; - waybar = { - enable = true; - inherit (cfg.waybar) settings; - }; - wluma = { - enable = true; - inherit (cfg.wluma) extraSettings; - }; - swaync.enable = true; - swaylock.enable = true; - waypaper.enable = true; - kanshi.enable = true; + david.programs = { + fuzzel.enable = true; + waybar = { + enable = true; + inherit (cfg.waybar) settings; }; - programs.niri = { - config = - (lib.toList (import ./config.nix (args // {inherit pkgs;}))) - ++ (lib.toList cfg.extraConfig); - package = niri; + wluma = { + enable = true; + inherit (cfg.wluma) extraSettings; }; - } - ) + swaync.enable = true; + swaylock.enable = true; + waypaper.enable = true; + kanshi.enable = true; + }; + programs.niri = { + config = + (lib.toList (import ./config.nix (args // { inherit pkgs; }))) ++ (lib.toList cfg.extraConfig); + package = niri; + }; + }) ]; } diff --git a/home/david/modules/programs/openssh.nix b/home/david/modules/programs/openssh.nix index 8ddca81..e6d6abc 100644 --- a/home/david/modules/programs/openssh.nix +++ b/home/david/modules/programs/openssh.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.openssh; -in { +in +{ options = { david.programs.openssh = { enable = lib.mkEnableOption "openssh"; @@ -35,7 +37,7 @@ in { }; }) (lib.mkIf (cfg.enable && config.youthlic.programs.sops.enable) { - programs.ssh.includes = [config.sops.secrets.ssh-config.path]; + programs.ssh.includes = [ config.sops.secrets.ssh-config.path ]; sops.secrets = { "ssh-private-key/tytonidae" = { mode = "0600"; diff --git a/home/david/modules/programs/swaylock.nix b/home/david/modules/programs/swaylock.nix index 0b61590..5b60b0b 100644 --- a/home/david/modules/programs/swaylock.nix +++ b/home/david/modules/programs/swaylock.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.swaylock; -in { +in +{ options = { david.programs.swaylock = { enable = lib.mkEnableOption "swaylock"; diff --git a/home/david/modules/programs/swaync.nix b/home/david/modules/programs/swaync.nix index 6a8981b..509e369 100644 --- a/home/david/modules/programs/swaync.nix +++ b/home/david/modules/programs/swaync.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.david.programs.swaync; -in { +in +{ options = { david.programs.swaync = { enable = lib.mkEnableOption "swaync"; @@ -18,7 +20,7 @@ in { }; }) (lib.mkIf (!cfg.systemd.enable) { - systemd.user.services.swaync = lib.mkForce {}; + systemd.user.services.swaync = lib.mkForce { }; }) ]; } diff --git a/home/david/modules/programs/thunderbird.nix b/home/david/modules/programs/thunderbird.nix index 8759182..0ddbe6a 100644 --- a/home/david/modules/programs/thunderbird.nix +++ b/home/david/modules/programs/thunderbird.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.thunderbird; -in { +in +{ options = { david.programs.thunderbird = { enable = lib.mkEnableOption "thunderbird"; diff --git a/home/david/modules/programs/waybar.nix b/home/david/modules/programs/waybar.nix index 83301f2..16f535f 100644 --- a/home/david/modules/programs/waybar.nix +++ b/home/david/modules/programs/waybar.nix @@ -4,9 +4,11 @@ lib, options, ... -}: let +}: +let cfg = config.david.programs.waybar; -in { +in +{ options = { david.programs.waybar = { enable = lib.mkEnableOption "waybar"; @@ -23,7 +25,7 @@ in { "niri/workspaces" "wlr/taskbar" ]; - modules-center = ["clock"]; + modules-center = [ "clock" ]; modules-right = [ "tray" "idle_inhibitor" @@ -37,7 +39,7 @@ in { on-click = "activate"; }; - "niri/worksapces" = {}; + "niri/worksapces" = { }; "niri/taskbar" = { icon-size = 15; on-click = "activate"; diff --git a/home/david/modules/programs/waypaper.nix b/home/david/modules/programs/waypaper.nix index 2e4830e..916b50c 100644 --- a/home/david/modules/programs/waypaper.nix +++ b/home/david/modules/programs/waypaper.nix @@ -3,16 +3,22 @@ config, pkgs, ... -}: let +}: +let cfg = config.david.programs.waypaper; -in { +in +{ options = { david.programs.waypaper = { enable = lib.mkEnableOption "waypaper"; }; }; config = lib.mkIf cfg.enable { - home.packages = with pkgs; [waypaper socat mpvpaper]; + home.packages = with pkgs; [ + waypaper + socat + mpvpaper + ]; systemd.user = { timers."waypaper" = { Unit = { @@ -23,7 +29,7 @@ in { OnCalendar = "*:0/10"; }; Install = { - WantedBy = ["timers.target"]; + WantedBy = [ "timers.target" ]; }; }; services."waypaper" = { diff --git a/home/david/modules/programs/wluma.nix b/home/david/modules/programs/wluma.nix index ee6264e..6907dfc 100644 --- a/home/david/modules/programs/wluma.nix +++ b/home/david/modules/programs/wluma.nix @@ -3,9 +3,11 @@ config, options, ... -}: let +}: +let cfg = config.david.programs.wluma; -in { +in +{ options = { david.programs.wluma = { enable = lib.mkEnableOption "wluma"; @@ -33,23 +35,22 @@ in { config = lib.mkIf cfg.enable { services.wluma = { enable = true; - settings = - { - als = { - webcam = { - video = 0; - thresholds = { - "0" = "night"; - "15" = "dark"; - "30" = "dim"; - "45" = "normal"; - "60" = "bright"; - "75" = "outdoors"; - }; + settings = { + als = { + webcam = { + video = 0; + thresholds = { + "0" = "night"; + "15" = "dark"; + "30" = "dim"; + "45" = "normal"; + "60" = "bright"; + "75" = "outdoors"; }; }; - } - // cfg.extraSettings; + }; + } + // cfg.extraSettings; systemd = { enable = true; }; diff --git a/home/david/modules/programs/zed.nix b/home/david/modules/programs/zed.nix index bc87bdb..88405f4 100644 --- a/home/david/modules/programs/zed.nix +++ b/home/david/modules/programs/zed.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.david.programs.zed-editor; -in { +in +{ options = { david.programs.zed-editor = { enable = lib.mkEnableOption "zed-editor"; @@ -57,13 +59,17 @@ in { ty = { binary = { path = lib.getExe pkgs.ty; - arguments = ["server"]; + arguments = [ "server" ]; }; }; }; languages = { Python = { - language_servers = ["ty" "ruff" "pyright"]; + language_servers = [ + "ty" + "ruff" + "pyright" + ]; formatter = [ { language_server = { @@ -79,11 +85,13 @@ in { ]; }; Nix = { - language_servers = ["nixd" "nil"]; + language_servers = [ + "nixd" + "nil" + ]; formatter = { external = { - command = "alejandra"; - arguments = ["--quiet" "--"]; + command = "nixfmt"; }; }; }; diff --git a/home/david/modules/wallpaper.nix b/home/david/modules/wallpaper.nix index c177011..8062bb2 100644 --- a/home/david/modules/wallpaper.nix +++ b/home/david/modules/wallpaper.nix @@ -3,9 +3,11 @@ config, pkgs, ... -}: let +}: +let cfg = config.david.wallpaper; -in { +in +{ options = { david.wallpaper = { enable = lib.mkEnableOption "wallpaper"; diff --git a/home/extra/default.nix b/home/extra/default.nix index bfc3e75..7311140 100644 --- a/home/extra/default.nix +++ b/home/extra/default.nix @@ -2,7 +2,8 @@ lib, inputs, ... -}: { +}: +{ imports = (with inputs; [ niri-flake.homeModules.niri diff --git a/home/extra/nix.nix b/home/extra/nix.nix index 5540a47..4151db7 100644 --- a/home/extra/nix.nix +++ b/home/extra/nix.nix @@ -4,7 +4,8 @@ pkgs, inputs, ... -}: { +}: +{ config = { nixpkgs = { config = { diff --git a/home/modules/default.nix b/home/modules/default.nix index d821a4a..cacecc8 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -2,7 +2,8 @@ lib, inputs, ... -}: { +}: +{ imports = (with inputs; [ sops-nix.homeManagerModules.sops diff --git a/home/modules/i18n/default.nix b/home/modules/i18n/default.nix index 7c5048d..5dddd23 100644 --- a/home/modules/i18n/default.nix +++ b/home/modules/i18n/default.nix @@ -2,7 +2,8 @@ osConfig ? null, lib, ... -}: { +}: +{ config = lib.mkIf (osConfig != null) { xdg.dataFile = { "fcitx5/rime/default.custom.yaml".source = ./default.custom.yaml; diff --git a/home/modules/programs/atuin.nix b/home/modules/programs/atuin.nix index 8e84e5f..a2343b8 100644 --- a/home/modules/programs/atuin.nix +++ b/home/modules/programs/atuin.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.atuin; -in { +in +{ options = { youthlic.programs.atuin = { enable = lib.mkEnableOption "atuin"; diff --git a/home/modules/programs/awscli.nix b/home/modules/programs/awscli.nix index 9ec8bf4..a482d23 100644 --- a/home/modules/programs/awscli.nix +++ b/home/modules/programs/awscli.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.awscli; -in { +in +{ options = { youthlic.programs.awscli = { enable = lib.mkEnableOption "awscli"; @@ -16,7 +18,7 @@ in { }; }; config = lib.mkIf cfg.enable { - sops.secrets."awscli" = {}; + sops.secrets."awscli" = { }; programs.awscli = { enable = true; credentials = { diff --git a/home/modules/programs/bash.nix b/home/modules/programs/bash.nix index 990a853..64d9309 100644 --- a/home/modules/programs/bash.nix +++ b/home/modules/programs/bash.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.bash; -in { +in +{ options = { youthlic.programs.bash = { enable = lib.mkEnableOption "bash"; diff --git a/home/modules/programs/doom/default.nix b/home/modules/programs/doom/default.nix index 3d78444..15b0784 100644 --- a/home/modules/programs/doom/default.nix +++ b/home/modules/programs/doom/default.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.doom; -in { +in +{ options = { youthlic.programs.doom = { enable = lib.mkEnableOption "doom"; @@ -16,8 +18,8 @@ in { programs.doom-emacs = { enable = true; emacs = pkgs.emacs-pgtk; - extraPackages = emacsPackages: - with emacsPackages; [ + extraPackages = + emacsPackages: with emacsPackages; [ melpaPackages.telega ]; extraBinPackages = with pkgs; [ diff --git a/home/modules/programs/eza.nix b/home/modules/programs/eza.nix index 03e2d34..6047a7a 100644 --- a/home/modules/programs/eza.nix +++ b/home/modules/programs/eza.nix @@ -2,12 +2,14 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.eza; fish-cfg = config.youthlic.programs.fish; bash-cfg = config.youthlic.programs.bash; ion-cfg = config.youthlic.programs.ion; -in { +in +{ options = { youthlic.programs.eza = { enable = lib.mkEnableOption "eza"; diff --git a/home/modules/programs/fish.nix b/home/modules/programs/fish.nix index 6deaf46..87a2ea5 100644 --- a/home/modules/programs/fish.nix +++ b/home/modules/programs/fish.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.fish; -in { +in +{ options = { youthlic.programs.fish = { enable = lib.mkEnableOption "fish"; diff --git a/home/modules/programs/fzf.nix b/home/modules/programs/fzf.nix index 3d9c918..54d2c1e 100644 --- a/home/modules/programs/fzf.nix +++ b/home/modules/programs/fzf.nix @@ -2,11 +2,13 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.fzf; fish-cfg = config.youthlic.programs.fish; bash-cfg = config.youthlic.programs.bash; -in { +in +{ options = { youthlic.programs.fzf = { enable = lib.mkEnableOption "fzf"; diff --git a/home/modules/programs/git.nix b/home/modules/programs/git.nix index c1a82d6..42e0cea 100644 --- a/home/modules/programs/git.nix +++ b/home/modules/programs/git.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ options = { youthlic.programs.git = { email = lib.mkOption { @@ -30,9 +31,10 @@ encrypt-credential = lib.mkEnableOption "encrypt git credential"; }; }; - config = let - cfg = config.youthlic.programs.git; - in + config = + let + cfg = config.youthlic.programs.git; + in lib.mkMerge [ { programs.lazygit = { diff --git a/home/modules/programs/gpg/default.nix b/home/modules/programs/gpg/default.nix index 060a921..e50f044 100644 --- a/home/modules/programs/gpg/default.nix +++ b/home/modules/programs/gpg/default.nix @@ -4,15 +4,17 @@ lib, outputs, ... -}: { +}: +{ options = { youthlic.programs.gpg = { enable = lib.mkEnableOption "gpg"; }; }; - config = let - cfg = config.youthlic.programs.gpg; - in + config = + let + cfg = config.youthlic.programs.gpg; + in lib.mkIf cfg.enable { services.gpg-agent = lib.mkMerge [ { diff --git a/home/modules/programs/helix/default.nix b/home/modules/programs/helix/default.nix index 2b8141e..717d76b 100644 --- a/home/modules/programs/helix/default.nix +++ b/home/modules/programs/helix/default.nix @@ -3,36 +3,44 @@ pkgs, config, ... -}: let +}: +let cfg = config.youthlic.programs.helix; defaultLanguagesSettings = config.programs.helix.package.passthru.languages.language; -in { +in +{ options = { youthlic.programs.helix = { enable = lib.mkEnableOption "helix"; languageSettings = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule ({...}: { - freeformType = lib.types.anything; - options = { - language-servers = lib.mkOption { - type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything); - default = ["typos-lsp"]; - example = ["rust-analyzer"]; - apply = lib.unique; - }; - }; - })); + type = lib.types.attrsOf ( + lib.types.submodule ( + { ... }: + { + freeformType = lib.types.anything; + options = { + language-servers = lib.mkOption { + type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything); + default = [ "typos-lsp" ]; + example = [ "rust-analyzer" ]; + apply = lib.unique; + }; + }; + } + ) + ); default = lib.pipe defaultLanguagesSettings [ - (map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"]))) + (map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ]))) lib.listToAttrs ]; - apply = lib.mapAttrsToList (name: value: {inherit name;} // value); + apply = lib.mapAttrsToList (name: value: { inherit name; } // value); }; extraPackages = lib.mkOption { type = lib.types.listOf lib.types.package; - default = []; + default = [ ]; example = ( - with pkgs; [ + with pkgs; + [ deno ] ); @@ -49,224 +57,224 @@ in { defaultEditor = true; extraPackages = cfg.extraPackages; settings = ./config.toml |> builtins.readFile |> builtins.fromTOML; - languages = - lib.recursiveUpdate - { - language-server = { - neocmakelsp = { - command = "neocmakelsp"; - args = [ - "stdio" - ]; - }; - fish-lsp = { - command = "fish-lsp"; - args = [ - "start" - ]; - }; - ty = { - command = "ty"; - args = [ - "server" - ]; - }; - typos-lsp = { - command = "typos-lsp"; - }; + languages = lib.recursiveUpdate { + language-server = { + neocmakelsp = { + command = "neocmakelsp"; + args = [ + "stdio" + ]; }; - } - {language = cfg.languageSettings;}; + fish-lsp = { + command = "fish-lsp"; + args = [ + "start" + ]; + }; + ty = { + command = "ty"; + args = [ + "server" + ]; + }; + typos-lsp = { + command = "typos-lsp"; + }; + }; + } { language = cfg.languageSettings; }; }; }) (lib.mkIf cfg.enable { youthlic.programs.helix.languageSettings = lib.pipe defaultLanguagesSettings [ - (map ({name, ...}: lib.nameValuePair name {language-servers = ["typos-lsp"];})) + (map ({ name, ... }: lib.nameValuePair name { language-servers = [ "typos-lsp" ]; })) lib.listToAttrs ]; }) (lib.mkIf cfg.enable { youthlic.programs.helix.languageSettings = lib.recursiveUpdate - (lib.pipe defaultLanguagesSettings [(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"]))) lib.listToAttrs]) - { - cmake = { - language-servers = [ - "neocmakelsp" - "cmake-language-server" - ]; - }; - kdl = { - formatter = { - command = "kdlfmt"; - args = [ - "format" - "-" + (lib.pipe defaultLanguagesSettings [ + (map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ]))) + lib.listToAttrs + ]) + { + cmake = { + language-servers = [ + "neocmakelsp" + "cmake-language-server" ]; }; - }; - just = { - formatter = { - command = "just"; - args = [ - "--dump" + kdl = { + formatter = { + command = "kdlfmt"; + args = [ + "format" + "-" + ]; + }; + }; + just = { + formatter = { + command = "just"; + args = [ + "--dump" + ]; + }; + }; + nix = { + formatter = { + command = "nixfmt"; + }; + }; + xml = { + formatter = { + command = "xmllint"; + args = [ + "--format" + "-" + ]; + }; + }; + typst = { + formatter = { + command = "typstyle"; + }; + }; + c = { + formatter = { + command = "clang-format"; + }; + }; + cpp = { + formatter = { + command = "clang-format"; + }; + }; + python = { + formatter = { + command = "ruff"; + args = [ + "format" + "-s" + "--line-length" + "88" + "-" + ]; + }; + language-servers = [ + "pyright" + "ruff" + "ty" ]; }; - }; - nix = { - formatter = { - command = "alejandra"; + go = { + formatter = { + command = "goimports"; + }; }; - }; - xml = { - formatter = { - command = "xmllint"; - args = [ - "--format" - "-" + awk = { + formatter = { + command = "awk"; + timeout = 5; + args = [ + "--file=/dev/stdin" + "--pretty-print=/dev/stdout" + ]; + }; + }; + fish = { + language-servers = [ + "fish-lsp" ]; }; - }; - typst = { - formatter = { - command = "typstyle"; + yaml = { + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "yaml" + ]; + }; }; - }; - c = { - formatter = { - command = "clang-format"; - }; - }; - cpp = { - formatter = { - command = "clang-format"; - }; - }; - python = { - formatter = { - command = "ruff"; - args = [ - "format" - "-s" - "--line-length" - "88" - "-" + html = { + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "html" + ]; + }; + language-servers = [ + "vscode-html-language-server" ]; }; - language-servers = [ - "pyright" - "ruff" - "ty" - ]; - }; - go = { - formatter = { - command = "goimports"; - }; - }; - awk = { - formatter = { - command = "awk"; - timeout = 5; - args = [ - "--file=/dev/stdin" - "--pretty-print=/dev/stdout" + css = { + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "css" + ]; + }; + language-servers = [ + "vscode-css-language-server" ]; }; - }; - fish = { - language-servers = [ - "fish-lsp" - ]; - }; - yaml = { - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "yaml" + toml = { + formatter = { + command = "taplo"; + args = [ + "fmt" + "-" + ]; + }; + }; + markdown = { + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "md" + ]; + }; + }; + json = { + language-servers = [ + "vscode-json-language-server" ]; + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "json" + ]; + }; + }; + jsonc = { + language-servers = [ + "vscode-json-language-server" + ]; + formatter = { + command = "deno"; + args = [ + "fmt" + "-" + "--ext" + "jsonc" + ]; + }; }; }; - html = { - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "html" - ]; - }; - language-servers = [ - "vscode-html-language-server" - ]; - }; - css = { - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "css" - ]; - }; - language-servers = [ - "vscode-css-language-server" - ]; - }; - toml = { - formatter = { - command = "taplo"; - args = [ - "fmt" - "-" - ]; - }; - }; - markdown = { - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "md" - ]; - }; - }; - json = { - language-servers = [ - "vscode-json-language-server" - ]; - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "json" - ]; - }; - }; - jsonc = { - language-servers = [ - "vscode-json-language-server" - ]; - formatter = { - command = "deno"; - args = [ - "fmt" - "-" - "--ext" - "jsonc" - ]; - }; - }; - }; }) ]; } diff --git a/home/modules/programs/ion.nix b/home/modules/programs/ion.nix index cb458b5..42adca5 100644 --- a/home/modules/programs/ion.nix +++ b/home/modules/programs/ion.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.ion; -in { +in +{ options = { youthlic.programs.ion = { enable = lib.mkEnableOption "ion"; diff --git a/home/modules/programs/jujutsu.nix b/home/modules/programs/jujutsu.nix index 0475ad1..34fef21 100644 --- a/home/modules/programs/jujutsu.nix +++ b/home/modules/programs/jujutsu.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.jujutsu; -in { +in +{ options = { youthlic.programs.jujutsu = { enable = lib.mkEnableOption "jujutsu"; diff --git a/home/modules/programs/kvm.nix b/home/modules/programs/kvm.nix index 3f6a0de..82cb133 100644 --- a/home/modules/programs/kvm.nix +++ b/home/modules/programs/kvm.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.kvm; -in { +in +{ options = { youthlic.programs.kvm = { enable = lib.mkEnableOption "kvm"; @@ -14,8 +16,8 @@ in { dconf = { settings = { "org/virt-manager/virt-manager/connections" = { - autoconnect = ["qemu:///system"]; - uris = ["qemu:///system"]; + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; }; }; }; diff --git a/home/modules/programs/rustypaste-cli.nix b/home/modules/programs/rustypaste-cli.nix index 19bdcbb..36a7844 100644 --- a/home/modules/programs/rustypaste-cli.nix +++ b/home/modules/programs/rustypaste-cli.nix @@ -3,20 +3,22 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.rustypaste-cli; -in { +in +{ options = { youthlic.programs.rustypaste-cli = { enable = lib.mkEnableOption "rustypaste-cli"; }; }; config = lib.mkIf cfg.enable { - home.packages = [pkgs.rustypaste-cli]; + home.packages = [ pkgs.rustypaste-cli ]; sops = { secrets = { - "rustypaste/auth" = {}; - "rustypaste/delete" = {}; + "rustypaste/auth" = { }; + "rustypaste/delete" = { }; }; templates."rustypaste-config.toml" = { path = "${config.xdg.configHome}/rustypaste/config.toml"; diff --git a/home/modules/programs/sops.nix b/home/modules/programs/sops.nix index 92c0375..452f640 100644 --- a/home/modules/programs/sops.nix +++ b/home/modules/programs/sops.nix @@ -4,7 +4,8 @@ pkgs, rootPath, ... -}: { +}: +{ options = { youthlic.programs.sops = { enable = lib.mkOption { @@ -24,12 +25,14 @@ }; }; }; - config = let - cfg = config.youthlic.programs.sops; - in + config = + let + cfg = config.youthlic.programs.sops; + in lib.mkIf cfg.enable { home.packages = ( - with pkgs; [ + with pkgs; + [ sops age ] diff --git a/home/modules/programs/starship/default.nix b/home/modules/programs/starship/default.nix index d37521e..804c875 100644 --- a/home/modules/programs/starship/default.nix +++ b/home/modules/programs/starship/default.nix @@ -2,30 +2,31 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.starship; fish-cfg = config.youthlic.programs.fish; bash-cfg = config.youthlic.programs.bash; ion-cfg = config.youthlic.programs.ion; -in { +in +{ options = { youthlic.programs.starship = { enable = lib.mkEnableOption "starship"; }; }; config = lib.mkMerge [ - ( - lib.mkIf cfg.enable { - programs.starship = { - enable = true; - enableTransience = true; - settings = let + (lib.mkIf cfg.enable { + programs.starship = { + enable = true; + enableTransience = true; + settings = + let config-file = builtins.readFile ./config.toml; in - builtins.fromTOML config-file; - }; - } - ) + builtins.fromTOML config-file; + }; + }) (lib.mkIf (cfg.enable && fish-cfg.enable) { programs.starship.enableFishIntegration = true; programs.fish.functions = { diff --git a/home/modules/programs/yazi.nix b/home/modules/programs/yazi.nix index dfa35ba..1f79aaa 100644 --- a/home/modules/programs/yazi.nix +++ b/home/modules/programs/yazi.nix @@ -3,11 +3,13 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.yazi; fish-cfg = config.youthlic.programs.fish; bash-cfg = config.youthlic.programs.bash; -in { +in +{ options = { youthlic.programs.yazi = { enable = lib.mkEnableOption "yazi"; @@ -21,7 +23,15 @@ in { programs.yazi = { enable = true; plugins = { - inherit (pkgs.yaziPlugins) ouch starship piper chmod smart-enter git full-border; + inherit (pkgs.yaziPlugins) + ouch + starship + piper + chmod + smart-enter + git + full-border + ; }; initLua = #lua @@ -63,12 +73,15 @@ in { mgr = { prepend_keymap = [ { - on = ["c" "m"]; + on = [ + "c" + "m" + ]; run = "plugin chmod"; desc = "Chmod on selected files"; } { - on = ["l"]; + on = [ "l" ]; run = "plugin smart-enter"; desc = "Enter the child directory, or open the file"; } diff --git a/home/modules/programs/zoxide.nix b/home/modules/programs/zoxide.nix index d52dcd6..137086d 100644 --- a/home/modules/programs/zoxide.nix +++ b/home/modules/programs/zoxide.nix @@ -2,11 +2,13 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.zoxide; fish-cfg = config.youthlic.programs.fish; bash-cfg = config.youthlic.programs.bash; -in { +in +{ options = { youthlic.programs.zoxide = { enable = lib.mkEnableOption "zoxide"; diff --git a/home/modules/xdg-dirs.nix b/home/modules/xdg-dirs.nix index 1845999..1b5e5b0 100644 --- a/home/modules/xdg-dirs.nix +++ b/home/modules/xdg-dirs.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.xdg-dirs; -in { +in +{ options = { youthlic.xdg-dirs = { enable = lib.mkEnableOption "xdg-dirs"; diff --git a/lib/default.nix b/lib/default.nix index 6ff08e0..631a305 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,35 +1,38 @@ final: _prev: { youthlic = { - loadImports' = dir: f: + loadImports' = + dir: f: final.pipe dir [ final.youthlic.loadImports f ]; - loadImports = dir: + loadImports = + dir: with final; - if !(pathExists dir && builtins.readFileType dir == "directory") - then [] - else let - items = pipe dir [builtins.readDir attrNames]; - in - pipe items [ - (concatMap - (name: let - path = dir + "/${name}"; - type = builtins.readFileType path; - in - if type == "directory" - then - if pathExists (path + "/default.nix") - then [path] - else youthlic.loadImports path - else if type == "regular" - then - if hasSuffix ".nix" name - then [path] - else [] - else [])) - (filter (name: !hasSuffix "/default.nix" (toString name))) + if !(pathExists dir && builtins.readFileType dir == "directory") then + [ ] + else + let + items = pipe dir [ + builtins.readDir + attrNames ]; + in + pipe items [ + (concatMap ( + name: + let + path = dir + "/${name}"; + type = builtins.readFileType path; + in + if type == "directory" then + if pathExists (path + "/default.nix") then [ path ] else youthlic.loadImports path + else if type == "regular" then + if hasSuffix ".nix" name then [ path ] else [ ] + else + [ ] + )) + (filter (name: !hasSuffix "/default.nix" (toString name))) + ]; }; } diff --git a/nixos/configurations/Akun/default.nix b/nixos/configurations/Akun/default.nix index caff7ac..76aa787 100644 --- a/nixos/configurations/Akun/default.nix +++ b/nixos/configurations/Akun/default.nix @@ -4,7 +4,8 @@ lib, outputs, ... -}: { +}: +{ imports = (with inputs.nixos-hardware.nixosModules; [ common-cpu-intel @@ -75,9 +76,13 @@ kernelPackages = pkgs.linuxPackages_cachyos; loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; - kernelParams = ["i915.enable_guc=2"]; + kernelParams = [ "i915.enable_guc=2" ]; + }; + nix = { + settings = { + system-features = [ "gccarch-skylake" ]; + }; }; - nix = {settings = {system-features = ["gccarch-skylake"];};}; hardware = { graphics.package = pkgs.mesa_git; intelgpu = { diff --git a/nixos/configurations/Akun/disk-config.nix b/nixos/configurations/Akun/disk-config.nix index f10dd5c..2d21e40 100644 --- a/nixos/configurations/Akun/disk-config.nix +++ b/nixos/configurations/Akun/disk-config.nix @@ -49,7 +49,7 @@ ]; content = { type = "btrfs"; - extraArgs = ["-f"]; + extraArgs = [ "-f" ]; subvolumes = { "@root" = { mountpoint = "/"; diff --git a/nixos/configurations/Akun/gui.nix b/nixos/configurations/Akun/gui.nix index 38618ef..88d2e5b 100644 --- a/nixos/configurations/Akun/gui.nix +++ b/nixos/configurations/Akun/gui.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.gui = { enabled = "niri"; }; diff --git a/nixos/configurations/Akun/hardware-configuration.nix b/nixos/configurations/Akun/hardware-configuration.nix index 3692432..765d467 100644 --- a/nixos/configurations/Akun/hardware-configuration.nix +++ b/nixos/configurations/Akun/hardware-configuration.nix @@ -7,15 +7,23 @@ pkgs, modulesPath, ... -}: { +}: +{ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nixos/configurations/Akun/networking.nix b/nixos/configurations/Akun/networking.nix index c5ec9c0..4212114 100644 --- a/nixos/configurations/Akun/networking.nix +++ b/nixos/configurations/Akun/networking.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ systemd.network = { enable = true; wait-online.enable = false; diff --git a/nixos/configurations/Akun/stylix.nix b/nixos/configurations/Akun/stylix.nix index 5267a91..1567f89 100644 --- a/nixos/configurations/Akun/stylix.nix +++ b/nixos/configurations/Akun/stylix.nix @@ -2,7 +2,8 @@ pkgs, rootPath, ... -}: { +}: +{ stylix = { enable = true; image = rootPath + "/assets/wallpaper/01.png"; diff --git a/nixos/configurations/Akun/users/default.nix b/nixos/configurations/Akun/users/default.nix index 33847ac..0870dab 100644 --- a/nixos/configurations/Akun/users/default.nix +++ b/nixos/configurations/Akun/users/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ users = { mutableUsers = true; users.david = { diff --git a/nixos/configurations/Cape/default.nix b/nixos/configurations/Cape/default.nix index 467d67e..3b88cb2 100644 --- a/nixos/configurations/Cape/default.nix +++ b/nixos/configurations/Cape/default.nix @@ -3,12 +3,12 @@ lib, outputs, ... -}: { - imports = - [ - outputs.nixosModules.default - ] - ++ (lib.youthlic.loadImports ./.); +}: +{ + imports = [ + outputs.nixosModules.default + ] + ++ (lib.youthlic.loadImports ./.); youthlic = { home-manager = { @@ -68,7 +68,7 @@ }; nix = { settings = { - system-features = ["gccarch-ivybridge"]; + system-features = [ "gccarch-ivybridge" ]; }; }; diff --git a/nixos/configurations/Cape/disko-config.nix b/nixos/configurations/Cape/disko-config.nix index 2956283..8214982 100644 --- a/nixos/configurations/Cape/disko-config.nix +++ b/nixos/configurations/Cape/disko-config.nix @@ -15,7 +15,7 @@ size = "100%"; content = { type = "btrfs"; - extraArgs = ["-f"]; + extraArgs = [ "-f" ]; subvolumes = { "@root" = { mountpoint = "/"; diff --git a/nixos/configurations/Cape/forgejo.nix b/nixos/configurations/Cape/forgejo.nix index 9117716..1ce071a 100644 --- a/nixos/configurations/Cape/forgejo.nix +++ b/nixos/configurations/Cape/forgejo.nix @@ -1,11 +1,12 @@ -{config, ...}: { +{ config, ... }: +{ youthlic.containers.forgejo = { enable = true; domain = "forgejo.youthlic.social"; sshPort = 2222; httpPort = 8480; }; - networking.firewall.allowedTCPPorts = [2222]; + networking.firewall.allowedTCPPorts = [ 2222 ]; services.caddy.virtualHosts = { "forgejo.${config.youthlic.programs.caddy.baseDomain}" = { extraConfig = '' diff --git a/nixos/configurations/Cape/hardware-configuration.nix b/nixos/configurations/Cape/hardware-configuration.nix index cb5ce86..ac18c26 100644 --- a/nixos/configurations/Cape/hardware-configuration.nix +++ b/nixos/configurations/Cape/hardware-configuration.nix @@ -7,15 +7,22 @@ pkgs, modulesPath, ... -}: { +}: +{ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "sr_mod" + "virtio_blk" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nixos/configurations/Cape/miniflux.nix b/nixos/configurations/Cape/miniflux.nix index a106d53..0fc92b4 100644 --- a/nixos/configurations/Cape/miniflux.nix +++ b/nixos/configurations/Cape/miniflux.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ sops.secrets."miniflux" = { }; youthlic.containers.miniflux = { diff --git a/nixos/configurations/Cape/networking.nix b/nixos/configurations/Cape/networking.nix index 2c876e2..50d604c 100644 --- a/nixos/configurations/Cape/networking.nix +++ b/nixos/configurations/Cape/networking.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ systemd.network = { enable = true; wait-online.enable = true; diff --git a/nixos/configurations/Cape/radicle.nix b/nixos/configurations/Cape/radicle.nix index bb2ccc7..f3bf6f6 100644 --- a/nixos/configurations/Cape/radicle.nix +++ b/nixos/configurations/Cape/radicle.nix @@ -1,5 +1,6 @@ -{config, ...}: { - sops.secrets."ssh-private-key/radicle/Cape" = {}; +{ config, ... }: +{ + sops.secrets."ssh-private-key/radicle/Cape" = { }; youthlic.programs.radicle = { enable = true; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBbQrJNWcWsFncTX4w/hkhz6zPNwHrTjA+6lnq5dmu/s radicle"; diff --git a/nixos/configurations/Cape/stylix.nix b/nixos/configurations/Cape/stylix.nix index 7730b4b..d2b5e6f 100644 --- a/nixos/configurations/Cape/stylix.nix +++ b/nixos/configurations/Cape/stylix.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ stylix = { enable = false; }; diff --git a/nixos/configurations/Cape/users/default.nix b/nixos/configurations/Cape/users/default.nix index 7e89291..5eb47ab 100644 --- a/nixos/configurations/Cape/users/default.nix +++ b/nixos/configurations/Cape/users/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ users.users.alice = { initialHashedPassword = "$y$j9T$eS5zCi4W.4IPpf3P8Tb/o1$xhumXY1.PJKmTguNi/zlljLbLemNGiubWoUEc878S36"; isNormalUser = true; diff --git a/nixos/configurations/Tytonidae/default.nix b/nixos/configurations/Tytonidae/default.nix index 00735ad..50dd172 100644 --- a/nixos/configurations/Tytonidae/default.nix +++ b/nixos/configurations/Tytonidae/default.nix @@ -4,7 +4,8 @@ inputs, outputs, ... -}: { +}: +{ imports = (with inputs.nixos-hardware.nixosModules; [ common-hidpi @@ -17,7 +18,7 @@ ++ (with outputs; [ nixosModules.gui ]) - ++ [inputs.lanzaboote.nixosModules.lanzaboote] + ++ [ inputs.lanzaboote.nixosModules.lanzaboote ] ++ (lib.youthlic.loadImports ./.); youthlic = { diff --git a/nixos/configurations/Tytonidae/disk-config.nix b/nixos/configurations/Tytonidae/disk-config.nix index a1c5c88..6549e97 100644 --- a/nixos/configurations/Tytonidae/disk-config.nix +++ b/nixos/configurations/Tytonidae/disk-config.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ disko.devices = { disk = { disk1 = { diff --git a/nixos/configurations/Tytonidae/gui.nix b/nixos/configurations/Tytonidae/gui.nix index 38618ef..88d2e5b 100644 --- a/nixos/configurations/Tytonidae/gui.nix +++ b/nixos/configurations/Tytonidae/gui.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.gui = { enabled = "niri"; }; diff --git a/nixos/configurations/Tytonidae/hardware-configuration.nix b/nixos/configurations/Tytonidae/hardware-configuration.nix index f81150a..827d061 100644 --- a/nixos/configurations/Tytonidae/hardware-configuration.nix +++ b/nixos/configurations/Tytonidae/hardware-configuration.nix @@ -7,15 +7,22 @@ pkgs, modulesPath, ... -}: { +}: +{ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nixos/configurations/Tytonidae/hardware.nix b/nixos/configurations/Tytonidae/hardware.nix index 82af563..665738d 100644 --- a/nixos/configurations/Tytonidae/hardware.nix +++ b/nixos/configurations/Tytonidae/hardware.nix @@ -3,7 +3,8 @@ lib, config, ... -}: { +}: +{ nixpkgs.config.cudaSupport = true; services = { hardware.bolt.enable = true; @@ -13,11 +14,15 @@ enableUdevRules = true; }; }; - nix = {settings = {system-features = ["gccarch-alderlake"];};}; + nix = { + settings = { + system-features = [ "gccarch-alderlake" ]; + }; + }; hardware = { openrazer = { enable = true; - users = ["david"]; + users = [ "david" ]; }; graphics.package = pkgs.mesa_git; intelgpu = { @@ -35,8 +40,12 @@ }; }; boot = { - extraModulePackages = with config.boot.kernelPackages; [ddcci-driver]; - kernelModules = ["ddcci" "ddcci-backlight" "i2c-dev"]; + extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ]; + kernelModules = [ + "ddcci" + "ddcci-backlight" + "i2c-dev" + ]; binfmt = { emulatedSystems = [ "aarch64-linux" @@ -47,33 +56,38 @@ }; systemd.services."ddcci@" = { description = "ddcci handler"; - after = ["graphical.target"]; - before = ["shutdown.target"]; - conflicts = ["shutdown.target"]; + after = [ "graphical.target" ]; + before = [ "shutdown.target" ]; + conflicts = [ "shutdown.target" ]; serviceConfig = { Type = "oneshot"; - ExecStart = let - script = pkgs.writeShellApplication { - name = "ddcci-handler"; - runtimeInputs = with pkgs; [coreutils ddcutil]; - text = '' - echo Trying to attach ddcci to "$1" - success=0 - i=0 - id=$(echo "$1" | cut -d "-" -f 2) - while ((success < 1)) && ((i++ < 5)); do - if ddcutil getvcp 10 -b "$id"; then - if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then - success=1 - echo ddcci attached to "$1" + ExecStart = + let + script = pkgs.writeShellApplication { + name = "ddcci-handler"; + runtimeInputs = with pkgs; [ + coreutils + ddcutil + ]; + text = '' + echo Trying to attach ddcci to "$1" + success=0 + i=0 + id=$(echo "$1" | cut -d "-" -f 2) + while ((success < 1)) && ((i++ < 5)); do + if ddcutil getvcp 10 -b "$id"; then + if echo ddcci 0x37 > "/sys/bus/i2c/devices/$1/new_device"; then + success=1 + echo ddcci attached to "$1" + fi fi - fi - echo "Try $i" - sleep 1; - done - ''; - }; - in "${lib.getExe' script "ddcci-handler"} %i"; + echo "Try $i" + sleep 1; + done + ''; + }; + in + "${lib.getExe' script "ddcci-handler"} %i"; }; }; services.udev.extraRules = '' diff --git a/nixos/configurations/Tytonidae/networking.nix b/nixos/configurations/Tytonidae/networking.nix index 3a175dd..b440473 100644 --- a/nixos/configurations/Tytonidae/networking.nix +++ b/nixos/configurations/Tytonidae/networking.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ systemd.network = { enable = true; wait-online.enable = false; diff --git a/nixos/configurations/Tytonidae/specialisation/kde.nix b/nixos/configurations/Tytonidae/specialisation/kde.nix index 91e0f65..ed049b0 100644 --- a/nixos/configurations/Tytonidae/specialisation/kde.nix +++ b/nixos/configurations/Tytonidae/specialisation/kde.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ config.specialisation.kde = { inheritParentConfig = true; configuration = { diff --git a/nixos/configurations/Tytonidae/specialisation/niri-hybrid.nix b/nixos/configurations/Tytonidae/specialisation/niri-hybrid.nix index 43bc42c..45e6346 100644 --- a/nixos/configurations/Tytonidae/specialisation/niri-hybrid.nix +++ b/nixos/configurations/Tytonidae/specialisation/niri-hybrid.nix @@ -2,7 +2,8 @@ inputs, lib, ... -}: let +}: +let extraConfig = '' output "DP-1" { mode "2560x1440@169.900" @@ -22,11 +23,12 @@ open-on-output "DP-1" } ''; -in { +in +{ config.specialisation.niri-hybrid = { inheritParentConfig = true; configuration = { - imports = [inputs.nixos-hardware.nixosModules.common-gpu-nvidia]; + imports = [ inputs.nixos-hardware.nixosModules.common-gpu-nvidia ]; youthlic.gui.niri.extraConfig = lib.mkForce extraConfig; hardware.nvidia.prime.reverseSync.enable = lib.mkForce false; }; diff --git a/nixos/configurations/Tytonidae/stylix.nix b/nixos/configurations/Tytonidae/stylix.nix index d39f694..0a0383d 100644 --- a/nixos/configurations/Tytonidae/stylix.nix +++ b/nixos/configurations/Tytonidae/stylix.nix @@ -2,7 +2,8 @@ pkgs, rootPath, ... -}: { +}: +{ stylix = { enable = true; image = rootPath + "/assets/wallpaper/01.png"; diff --git a/nixos/configurations/Tytonidae/users/default.nix b/nixos/configurations/Tytonidae/users/default.nix index d7722a5..9d652bf 100644 --- a/nixos/configurations/Tytonidae/users/default.nix +++ b/nixos/configurations/Tytonidae/users/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ users.users.david = { initialHashedPassword = "$y$j9T$eS5zCi4W.4IPpf3P8Tb/o1$xhumXY1.PJKmTguNi/zlljLbLemNGiubWoUEc878S36"; isNormalUser = true; diff --git a/nixos/modules/containers/default.nix b/nixos/modules/containers/default.nix index e39e453..9168f4c 100644 --- a/nixos/modules/containers/default.nix +++ b/nixos/modules/containers/default.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.containers; -in { +in +{ imports = lib.youthlic.loadImports ./.; options = { youthlic.containers = { diff --git a/nixos/modules/containers/forgejo.nix b/nixos/modules/containers/forgejo.nix index 92dc034..913213d 100644 --- a/nixos/modules/containers/forgejo.nix +++ b/nixos/modules/containers/forgejo.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.containers.forgejo; -in { +in +{ options = { youthlic.containers.forgejo = { enable = lib.mkEnableOption "forgejo container"; @@ -54,62 +56,64 @@ in { } ]; - config = {lib, ...}: { - imports = [ - ./../programs/forgejo.nix - ./../programs/postgresql.nix - ]; + config = + { lib, ... }: + { + imports = [ + ./../programs/forgejo.nix + ./../programs/postgresql.nix + ]; - nixpkgs.pkgs = pkgs; + nixpkgs.pkgs = pkgs; - systemd.tmpfiles.rules = [ - "d /var/lib/forgejo 770 forgejo forgejo -" - "d /var/lib/postgresql 770 postgres postgres -" - ]; + systemd.tmpfiles.rules = [ + "d /var/lib/forgejo 770 forgejo forgejo -" + "d /var/lib/postgresql 770 postgres postgres -" + ]; - youthlic.programs = { - forgejo = { - enable = true; - domain = cfg.domain; - sshPort = cfg.sshPort; - httpPort = cfg.httpPort; - database = { - user = "forgejo"; + youthlic.programs = { + forgejo = { + enable = true; + domain = cfg.domain; + sshPort = cfg.sshPort; + httpPort = cfg.httpPort; + database = { + user = "forgejo"; + }; + }; + postgresql = { + enable = true; + database = "forgejo"; + auth_method = "peer"; + version = "17"; }; }; - postgresql = { - enable = true; - database = "forgejo"; - auth_method = "peer"; - version = "17"; - }; - }; - systemd.services.forgejo = { - wants = ["postgresql.service"]; - requires = ["postgresql.service"]; - after = ["postgresql.service"]; - wantedBy = ["default.target"]; - }; - - networking = { - defaultGateway = "192.168.111.1"; - firewall = { - enable = true; - allowedTCPPorts = [ - cfg.httpPort - cfg.sshPort - ]; - allowedUDPPorts = [ - cfg.httpPort - cfg.sshPort - ]; + systemd.services.forgejo = { + wants = [ "postgresql.service" ]; + requires = [ "postgresql.service" ]; + after = [ "postgresql.service" ]; + wantedBy = [ "default.target" ]; }; - useHostResolvConf = lib.mkForce false; + + networking = { + defaultGateway = "192.168.111.1"; + firewall = { + enable = true; + allowedTCPPorts = [ + cfg.httpPort + cfg.sshPort + ]; + allowedUDPPorts = [ + cfg.httpPort + cfg.sshPort + ]; + }; + useHostResolvConf = lib.mkForce false; + }; + services.resolved.enable = true; + system.stateVersion = "24.11"; }; - services.resolved.enable = true; - system.stateVersion = "24.11"; - }; }; }; } diff --git a/nixos/modules/containers/miniflux.nix b/nixos/modules/containers/miniflux.nix index e9bb5d0..43516b3 100644 --- a/nixos/modules/containers/miniflux.nix +++ b/nixos/modules/containers/miniflux.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.containers.miniflux; -in { +in +{ options = { youthlic.containers.miniflux = { enable = lib.mkEnableOption "miniflux container"; @@ -36,55 +38,57 @@ in { }; }; - config = {lib, ...}: { - imports = [ - ./../programs/miniflux.nix - ./../programs/postgresql.nix - ]; + config = + { lib, ... }: + { + imports = [ + ./../programs/miniflux.nix + ./../programs/postgresql.nix + ]; - nixpkgs.pkgs = pkgs; + nixpkgs.pkgs = pkgs; - systemd.tmpfiles.rules = [ - "d /var/lib/miniflux 770 miniflux miniflux -" - "d /var/lib/postgresql 770 postgres postgres -" - "d /run/secrets 770 root miniflux -" - ]; + systemd.tmpfiles.rules = [ + "d /var/lib/miniflux 770 miniflux miniflux -" + "d /var/lib/postgresql 770 postgres postgres -" + "d /run/secrets 770 root miniflux -" + ]; - youthlic.programs = { - miniflux = { - enable = true; - database = { - user = "miniflux"; + youthlic.programs = { + miniflux = { + enable = true; + database = { + user = "miniflux"; + }; + adminCredentialsFile = cfg.adminCredentialsFile; + }; + postgresql = { + enable = true; + database = "miniflux"; + auth_method = "peer"; + version = "17"; }; - adminCredentialsFile = cfg.adminCredentialsFile; }; - postgresql = { - enable = true; - database = "miniflux"; - auth_method = "peer"; - version = "17"; - }; - }; - systemd.services.miniflux = { - wants = ["postgresql.service"]; - requires = ["postgresql.service"]; - after = ["postgresql.service"]; - wantedBy = ["default.target"]; - }; - - networking = { - defaultGateway = "192.168.111.1"; - firewall = { - enable = true; - allowedTCPPorts = [8485]; - allowedUDPPorts = [8485]; + systemd.services.miniflux = { + wants = [ "postgresql.service" ]; + requires = [ "postgresql.service" ]; + after = [ "postgresql.service" ]; + wantedBy = [ "default.target" ]; }; - useHostResolvConf = lib.mkForce false; + + networking = { + defaultGateway = "192.168.111.1"; + firewall = { + enable = true; + allowedTCPPorts = [ 8485 ]; + allowedUDPPorts = [ 8485 ]; + }; + useHostResolvConf = lib.mkForce false; + }; + services.resolved.enable = true; + system.stateVersion = "24.11"; }; - services.resolved.enable = true; - system.stateVersion = "24.11"; - }; }; }; } diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index d4b1c42..f365260 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -1,3 +1,6 @@ -{lib, ...}: { - imports = with lib; youthlic.loadImports' ./. (filter (name: !hasSuffix "/top-level" (toString name))); +{ lib, ... }: +{ + imports = + with lib; + youthlic.loadImports' ./. (filter (name: !hasSuffix "/top-level" (toString name))); } diff --git a/nixos/modules/deploy/default.nix b/nixos/modules/deploy/default.nix index f84ae2a..d5df750 100644 --- a/nixos/modules/deploy/default.nix +++ b/nixos/modules/deploy/default.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.users.deploy; -in { +in +{ options = { youthlic.users.deploy = { enable = lib.mkEnableOption "deploy"; diff --git a/nixos/modules/documentation.nix b/nixos/modules/documentation.nix index 460f9fe..d95ed33 100644 --- a/nixos/modules/documentation.nix +++ b/nixos/modules/documentation.nix @@ -6,119 +6,125 @@ }: lib.mkMerge [ { - environment.systemPackages = with pkgs; [man-pages man-pages-posix]; + environment.systemPackages = with pkgs; [ + man-pages + man-pages-posix + ]; documentation = { info.enable = true; nixos.enable = false; dev.enable = true; }; } - (let - inherit (pkgs.writers) writeFish; - cfg = config.documentation.man.man-db; - cachePath = "/var/cache/man/nixos"; - in { - documentation.man.generateCaches = false; + ( + let + inherit (pkgs.writers) writeFish; + cfg = config.documentation.man.man-db; + cachePath = "/var/cache/man/nixos"; + in + { + documentation.man.generateCaches = false; - systemd.services."man-db" = { - requires = ["sysinit-reactivation.target"]; - after = ["sysinit-reactivation.target"]; - partOf = ["sysinit-reactivation.target"]; - wantedBy = ["default.target"]; - path = [ - cfg.package - pkgs.gawk - ]; + systemd.services."man-db" = { + requires = [ "sysinit-reactivation.target" ]; + after = [ "sysinit-reactivation.target" ]; + partOf = [ "sysinit-reactivation.target" ]; + wantedBy = [ "default.target" ]; + path = [ + cfg.package + pkgs.gawk + ]; - serviceConfig = { - Nice = 19; - IOSchedulingClass = "idle"; - IOSchedulingPrioriry = 7; - ExecStart = - writeFish "mandbsvc" # fish - - '' - set -l SystemManLoc "/run/current-system/sw/share/man" - set -l ContentRecord "${cachePath}/man-db-state" + serviceConfig = { + Nice = 19; + IOSchedulingClass = "idle"; + IOSchedulingPrioriry = 7; + ExecStart = + writeFish "mandbsvc" # fish - if [ ! -d "${cachePath}" ] - mkdir -pv "${cachePath}" || exit 1 - end + '' + set -l SystemManLoc "/run/current-system/sw/share/man" + set -l ContentRecord "${cachePath}/man-db-state" - if [ ! -f "$ContentRecord" ] - touch "$ContentRecord" || exit 1 - end - # 1) Collect list of all manpage files and calculate hashes - # of them - # - # man1/ls.1.gz - # man3/func.3.gz - # - # hash -> - # - # bbbbbbbbbbbb (man1/ls.1.gz) - # aaaaaaaaaaaa (man3/func.3.gz) - set -l hashes "$( - find -L "$SystemManLoc" -type f -iname "*.gz" \ - -exec sha256sum "{}" "+" \ - | awk '{ print $1 }' - or exit 1 - )" + if [ ! -d "${cachePath}" ] + mkdir -pv "${cachePath}" || exit 1 + end - # 2) Sort the hashes to make them "stable", - # and then join them toghther into a big long string, - # and then hash this big string to get the hash of the directory - # - # bbbbbbbbbbbb - # aaaaaaaaaaaa - # - # sort -> - # - # aaaaaaaaaaaa - # bbbbbbbbbbbb - # - # join -> - # - # aaaaaaaaaaaabbbbbbbbbbbb - # - # hash -> - # - # cccccccccccc - set -l ultimate_hash ( - echo $hashes \ - | sort \ - | string join "" \ - | sha256sum - \ - | awk '{ print $1 }' - or exit 1 - ) + if [ ! -f "$ContentRecord" ] + touch "$ContentRecord" || exit 1 + end + # 1) Collect list of all manpage files and calculate hashes + # of them + # + # man1/ls.1.gz + # man3/func.3.gz + # + # hash -> + # + # bbbbbbbbbbbb (man1/ls.1.gz) + # aaaaaaaaaaaa (man3/func.3.gz) + set -l hashes "$( + find -L "$SystemManLoc" -type f -iname "*.gz" \ + -exec sha256sum "{}" "+" \ + | awk '{ print $1 }' + or exit 1 + )" - set -l old_hash "$( string collect < "$ContentRecord" )" + # 2) Sort the hashes to make them "stable", + # and then join them toghther into a big long string, + # and then hash this big string to get the hash of the directory + # + # bbbbbbbbbbbb + # aaaaaaaaaaaa + # + # sort -> + # + # aaaaaaaaaaaa + # bbbbbbbbbbbb + # + # join -> + # + # aaaaaaaaaaaabbbbbbbbbbbb + # + # hash -> + # + # cccccccccccc + set -l ultimate_hash ( + echo $hashes \ + | sort \ + | string join "" \ + | sha256sum - \ + | awk '{ print $1 }' + or exit 1 + ) - echo "Old hash: $old_hash" - echo "New hash: $ultimate_hash" + set -l old_hash "$( string collect < "$ContentRecord" )" - if [ "$old_hash" != "$ultimate_hash" ] - echo "Hash changed, do a full man-db rebuild" - mandb -psc || exit 1 - echo "Write new hash" - echo "$ultimate_hash" > "$ContentRecord" - else - echo "Hash not changed, skip" - end - ''; + echo "Old hash: $old_hash" + echo "New hash: $ultimate_hash" + + if [ "$old_hash" != "$ultimate_hash" ] + echo "Hash changed, do a full man-db rebuild" + mandb -psc || exit 1 + echo "Write new hash" + echo "$ultimate_hash" > "$ContentRecord" + else + echo "Hash not changed, skip" + end + ''; + }; }; - }; - environment.extraSetup = - # bash - '' - find "$out/share/man" \ - -mindepth 1 -maxdepth 1 \ - -not -name "man[1-8]" \ - -exec rm -r "{}" ";" + environment.extraSetup = + # bash + '' + find "$out/share/man" \ + -mindepth 1 -maxdepth 1 \ + -not -name "man[1-8]" \ + -exec rm -r "{}" ";" - rm -r "$out/share/man/man3" - ''; - }) + rm -r "$out/share/man/man3" + ''; + } + ) ] diff --git a/nixos/modules/gui/cosmic.nix b/nixos/modules/gui/cosmic.nix index 4da6b65..041e631 100644 --- a/nixos/modules/gui/cosmic.nix +++ b/nixos/modules/gui/cosmic.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.gui; -in { +in +{ config = lib.mkIf (cfg.enabled == "cosmic") { # Enable the X11 windowing system. # You can disable this if you're only using the Wayland session. diff --git a/nixos/modules/gui/default.nix b/nixos/modules/gui/default.nix index 36b7fa9..feed25e 100644 --- a/nixos/modules/gui/default.nix +++ b/nixos/modules/gui/default.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.gui; -in { +in +{ imports = with lib; youthlic.loadImports ./.; options = { youthlic.gui = { diff --git a/nixos/modules/gui/kde.nix b/nixos/modules/gui/kde.nix index 9651516..f6bce71 100644 --- a/nixos/modules/gui/kde.nix +++ b/nixos/modules/gui/kde.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.gui; -in { +in +{ config = lib.mkIf (cfg.enabled == "kde") { services = { desktopManager.plasma6.enable = true; diff --git a/nixos/modules/gui/niri.nix b/nixos/modules/gui/niri.nix index 86cb32d..052bb85 100644 --- a/nixos/modules/gui/niri.nix +++ b/nixos/modules/gui/niri.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.gui; -in { +in +{ options = { youthlic.gui.niri = { }; @@ -27,7 +29,7 @@ in { terminal-exec = { enable = true; settings = { - default = ["Alacritty.desktop"]; + default = [ "Alacritty.desktop" ]; }; }; mime = { @@ -59,7 +61,7 @@ in { "firefox.desktop" "chromium-browser.desktop" ]; - "x-scheme-handler/tg" = ["telegramdesktop.desktop"]; + "x-scheme-handler/tg" = [ "telegramdesktop.desktop" ]; "x-scheme-handler/unknown" = [ "firefox.desktop" "chromium-browser.desktop" @@ -97,7 +99,11 @@ in { programs = { regreet = { enable = true; - cageArgs = ["-s" "-m" "last"]; + cageArgs = [ + "-s" + "-m" + "last" + ]; }; niri = { enable = true; diff --git a/nixos/modules/hardware.nix b/nixos/modules/hardware.nix index ba31c29..9cffe81 100644 --- a/nixos/modules/hardware.nix +++ b/nixos/modules/hardware.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.hardware; -in { +in +{ options = { youthlic.hardware = { asus = { diff --git a/nixos/modules/home.nix b/nixos/modules/home.nix index 9e0f7cb..d44bfa9 100644 --- a/nixos/modules/home.nix +++ b/nixos/modules/home.nix @@ -6,7 +6,8 @@ pkgs, rootPath, ... -}: { +}: +{ options.youthlic.home-manager = { enable = lib.mkOption { type = lib.types.bool; @@ -32,17 +33,19 @@ ''; }; }; - config = let - cfg = config.youthlic.home-manager; - unixName = cfg.unixName; - hostName = cfg.hostName; - in + config = + let + cfg = config.youthlic.home-manager; + unixName = cfg.unixName; + hostName = cfg.hostName; + in lib.mkIf cfg.enable { home-manager = { useGlobalPkgs = true; useUserPackages = true; users."${cfg.unixName}" = ( - {...}: { + { ... }: + { imports = [ outputs.homeModules."${unixName}" (rootPath + "/home/${unixName}/configurations/${hostName}") @@ -55,7 +58,7 @@ inherit (pkgs) system; }; backupFileExtension = "backup"; - sharedModules = [outputs.homeModules.default]; + sharedModules = [ outputs.homeModules.default ]; }; }; } diff --git a/nixos/modules/i18n.nix b/nixos/modules/i18n.nix index 26c7667..b71184f 100644 --- a/nixos/modules/i18n.nix +++ b/nixos/modules/i18n.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.i18n; -in { +in +{ options = { youthlic.i18n = { enable = lib.mkEnableOption "zh env"; diff --git a/nixos/modules/nix.nix b/nixos/modules/nix.nix index b1c6db9..0fe811a 100644 --- a/nixos/modules/nix.nix +++ b/nixos/modules/nix.nix @@ -5,18 +5,22 @@ pkgs, lib, ... -}: { +}: +{ config = { environment.etc = inputs - |> lib.mapAttrs' (name: value: + |> lib.mapAttrs' ( + name: value: lib.nameValuePair "nix/inputs/${name}" { source = value; - }); + } + ); nixpkgs = { config = { allowUnfree = true; - allowInsecurePredicate = p: + allowInsecurePredicate = + p: builtins.elem (lib.getName p) [ # for fluffychat and neochat "olm" @@ -29,7 +33,7 @@ mode = "0444"; }; nix = { - nixPath = ["/etc/nix/inputs"]; + nixPath = [ "/etc/nix/inputs" ]; extraOptions = '' !include ${config.sops.secrets."access-tokens".path} ''; @@ -44,13 +48,12 @@ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; auto-optimise-store = lib.mkDefault true; - experimental-features = - [ - "nix-command" - "flakes" - ] - ++ (lib.optional config.lix.enable "pipe-operator") - ++ (lib.optional (!config.lix.enable) "pipe-operators"); + experimental-features = [ + "nix-command" + "flakes" + ] + ++ (lib.optional config.lix.enable "pipe-operator") + ++ (lib.optional (!config.lix.enable) "pipe-operators"); warn-dirty = false; system-features = [ "kvm" @@ -63,11 +66,13 @@ registry = inputs |> lib.filterAttrs (name: _value: name != "nixpkgs") - |> lib.mapAttrs (_name: value: { - flake = lib.mkForce { - outPath = value; - }; - }); + |> lib.mapAttrs ( + _name: value: { + flake = lib.mkForce { + outPath = value; + }; + } + ); }; }; } diff --git a/nixos/modules/programs/asusd.nix b/nixos/modules/programs/asusd.nix index c116c39..a5d203f 100644 --- a/nixos/modules/programs/asusd.nix +++ b/nixos/modules/programs/asusd.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.asusd; -in { +in +{ options = { youthlic.programs.asusd = { enable = lib.mkEnableOption "asusd"; diff --git a/nixos/modules/programs/bash.nix b/nixos/modules/programs/bash.nix index 32b9ec6..834b354 100644 --- a/nixos/modules/programs/bash.nix +++ b/nixos/modules/programs/bash.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.bash; -in { +in +{ options = { youthlic.programs.bash = { enable = lib.mkEnableOption "bash"; diff --git a/nixos/modules/programs/caddy/OuterWildsTextAdventure.nix b/nixos/modules/programs/caddy/OuterWildsTextAdventure.nix index 07c265f..d851101 100644 --- a/nixos/modules/programs/caddy/OuterWildsTextAdventure.nix +++ b/nixos/modules/programs/caddy/OuterWildsTextAdventure.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.caddy.outer-wilds-text-adventure; caddy-cfg = config.youthlic.programs.caddy; -in { +in +{ options = { youthlic.programs.caddy.outer-wilds-text-adventure = { enable = lib.mkEnableOption "caddy.OuterWildsTextAdventure"; diff --git a/nixos/modules/programs/caddy/default.nix b/nixos/modules/programs/caddy/default.nix index 641cb33..9882ec4 100644 --- a/nixos/modules/programs/caddy/default.nix +++ b/nixos/modules/programs/caddy/default.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.caddy; -in { +in +{ imports = lib.youthlic.loadImports ./.; options = { youthlic.programs.caddy = { @@ -20,7 +22,7 @@ in { enable = true; }; networking.firewall = { - allowedTCPPorts = [443]; + allowedTCPPorts = [ 443 ]; }; }; } diff --git a/nixos/modules/programs/caddy/garage.nix b/nixos/modules/programs/caddy/garage.nix index 02e56e5..674c369 100644 --- a/nixos/modules/programs/caddy/garage.nix +++ b/nixos/modules/programs/caddy/garage.nix @@ -2,10 +2,12 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.caddy.garage; caddy-cfg = config.youthlic.programs.caddy; -in { +in +{ options = { youthlic.programs.caddy.garage = { enable = lib.mkEnableOption "caddy.garage"; diff --git a/nixos/modules/programs/caddy/radicle-explorer.nix b/nixos/modules/programs/caddy/radicle-explorer.nix index 7220ae6..6a44afa 100644 --- a/nixos/modules/programs/caddy/radicle-explorer.nix +++ b/nixos/modules/programs/caddy/radicle-explorer.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.caddy.radicle-explorer; caddy-cfg = config.youthlic.programs.caddy; -in { +in +{ options = { youthlic.programs.caddy.radicle-explorer = { enable = lib.mkEnableOption "caddy.radicle-explorer"; diff --git a/nixos/modules/programs/dae/default.nix b/nixos/modules/programs/dae/default.nix index 2556b73..1f369e2 100644 --- a/nixos/modules/programs/dae/default.nix +++ b/nixos/modules/programs/dae/default.nix @@ -4,9 +4,11 @@ pkgs, lib, ... -}: let +}: +let cfg = config.youthlic.programs.dae; -in { +in +{ options = { youthlic.programs.dae = { enable = lib.mkEnableOption "dae"; @@ -28,100 +30,102 @@ in { mode = "0444"; sopsFile = rootPath + "/secrets/general.yaml"; }; - systemd.services = let - update = '' - head="user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" - new_proxy=/etc/dae/proxy.d.new - num=0 - check=1 - urls="$(cat ${config.sops.secrets.url.path})" - mkdir -p ''${new_proxy} - for url in ''${urls}; do - txt=''${new_proxy}/''${num}.txt - config="''${new_proxy}/''${num}.dae" - echo \'curl -LH \""''${head}"\" \""''${url}"\" -o \""''${txt}"\"\' - curl -LH "''${head}" "''${url}" -o "''${txt}" - echo End curl - echo "" > ''${config} - { - echo 'subscription {' - echo \ \ wget:\ \"file://proxy.d/''${num}.txt\" - echo "}" - } >> ''${config} - if [[ ! -s ''${txt} ]]; then - check=0 - fi - chmod 0640 ''${txt} - chmod 0640 ''${config} - num=$((num+1)) + systemd.services = + let + update = '' + head="user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" + new_proxy=/etc/dae/proxy.d.new + num=0 + check=1 + urls="$(cat ${config.sops.secrets.url.path})" + mkdir -p ''${new_proxy} + for url in ''${urls}; do + txt=''${new_proxy}/''${num}.txt + config="''${new_proxy}/''${num}.dae" + echo \'curl -LH \""''${head}"\" \""''${url}"\" -o \""''${txt}"\"\' + curl -LH "''${head}" "''${url}" -o "''${txt}" + echo End curl + echo "" > ''${config} + { + echo 'subscription {' + echo \ \ wget:\ \"file://proxy.d/''${num}.txt\" + echo "}" + } >> ''${config} + if [[ ! -s ''${txt} ]]; then + check=0 + fi + chmod 0640 ''${txt} + chmod 0640 ''${config} + num=$((num+1)) - if [[ ''${check} -eq 0 ]]; then - echo "''${txt}" is empty - exit 103 + if [[ ''${check} -eq 0 ]]; then + echo "''${txt}" is empty + exit 103 + fi + done + if [[ -d /etc/dae/proxy.d ]]; then + rm -rf /etc/proxy.d.old + mv /etc/dae/proxy.d /etc/dae/proxy.d.old fi - done - if [[ -d /etc/dae/proxy.d ]]; then - rm -rf /etc/proxy.d.old - mv /etc/dae/proxy.d /etc/dae/proxy.d.old - fi - mv ''${new_proxy} /etc/dae/proxy.d - ''; - updateScript = pkgs.writeShellApplication { - name = "update.sh"; - runtimeInputs = with pkgs; [ - coreutils - curl - ]; - text = '' - mkdir -p /etc/proxy.d - if [ -z "$(ls -A /etc/dae/proxy.d 2>/dev/null)" ]; then - echo "No subscription file found in /etc/dae/proxy.d. Update now..." + mv ''${new_proxy} /etc/dae/proxy.d + ''; + updateScript = pkgs.writeShellApplication { + name = "update.sh"; + runtimeInputs = with pkgs; [ + coreutils + curl + ]; + text = '' + mkdir -p /etc/proxy.d + if [ -z "$(ls -A /etc/dae/proxy.d 2>/dev/null)" ]; then + echo "No subscription file found in /etc/dae/proxy.d. Update now..." + ${update} + else + echo "Found existing subscription files. Skipping immediate update." + fi + ''; + }; + updateForceScript = pkgs.writeShellApplication { + name = "update-force.sh"; + runtimeInputs = with pkgs; [ + coreutils + curl + ]; + text = '' ${update} - else - echo "Found existing subscription files. Skipping immediate update." - fi - ''; - }; - updateForceScript = pkgs.writeShellApplication { - name = "update-force.sh"; - runtimeInputs = with pkgs; [ - coreutils - curl - ]; - text = '' - ${update} - ''; - }; - in { - "update-dae-subscription-immediate" = { - after = ["network-online.target"]; - wants = ["network-online.target"]; - before = ["dae.service"]; - serviceConfig = { - Type = "oneshot"; - User = "root"; - ExecStart = [ - "${updateScript}/bin/update.sh" - ]; + ''; }; - wantedBy = ["multi-user.target"]; - }; - "update-dae-subscription-force" = { - serviceConfig = { - Type = "oneshot"; - User = "root"; - ExecStartPre = [ - "-${pkgs.systemd}/bin/systemctl stop dae.service" - ]; - ExecStartPost = [ - "-${pkgs.systemd}/bin/systemctl start dae.service" - ]; - ExecStart = [ - "${updateForceScript}/bin/update-force.sh" - ]; + in + { + "update-dae-subscription-immediate" = { + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + before = [ "dae.service" ]; + serviceConfig = { + Type = "oneshot"; + User = "root"; + ExecStart = [ + "${updateScript}/bin/update.sh" + ]; + }; + wantedBy = [ "multi-user.target" ]; + }; + "update-dae-subscription-force" = { + serviceConfig = { + Type = "oneshot"; + User = "root"; + ExecStartPre = [ + "-${pkgs.systemd}/bin/systemctl stop dae.service" + ]; + ExecStartPost = [ + "-${pkgs.systemd}/bin/systemctl start dae.service" + ]; + ExecStart = [ + "${updateForceScript}/bin/update-force.sh" + ]; + }; }; }; - }; }) (lib.mkIf (cfg.enable && config.youthlic.programs.juicity.client.enable) { environment.etc."dae/local.d/0.dae" = { diff --git a/nixos/modules/programs/emacs.nix b/nixos/modules/programs/emacs.nix index 456136a..2a217a2 100644 --- a/nixos/modules/programs/emacs.nix +++ b/nixos/modules/programs/emacs.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.emacs; -in { +in +{ options = { youthlic.programs.emacs = { enable = lib.mkEnableOption "emacs"; @@ -15,13 +17,15 @@ in { services.emacs = { enable = true; install = true; - package = with pkgs; - (emacsPackagesFor emacs-pgtk).emacsWithPackages (p: - with p; [ + package = + with pkgs; + (emacsPackagesFor emacs-pgtk).emacsWithPackages ( + p: with p; [ vterm evil gruvbox-theme - ]); + ] + ); }; }; } diff --git a/nixos/modules/programs/forgejo.nix b/nixos/modules/programs/forgejo.nix index b4d2cac..a091418 100644 --- a/nixos/modules/programs/forgejo.nix +++ b/nixos/modules/programs/forgejo.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.forgejo; -in { +in +{ options = { youthlic.programs.forgejo = { enable = lib.mkEnableOption "forgejo"; @@ -90,15 +92,15 @@ in { let caddy-cfg = config.youthlic.programs.caddy; in - lib.mkIf (cfg.enable && caddy-cfg.enable) { - services.caddy.virtualHosts = { - "forgejo.${caddy-cfg.baseDomain}" = { - extraConfig = '' - reverse_proxy 127.0.0.1:${cfg.httpPort} - ''; - }; + lib.mkIf (cfg.enable && caddy-cfg.enable) { + services.caddy.virtualHosts = { + "forgejo.${caddy-cfg.baseDomain}" = { + extraConfig = '' + reverse_proxy 127.0.0.1:${cfg.httpPort} + ''; }; - } + }; + } ) ]; } diff --git a/nixos/modules/programs/garage.nix b/nixos/modules/programs/garage.nix index 6055408..55ad419 100644 --- a/nixos/modules/programs/garage.nix +++ b/nixos/modules/programs/garage.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.garage; -in { +in +{ options = { youthlic.programs.garage = { enable = lib.mkEnableOption "garage"; diff --git a/nixos/modules/programs/guix.nix b/nixos/modules/programs/guix.nix index 4059d03..2f1846a 100644 --- a/nixos/modules/programs/guix.nix +++ b/nixos/modules/programs/guix.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.guix; -in { +in +{ options = { youthlic.programs.guix = { enable = lib.mkEnableOption "guix"; diff --git a/nixos/modules/programs/juicity/default.nix b/nixos/modules/programs/juicity/default.nix index eac4b24..f47bbba 100644 --- a/nixos/modules/programs/juicity/default.nix +++ b/nixos/modules/programs/juicity/default.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.juicity; -in { +in +{ imports = lib.youthlic.loadImports ./.; options = { youthlic.programs.juicity = { @@ -19,12 +21,12 @@ in { }; config = lib.mkMerge [ (lib.mkIf cfg.client.enable { - users.groups.juicity.members = ["root"]; + users.groups.juicity.members = [ "root" ]; sops = { secrets = { - "juicity/serverIp" = {}; - "juicity/sni" = {}; - "juicity/certchainSha256" = {}; + "juicity/serverIp" = { }; + "juicity/sni" = { }; + "juicity/certchainSha256" = { }; }; templates."juicity-client-config.json" = { group = "juicity"; @@ -54,7 +56,7 @@ in { }; }) (lib.mkIf cfg.server.enable { - users.groups.juicity.members = ["root"]; + users.groups.juicity.members = [ "root" ]; sops = { secrets = { "juicity/certificate" = { @@ -94,8 +96,8 @@ in { }) (lib.mkIf (cfg.server.enable || cfg.client.enable) { sops.secrets = { - "juicity/uuid" = {}; - "juicity/password" = {}; + "juicity/uuid" = { }; + "juicity/password" = { }; }; }) ]; diff --git a/nixos/modules/programs/juicity/template.nix b/nixos/modules/programs/juicity/template.nix index 7117358..00659a3 100644 --- a/nixos/modules/programs/juicity/template.nix +++ b/nixos/modules/programs/juicity/template.nix @@ -3,23 +3,27 @@ lib, pkgs, ... -}: let +}: +let cfg = config.services.juicity; - settingsFormat = pkgs.formats.json {}; + settingsFormat = pkgs.formats.json { }; clientConfigFile = - if (cfg.client.configFile != null) - then cfg.client.configFile - else settingsFormat cfg.client.settings; + if (cfg.client.configFile != null) then + cfg.client.configFile + else + settingsFormat cfg.client.settings; serverConfigFile = - if (cfg.server.configFile != null) - then cfg.server.configFile - else settingsFormat cfg.server.settings; -in { + if (cfg.server.configFile != null) then + cfg.server.configFile + else + settingsFormat cfg.server.settings; +in +{ options = { services.juicity = { client = { enable = lib.mkEnableOption "juicity-client"; - package = lib.mkPackageOption pkgs "juicity" {}; + package = lib.mkPackageOption pkgs "juicity" { }; group = lib.mkOption { type = lib.types.nullOr lib.types.str; example = "juicity"; @@ -27,7 +31,7 @@ in { }; settings = lib.mkOption { type = settingsFormat.type; - default = {}; + default = { }; example = { listen = ":1000"; server = "112.32.62.11:23182"; @@ -55,7 +59,7 @@ in { }; allowedOpenFirewallPorts = lib.mkOption { type = lib.types.nullOr (lib.types.listOf lib.types.port); - example = [23182]; + example = [ 23182 ]; default = null; description = '' the ports should be open @@ -64,7 +68,7 @@ in { }; server = { enable = lib.mkEnableOption "juicity-server"; - package = lib.mkPackageOption pkgs "juicity" {}; + package = lib.mkPackageOption pkgs "juicity" { }; group = lib.mkOption { type = lib.types.nullOr lib.types.str; example = "juicity"; @@ -72,7 +76,7 @@ in { }; settings = lib.mkOption { type = settingsFormat.type; - default = {}; + default = { }; description = '' Juicity server configuration, for configuration options see example of [server](https://github.com/juicity/juicity/blob/main/install/example-server.json) on github. @@ -100,7 +104,7 @@ in { }; allowedOpenFirewallPorts = lib.mkOption { type = lib.types.nullOr (lib.types.listOf lib.types.port); - example = [23182]; + example = [ 23182 ]; default = null; description = '' the ports should be open diff --git a/nixos/modules/programs/kanata.nix b/nixos/modules/programs/kanata.nix index 09d973c..e5ff8e2 100644 --- a/nixos/modules/programs/kanata.nix +++ b/nixos/modules/programs/kanata.nix @@ -3,16 +3,18 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.programs.kanata; -in { +in +{ options = { youthlic.programs.kanata = { enable = lib.mkEnableOption "kanata"; }; }; config = lib.mkIf cfg.enable { - boot.kernelModules = ["uinput"]; + boot.kernelModules = [ "uinput" ]; hardware.uinput.enable = true; services.kanata = { enable = true; diff --git a/nixos/modules/programs/mautrix-telegram.nix b/nixos/modules/programs/mautrix-telegram.nix index 175986f..b2bc18a 100644 --- a/nixos/modules/programs/mautrix-telegram.nix +++ b/nixos/modules/programs/mautrix-telegram.nix @@ -2,16 +2,18 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.mautrix-telegram; -in { +in +{ options = { youthlic.programs.mautrix-telegram = { enable = lib.mkEnableOption "mautrix-telegram"; }; }; config = lib.mkIf cfg.enable { - sops.secrets.matrix-telegram-bot = {}; + sops.secrets.matrix-telegram-bot = { }; services.mautrix-telegram = { enable = true; environmentFile = "${config.sops.secrets.matrix-telegram-bot.path}"; diff --git a/nixos/modules/programs/miniflux.nix b/nixos/modules/programs/miniflux.nix index da1a106..d7d94de 100644 --- a/nixos/modules/programs/miniflux.nix +++ b/nixos/modules/programs/miniflux.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.miniflux; -in { +in +{ options = { youthlic.programs.miniflux = { enable = lib.mkEnableOption "miniflux"; diff --git a/nixos/modules/programs/minio.nix b/nixos/modules/programs/minio.nix index 5cf0e5c..38cce62 100644 --- a/nixos/modules/programs/minio.nix +++ b/nixos/modules/programs/minio.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.minio; -in { +in +{ options = { youthlic.programs.minio = { enable = lib.mkEnableOption "minio"; diff --git a/nixos/modules/programs/nh.nix b/nixos/modules/programs/nh.nix index ce07c10..a8958fd 100644 --- a/nixos/modules/programs/nh.nix +++ b/nixos/modules/programs/nh.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ config = { programs.nh = { enable = true; diff --git a/nixos/modules/programs/nix-ld.nix b/nixos/modules/programs/nix-ld.nix index bae07d7..5a2e70f 100644 --- a/nixos/modules/programs/nix-ld.nix +++ b/nixos/modules/programs/nix-ld.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.nix-ld; -in { +in +{ options = { youthlic.programs.nix-ld = { enable = lib.mkEnableOption "nix-ld"; diff --git a/nixos/modules/programs/obs.nix b/nixos/modules/programs/obs.nix index 6567780..d6b0cee 100644 --- a/nixos/modules/programs/obs.nix +++ b/nixos/modules/programs/obs.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.obs; -in { +in +{ options = { youthlic.programs.obs = { enable = lib.mkEnableOption "obs"; diff --git a/nixos/modules/programs/open-webui.nix b/nixos/modules/programs/open-webui.nix index 1770e5f..f4e2374 100644 --- a/nixos/modules/programs/open-webui.nix +++ b/nixos/modules/programs/open-webui.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.open-webui; -in { +in +{ options = { youthlic.programs.open-webui = { enable = lib.mkEnableOption "open-webui"; @@ -25,15 +27,15 @@ in { let caddy-cfg = config.youthlic.programs.caddy; in - lib.mkIf (cfg.enable && caddy-cfg.enable) { - services.caddy.virtualHosts = { - "open-webui.${caddy-cfg.baseDomain}" = { - extraConfig = '' - reverse_proxy 127.0.0.1:8083 - ''; - }; + lib.mkIf (cfg.enable && caddy-cfg.enable) { + services.caddy.virtualHosts = { + "open-webui.${caddy-cfg.baseDomain}" = { + extraConfig = '' + reverse_proxy 127.0.0.1:8083 + ''; }; - } + }; + } ) ]; } diff --git a/nixos/modules/programs/openssh.nix b/nixos/modules/programs/openssh.nix index eaa0b1c..75f400b 100644 --- a/nixos/modules/programs/openssh.nix +++ b/nixos/modules/programs/openssh.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.openssh; -in { +in +{ options = { youthlic.programs.openssh = { enable = lib.mkEnableOption "openssh"; @@ -44,7 +46,7 @@ in { "diffie-hellman-group-exchange-sha256" ]; }; - ports = [3022]; + ports = [ 3022 ]; }; }; } diff --git a/nixos/modules/programs/owncast.nix b/nixos/modules/programs/owncast.nix index d60eeb8..4eb05bc 100644 --- a/nixos/modules/programs/owncast.nix +++ b/nixos/modules/programs/owncast.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.owncast; -in { +in +{ options = { youthlic.programs.owncast = { enable = lib.mkEnableOption "owncast"; diff --git a/nixos/modules/programs/postgresql.nix b/nixos/modules/programs/postgresql.nix index ba075eb..2d66235 100644 --- a/nixos/modules/programs/postgresql.nix +++ b/nixos/modules/programs/postgresql.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.postgresql; -in { +in +{ options = { youthlic.programs.postgresql = { enable = lib.mkEnableOption "postgresql"; @@ -27,7 +29,7 @@ in { # default socket: /var/lib/postgresql services.postgresql = { enable = true; - ensureDatabases = [cfg.database]; + ensureDatabases = [ cfg.database ]; ensureUsers = [ { name = "${cfg.database}"; diff --git a/nixos/modules/programs/radicle.nix b/nixos/modules/programs/radicle.nix index 153503f..a1de901 100644 --- a/nixos/modules/programs/radicle.nix +++ b/nixos/modules/programs/radicle.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.radicle; -in { +in +{ options = { youthlic.programs.radicle = { enable = lib.mkEnableOption "radicle"; @@ -55,11 +57,11 @@ in { }; node = { alias = cfg.domain; - listen = []; + listen = [ ]; peers = { type = "dynamic"; }; - connect = []; + connect = [ ]; externalAddresses = [ "${cfg.domain}:8776" ]; diff --git a/nixos/modules/programs/rustypaste/default.nix b/nixos/modules/programs/rustypaste/default.nix index 3165cfc..b0ab914 100644 --- a/nixos/modules/programs/rustypaste/default.nix +++ b/nixos/modules/programs/rustypaste/default.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.rustypaste; -in { +in +{ imports = lib.youthlic.loadImports ./.; options = { diff --git a/nixos/modules/programs/rustypaste/template.nix b/nixos/modules/programs/rustypaste/template.nix index 475bf58..2cf4d9b 100644 --- a/nixos/modules/programs/rustypaste/template.nix +++ b/nixos/modules/programs/rustypaste/template.nix @@ -3,18 +3,20 @@ lib, config, ... -}: let +}: +let cfg = config.services.rustypaste; - settingsFormat = pkgs.formats.toml {}; + settingsFormat = pkgs.formats.toml { }; configFile = settingsFormat.generate "rustypaste-config.toml" cfg.settings; -in { +in +{ options = { services.rustypaste = { enable = lib.mkEnableOption "rustypaste"; - package = lib.mkPackageOption pkgs "rustypaste" {}; + package = lib.mkPackageOption pkgs "rustypaste" { }; settings = lib.mkOption { type = settingsFormat.type; - default = {}; + default = { }; description = '' Rustypaste configuration ''; @@ -61,7 +63,7 @@ in { isSystemUser = true; }; groups = lib.optionalAttrs (cfg.group == "rustypaste") { - rustypaste = {}; + rustypaste = { }; }; }; systemd.services.rustypaste = { @@ -86,8 +88,8 @@ in { Type = "simple"; Restart = "on-failure"; Home = "/var/lib/rustypaste"; - ReadWritePaths = ["/var/lib/rustypaste"]; - StateDirectory = ["rustypaste"]; + ReadWritePaths = [ "/var/lib/rustypaste" ]; + StateDirectory = [ "rustypaste" ]; ExecStart = '' ${lib.getExe cfg.package} ''; diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 7762c37..480a5e4 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.steam; -in { +in +{ options = { youthlic.programs.steam = { enable = lib.mkEnableOption "steam"; diff --git a/nixos/modules/programs/supergfxd.nix b/nixos/modules/programs/supergfxd.nix index 18318ea..0e69481 100644 --- a/nixos/modules/programs/supergfxd.nix +++ b/nixos/modules/programs/supergfxd.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.supergfxd; -in { +in +{ options = { youthlic.programs.supergfxd = { enable = lib.mkEnableOption "supergfxd"; diff --git a/nixos/modules/programs/tailscale.nix b/nixos/modules/programs/tailscale.nix index 1055e9c..998eb3f 100644 --- a/nixos/modules/programs/tailscale.nix +++ b/nixos/modules/programs/tailscale.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.tailscale; -in { +in +{ options = { youthlic.programs.tailscale = { enable = lib.mkEnableOption "tailscale"; diff --git a/nixos/modules/programs/transfer-sh.nix b/nixos/modules/programs/transfer-sh.nix index 468054e..4fff974 100644 --- a/nixos/modules/programs/transfer-sh.nix +++ b/nixos/modules/programs/transfer-sh.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.youthlic.programs.transfer-sh; -in { +in +{ options = { youthlic.programs.transfer-sh = { enable = lib.mkEnableOption "transfer.sh"; diff --git a/nixos/modules/programs/transmission.nix b/nixos/modules/programs/transmission.nix index da26718..d4a89cb 100644 --- a/nixos/modules/programs/transmission.nix +++ b/nixos/modules/programs/transmission.nix @@ -4,9 +4,11 @@ lib, rootPath, ... -}: let +}: +let cfg = config.youthlic.programs.transmission; -in { +in +{ options = { youthlic.programs.transmission = { enable = lib.mkEnableOption "transmission"; @@ -40,21 +42,21 @@ in { let caddy-cfg = config.youthlic.programs.caddy; in - lib.mkIf (cfg.enable && caddy-cfg.enable) { - services.transmission = { - openRPCPort = lib.mkForce false; - settings = { - rpc-bind-address = lib.mkForce "127.0.0.1"; - }; + lib.mkIf (cfg.enable && caddy-cfg.enable) { + services.transmission = { + openRPCPort = lib.mkForce false; + settings = { + rpc-bind-address = lib.mkForce "127.0.0.1"; }; - services.caddy.virtualHosts = { - "transmission.${caddy-cfg.baseDomain}" = { - extraConfig = '' - reverse_proxy 127.0.0.1:9091 - ''; - }; + }; + services.caddy.virtualHosts = { + "transmission.${caddy-cfg.baseDomain}" = { + extraConfig = '' + reverse_proxy 127.0.0.1:9091 + ''; }; - } + }; + } ) ]; } diff --git a/nixos/modules/programs/wshowkeys.nix b/nixos/modules/programs/wshowkeys.nix index 825aabb..a9755e6 100644 --- a/nixos/modules/programs/wshowkeys.nix +++ b/nixos/modules/programs/wshowkeys.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.youthlic.programs.wshowkeys; -in { +in +{ options = { youthlic.programs.wshowkeys = { enable = lib.mkEnableOption "wshowkeys"; diff --git a/nixos/modules/sops.nix b/nixos/modules/sops.nix index 6ec8e0b..89cd4c6 100644 --- a/nixos/modules/sops.nix +++ b/nixos/modules/sops.nix @@ -1,9 +1,10 @@ -{rootPath, ...}: { +{ rootPath, ... }: +{ config = { sops.defaultSopsFile = rootPath + "/secrets/general.yaml"; sops.age = { keyFile = "/var/sops/key.txt"; - sshKeyPaths = []; + sshKeyPaths = [ ]; generateKey = false; }; }; diff --git a/nixos/modules/top-level/default.nix b/nixos/modules/top-level/default.nix index 39784b8..bf66b27 100644 --- a/nixos/modules/top-level/default.nix +++ b/nixos/modules/top-level/default.nix @@ -3,7 +3,8 @@ inputs, outputs, ... -}: { +}: +{ imports = with inputs; [ home-manager.nixosModules.home-manager dae.nixosModules.dae diff --git a/nixos/modules/top-level/gui.nix b/nixos/modules/top-level/gui.nix index f3d5475..4395d2e 100644 --- a/nixos/modules/top-level/gui.nix +++ b/nixos/modules/top-level/gui.nix @@ -1,9 +1,9 @@ -{inputs, ...}: { - imports = - [ - ./. - ] - ++ (with inputs; [ - niri-flake.nixosModules.niri - ]); +{ inputs, ... }: +{ + imports = [ + ./. + ] + ++ (with inputs; [ + niri-flake.nixosModules.niri + ]); } diff --git a/nixos/modules/virtualisation/kvm.nix b/nixos/modules/virtualisation/kvm.nix index 897934f..64dbe72 100644 --- a/nixos/modules/virtualisation/kvm.nix +++ b/nixos/modules/virtualisation/kvm.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.youthlic.virtualisation.kvm; -in { +in +{ options = { youthlic.virtualisation.kvm = { enable = lib.mkEnableOption "kvm"; @@ -22,11 +24,11 @@ in { programs.virt-manager = { enable = true; }; - users.groups.libvirtd.members = [cfg.unixName]; + users.groups.libvirtd.members = [ cfg.unixName ]; virtualisation = { libvirtd = { enable = true; - qemu.vhostUserPackages = with pkgs; [virtiofsd]; + qemu.vhostUserPackages = with pkgs; [ virtiofsd ]; }; spiceUSBRedirection = { enable = true; diff --git a/nixos/modules/virtualisation/waydroid.nix b/nixos/modules/virtualisation/waydroid.nix index 263fb5f..775f05b 100644 --- a/nixos/modules/virtualisation/waydroid.nix +++ b/nixos/modules/virtualisation/waydroid.nix @@ -3,9 +3,11 @@ config, pkgs, ... -}: let +}: +let cfg = config.youthlic.virtualisation.waydroid; -in { +in +{ options = { youthlic.virtualisation.waydroid = { enable = lib.mkEnableOption "waydroid"; @@ -15,6 +17,6 @@ in { virtualisation.waydroid = { enable = true; }; - environment.systemPackages = [pkgs.nur.repos.ataraxiasjel.waydroid-script]; + environment.systemPackages = [ pkgs.nur.repos.ataraxiasjel.waydroid-script ]; }; } diff --git a/overlays/additions/OuterWildsTextAdventure.nix b/overlays/additions/OuterWildsTextAdventure.nix index b8a687f..6f8b384 100644 --- a/overlays/additions/OuterWildsTextAdventure.nix +++ b/overlays/additions/OuterWildsTextAdventure.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) OuterWildsTextAdventure; } diff --git a/overlays/additions/TrackersListCollection.nix b/overlays/additions/TrackersListCollection.nix index 17da85c..658e47e 100644 --- a/overlays/additions/TrackersListCollection.nix +++ b/overlays/additions/TrackersListCollection.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages."${system}") TrackersListCollection; } diff --git a/overlays/additions/default.nix b/overlays/additions/default.nix index 32fbc04..a23b24d 100644 --- a/overlays/additions/default.nix +++ b/overlays/additions/default.nix @@ -1,17 +1,19 @@ -{...} @ args: final: prev: let +{ ... }@args: +final: prev: +let inherit (prev) lib; in - [ - ./TrackersListCollection.nix - ./OuterWildsTextAdventure.nix - ./editor-runtime.nix - ./radicle-ci-broker.nix - ./wallpapers.nix - ./waydroid-script.nix - ./rime-yuhaostar.nix - ./nixvim.nix +[ + ./TrackersListCollection.nix + ./OuterWildsTextAdventure.nix + ./editor-runtime.nix + ./radicle-ci-broker.nix + ./wallpapers.nix + ./waydroid-script.nix + ./rime-yuhaostar.nix + ./nixvim.nix - ./pkgsNoCuda.nix - ] - |> map (file: import file args) - |> (overlays: (lib.composeManyExtensions overlays) final prev) + ./pkgsNoCuda.nix +] +|> map (file: import file args) +|> (overlays: (lib.composeManyExtensions overlays) final prev) diff --git a/overlays/additions/editor-runtime.nix b/overlays/additions/editor-runtime.nix index bfba19f..fc24fbd 100644 --- a/overlays/additions/editor-runtime.nix +++ b/overlays/additions/editor-runtime.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) editor-runtime; } diff --git a/overlays/additions/nixvim.nix b/overlays/additions/nixvim.nix index 43cd9ae..4936abf 100644 --- a/overlays/additions/nixvim.nix +++ b/overlays/additions/nixvim.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) nixvim; } diff --git a/overlays/additions/pkgsNoCuda.nix b/overlays/additions/pkgsNoCuda.nix index 58748b8..c14c3eb 100644 --- a/overlays/additions/pkgsNoCuda.nix +++ b/overlays/additions/pkgsNoCuda.nix @@ -1,5 +1,8 @@ -{inputs, ...}: _final: prev: let +{ inputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ pkgsNoCuda = inputs.nixpkgs.legacyPackages.${system}; } diff --git a/overlays/additions/radicle-ci-broker.nix b/overlays/additions/radicle-ci-broker.nix index e22b36a..fd08864 100644 --- a/overlays/additions/radicle-ci-broker.nix +++ b/overlays/additions/radicle-ci-broker.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) radicle-ci-broker; } diff --git a/overlays/additions/rime-yuhaostar.nix b/overlays/additions/rime-yuhaostar.nix index b9de88e..36e55ac 100644 --- a/overlays/additions/rime-yuhaostar.nix +++ b/overlays/additions/rime-yuhaostar.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) rime-yuhaostar; } diff --git a/overlays/additions/wallpapers.nix b/overlays/additions/wallpapers.nix index c51f52d..b9f3568 100644 --- a/overlays/additions/wallpapers.nix +++ b/overlays/additions/wallpapers.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) wallpapers; } diff --git a/overlays/additions/waydroid-script.nix b/overlays/additions/waydroid-script.nix index 17213e8..13dd6cd 100644 --- a/overlays/additions/waydroid-script.nix +++ b/overlays/additions/waydroid-script.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages.${system}) waydroid-script; } diff --git a/overlays/modifications/QQ.nix b/overlays/modifications/QQ.nix index 16d5d7b..63b21bb 100644 --- a/overlays/modifications/QQ.nix +++ b/overlays/modifications/QQ.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ qq = outputs.packages."${system}".QQ; } diff --git a/overlays/modifications/cliphist.nix b/overlays/modifications/cliphist.nix index 85d18c3..6ad9740 100644 --- a/overlays/modifications/cliphist.nix +++ b/overlays/modifications/cliphist.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ inherit (outputs.packages."${system}") cliphist; } diff --git a/overlays/modifications/dae.nix b/overlays/modifications/dae.nix index 38320b9..ed1ea31 100644 --- a/overlays/modifications/dae.nix +++ b/overlays/modifications/dae.nix @@ -1,5 +1,8 @@ -{inputs, ...}: _final: prev: let +{ inputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ dae = inputs.dae.packages."${system}".dae-unstable; } diff --git a/overlays/modifications/default.nix b/overlays/modifications/default.nix index 1ae5b57..3459272 100644 --- a/overlays/modifications/default.nix +++ b/overlays/modifications/default.nix @@ -1,20 +1,22 @@ -{...} @ args: final: prev: let +{ ... }@args: +final: prev: +let inherit (prev) lib; in - [ - ./niri.nix - ./juicity.nix - ./dae.nix - ./spotifyx.nix - ./radicle-explorer.nix - ./wshowkeys.nix - # ./QQ.nix - ./helix.nix - ./cliphist.nix +[ + ./niri.nix + ./juicity.nix + ./dae.nix + ./spotifyx.nix + ./radicle-explorer.nix + ./wshowkeys.nix + # ./QQ.nix + ./helix.nix + ./cliphist.nix - # Nur - ./nur.nix - ./nur-ataraxiasejel.nix - ] - |> map (file: import file args) - |> (overlays: (lib.composeManyExtensions overlays) final prev) + # Nur + ./nur.nix + ./nur-ataraxiasejel.nix +] +|> map (file: import file args) +|> (overlays: (lib.composeManyExtensions overlays) final prev) diff --git a/overlays/modifications/helix.nix b/overlays/modifications/helix.nix index a759145..e5a4e7f 100644 --- a/overlays/modifications/helix.nix +++ b/overlays/modifications/helix.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ helix = outputs.packages."${system}".helix; } diff --git a/overlays/modifications/juicity.nix b/overlays/modifications/juicity.nix index 82f5472..37e9203 100644 --- a/overlays/modifications/juicity.nix +++ b/overlays/modifications/juicity.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ juicity = outputs.packages."${system}".juicity; } diff --git a/overlays/modifications/niri.nix b/overlays/modifications/niri.nix index 200914b..5ba2cf6 100644 --- a/overlays/modifications/niri.nix +++ b/overlays/modifications/niri.nix @@ -1 +1 @@ -{inputs, ...}: inputs.niri-flake.overlays.niri +{ inputs, ... }: inputs.niri-flake.overlays.niri diff --git a/overlays/modifications/nur-ataraxiasejel.nix b/overlays/modifications/nur-ataraxiasejel.nix index 631089c..2e9181d 100644 --- a/overlays/modifications/nur-ataraxiasejel.nix +++ b/overlays/modifications/nur-ataraxiasejel.nix @@ -1,17 +1,14 @@ -{inputs, ...}: _final: prev: let +{ inputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { - nur = - prev.nur - // { - repos = - prev.nur.repos - // { - ataraxiasjel = - prev.nur.repos.ataraxiasjel - // { - inherit (inputs.nur-ataraxiasjel.packages.${system}) waydroid-script; - }; - }; +in +{ + nur = prev.nur // { + repos = prev.nur.repos // { + ataraxiasjel = prev.nur.repos.ataraxiasjel // { + inherit (inputs.nur-ataraxiasjel.packages.${system}) waydroid-script; + }; }; + }; } diff --git a/overlays/modifications/nur.nix b/overlays/modifications/nur.nix index fb90ee6..dda0a8f 100644 --- a/overlays/modifications/nur.nix +++ b/overlays/modifications/nur.nix @@ -1 +1 @@ -{inputs, ...}: inputs.nur.overlays.default +{ inputs, ... }: inputs.nur.overlays.default diff --git a/overlays/modifications/radicle-explorer.nix b/overlays/modifications/radicle-explorer.nix index 216e7b1..a001fde 100644 --- a/overlays/modifications/radicle-explorer.nix +++ b/overlays/modifications/radicle-explorer.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ radicle-explorer = outputs.packages."${system}".radicle-explorer; } diff --git a/overlays/modifications/spotifyx.nix b/overlays/modifications/spotifyx.nix index 6395e95..9903d3c 100644 --- a/overlays/modifications/spotifyx.nix +++ b/overlays/modifications/spotifyx.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ spotify = outputs.packages."${system}".spotifyx; } diff --git a/overlays/modifications/wshowkeys.nix b/overlays/modifications/wshowkeys.nix index 455b646..4f82f53 100644 --- a/overlays/modifications/wshowkeys.nix +++ b/overlays/modifications/wshowkeys.nix @@ -1,5 +1,8 @@ -{outputs, ...}: _final: prev: let +{ outputs, ... }: +_final: prev: +let inherit (prev.stdenv.hostPlatform) system; -in { +in +{ wshowkeys = outputs.packages.${system}.wshowkeys-mao; } diff --git a/pkgs/OuterWildsTextAdventure.nix b/pkgs/OuterWildsTextAdventure.nix index 459706f..793a3b7 100644 --- a/pkgs/OuterWildsTextAdventure.nix +++ b/pkgs/OuterWildsTextAdventure.nix @@ -3,28 +3,29 @@ buildNpmPackage, importNpmLock, ... -}: let +}: +let inherit (srcs.OuterWildsTextAdventure) src date version; in - buildNpmPackage { - pname = "OuterWildsTextAdventure"; - version = "0-unstable.${date}-git${version}"; - inherit src; +buildNpmPackage { + pname = "OuterWildsTextAdventure"; + version = "0-unstable.${date}-git${version}"; + inherit src; - npmDeps = importNpmLock { - npmRoot = src; - }; + npmDeps = importNpmLock { + npmRoot = src; + }; - npmBuildScript = "bundle"; + npmBuildScript = "bundle"; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out - cp -rt $out/ index.html data p5.min.js bundle.js bundle.js.map + mkdir -p $out + cp -rt $out/ index.html data p5.min.js bundle.js bundle.js.map - runHook postInstall - ''; + runHook postInstall + ''; - npmConfigHook = importNpmLock.npmConfigHook; - } + npmConfigHook = importNpmLock.npmConfigHook; +} diff --git a/pkgs/QQ.nix b/pkgs/QQ.nix index 55ee75e..e8fc7b2 100644 --- a/pkgs/QQ.nix +++ b/pkgs/QQ.nix @@ -6,7 +6,7 @@ }: symlinkJoin { name = "QQ"; - paths = [qq]; + paths = [ qq ]; inherit (qq) meta; buildInputs = [ makeWrapper diff --git a/pkgs/TrackersListCollection.nix b/pkgs/TrackersListCollection.nix index 2633ae1..8d75707 100644 --- a/pkgs/TrackersListCollection.nix +++ b/pkgs/TrackersListCollection.nix @@ -1,4 +1,5 @@ -{srcs}: let +{ srcs }: +let inherit (srcs) TrackersListCollection; in - TrackersListCollection.src +TrackersListCollection.src diff --git a/pkgs/cliphist.nix b/pkgs/cliphist.nix index 7f107c8..400bb54 100644 --- a/pkgs/cliphist.nix +++ b/pkgs/cliphist.nix @@ -8,34 +8,37 @@ gnugrep, lib, makeWrapper, -}: let +}: +let inherit (srcs.cliphist) src date version; in - cliphist.overrideAttrs (_final: prev: { +cliphist.overrideAttrs ( + _final: prev: { inherit src; version = - if prev.version != "0.6.1" - then + if prev.version != "0.6.1" then throw '' Please remove '' - else "0-unstable-${date}-git${version}"; + else + "0-unstable-${date}-git${version}"; vendorHash = "sha256-No8d9ztepBO+fgF2XkEf/tyCPDAD57rBkzA8iVyNUmw="; - buildInputs = - (prev.buildInputs or []) - ++ [ - makeWrapper - ]; + buildInputs = (prev.buildInputs or [ ]) ++ [ + makeWrapper + ]; postInstall = '' cp -t $out/bin/ $src/contrib/* rm $out/bin/cliphist.service wrapProgram $out/bin/cliphist-fuzzel-img \ - --prefix PATH : ${lib.makeBinPath [ - imagemagick - wl-clipboard - fuzzel - gawk - gnugrep - ]} + --prefix PATH : ${ + lib.makeBinPath [ + imagemagick + wl-clipboard + fuzzel + gawk + gnugrep + ] + } ''; - }) + } +) diff --git a/pkgs/editor-runtime.nix b/pkgs/editor-runtime.nix index a22e9f2..6de275a 100644 --- a/pkgs/editor-runtime.nix +++ b/pkgs/editor-runtime.nix @@ -79,6 +79,5 @@ symlinkJoin { zls ty ]; - postBuild = '' - ''; + postBuild = ''''; } diff --git a/pkgs/fonts/noto-sans-cjk.nix b/pkgs/fonts/noto-sans-cjk.nix index 50d3d42..60976b6 100644 --- a/pkgs/fonts/noto-sans-cjk.nix +++ b/pkgs/fonts/noto-sans-cjk.nix @@ -2,18 +2,19 @@ nixosTests, srcs, stdenvNoCC, -}: let +}: +let source = srcs.noto-sans-cjk; in - stdenvNoCC.mkDerivation (_finalAttrs: { - pname = "noto-sans-cjk"; - version = source.version; +stdenvNoCC.mkDerivation (_finalAttrs: { + pname = "noto-sans-cjk"; + version = source.version; - src = source.src; + src = source.src; - installPhase = '' - install -m444 -Dt $out/share/fonts/opentype/noto-sans-cjk Sans/OTC/*.ttc - ''; + installPhase = '' + install -m444 -Dt $out/share/fonts/opentype/noto-sans-cjk Sans/OTC/*.ttc + ''; - passthru.tests.noto-fonts = nixosTests.noto-fonts; - }) + passthru.tests.noto-fonts = nixosTests.noto-fonts; +}) diff --git a/pkgs/fonts/noto-serif-cjk.nix b/pkgs/fonts/noto-serif-cjk.nix index 80b8f74..5f0255f 100644 --- a/pkgs/fonts/noto-serif-cjk.nix +++ b/pkgs/fonts/noto-serif-cjk.nix @@ -2,18 +2,19 @@ nixosTests, srcs, stdenvNoCC, -}: let +}: +let source = srcs.noto-serif-cjk; in - stdenvNoCC.mkDerivation (_finalAttrs: { - pname = "noto-serif-cjk"; - version = source.version; +stdenvNoCC.mkDerivation (_finalAttrs: { + pname = "noto-serif-cjk"; + version = source.version; - src = source.src; + src = source.src; - installPhase = '' - install -m444 -Dt $out/share/fonts/opentype/noto-serif-cjk Serif/OTC/*.ttc - ''; + installPhase = '' + install -m444 -Dt $out/share/fonts/opentype/noto-serif-cjk Serif/OTC/*.ttc + ''; - passthru.tests.noto-fonts = nixosTests.noto-fonts; - }) + passthru.tests.noto-fonts = nixosTests.noto-fonts; +}) diff --git a/pkgs/helix/package.nix b/pkgs/helix/package.nix index 41cba60..a879608 100644 --- a/pkgs/helix/package.nix +++ b/pkgs/helix/package.nix @@ -5,36 +5,31 @@ symlinkJoin, makeWrapper, lib, -}: let +}: +let inherit (inputs.helix.packages."${system}") helix; - helixWithPassthru = - helix - // { - passthru = - helix.passthru - // { - languages = lib.pipe "${helix.src}/languages.toml" [ - builtins.readFile - builtins.fromTOML - ]; - }; + helixWithPassthru = helix // { + passthru = helix.passthru // { + languages = lib.pipe "${helix.src}/languages.toml" [ + builtins.readFile + builtins.fromTOML + ]; }; - runtime = callPackage ./runtime.nix {}; + }; + runtime = callPackage ./runtime.nix { }; in - symlinkJoin { - name = "helix-wrapped"; - paths = [helixWithPassthru]; - inherit (helixWithPassthru) meta; - buildInputs = [ - makeWrapper - ]; - postBuild = '' - wrapProgram $out/bin/hx \ - --set HELIX_RUNTIME ${runtime} - ''; - passthru = - helixWithPassthru.passthru - // { - helix-unwrapped = helixWithPassthru; - }; - } +symlinkJoin { + name = "helix-wrapped"; + paths = [ helixWithPassthru ]; + inherit (helixWithPassthru) meta; + buildInputs = [ + makeWrapper + ]; + postBuild = '' + wrapProgram $out/bin/hx \ + --set HELIX_RUNTIME ${runtime} + ''; + passthru = helixWithPassthru.passthru // { + helix-unwrapped = helixWithPassthru; + }; +} diff --git a/pkgs/helix/runtime.nix b/pkgs/helix/runtime.nix index ce0e5ec..4ced65b 100644 --- a/pkgs/helix/runtime.nix +++ b/pkgs/helix/runtime.nix @@ -3,8 +3,10 @@ srcs, stdenv, runCommandNoCCLocal, -}: let - buildGrammar = grammar: +}: +let + buildGrammar = + grammar: stdenv.mkDerivation { pname = "helix-tree-sitter-${grammar.name}"; version = grammar.version; @@ -78,20 +80,20 @@ } ) |> lib.mapAttrsToList (_: value: "ln -s ${value.value}/${value.name}.so $out/${value.name}.so"); - grammarDir = runCommandNoCCLocal "helix-grammars" {} '' + grammarDir = runCommandNoCCLocal "helix-grammars" { } '' mkdir -p $out ${builtins.concatStringsSep "\n" grammarLinks} ''; - queryDir = runCommandNoCCLocal "helix-query" {} '' + queryDir = runCommandNoCCLocal "helix-query" { } '' mkdir -p $out ${builtins.concatStringsSep "\n" queries} ''; in - runCommandNoCCLocal "helix-runtime" {} '' - mkdir -p $out +runCommandNoCCLocal "helix-runtime" { } '' + mkdir -p $out - ln -s ${grammarDir} $out/grammars - ln -s ${queryDir} $out/queries - '' + ln -s ${grammarDir} $out/grammars + ln -s ${queryDir} $out/queries +'' diff --git a/pkgs/nixvim/autocmds.nix b/pkgs/nixvim/autocmds.nix index 6462967..c915eb0 100644 --- a/pkgs/nixvim/autocmds.nix +++ b/pkgs/nixvim/autocmds.nix @@ -1 +1 @@ -{...}: {} +{ ... }: { } diff --git a/pkgs/nixvim/coding/blink-cmp.nix b/pkgs/nixvim/coding/blink-cmp.nix index b7574c9..f8a0026 100644 --- a/pkgs/nixvim/coding/blink-cmp.nix +++ b/pkgs/nixvim/coding/blink-cmp.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.blink-cmp = { enable = true; setupLspCapabilities = true; @@ -25,7 +26,7 @@ }; menu = { draw = { - treesitter = ["lsp"]; + treesitter = [ "lsp" ]; }; }; documentation = { @@ -41,8 +42,13 @@ }; }; sources = { - compat = []; - default = ["lsp" "path" "snippets" "buffer"]; + compat = [ ]; + default = [ + "lsp" + "path" + "snippets" + "buffer" + ]; }; cmdline = { enabled = false; diff --git a/pkgs/nixvim/coding/lazydev.nix b/pkgs/nixvim/coding/lazydev.nix index 2432afc..fba9470 100644 --- a/pkgs/nixvim/coding/lazydev.nix +++ b/pkgs/nixvim/coding/lazydev.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins = { lazydev = { enable = true; @@ -6,7 +7,7 @@ library = [ { path = "$''{3rd}/luv/library"; - words = ["vim%.uv"]; + words = [ "vim%.uv" ]; } ]; }; diff --git a/pkgs/nixvim/coding/mini-ai.nix b/pkgs/nixvim/coding/mini-ai.nix index 6644fc2..326c9b9 100644 --- a/pkgs/nixvim/coding/mini-ai.nix +++ b/pkgs/nixvim/coding/mini-ai.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.mini-ai = { enable = true; luaConfig.pre = diff --git a/pkgs/nixvim/coding/mini-pairs.nix b/pkgs/nixvim/coding/mini-pairs.nix index d991b1b..d18bc07 100644 --- a/pkgs/nixvim/coding/mini-pairs.nix +++ b/pkgs/nixvim/coding/mini-pairs.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.mini-pairs = { enable = true; settings = { diff --git a/pkgs/nixvim/coding/ts-comments.nix b/pkgs/nixvim/coding/ts-comments.nix index 1507e17..bcba025 100644 --- a/pkgs/nixvim/coding/ts-comments.nix +++ b/pkgs/nixvim/coding/ts-comments.nix @@ -1,3 +1,4 @@ -{...}: { +{ ... }: +{ youthlic.plugins.ts-comments.enable = true; } diff --git a/pkgs/nixvim/editor.nix b/pkgs/nixvim/editor.nix index e78f273..df026bb 100644 --- a/pkgs/nixvim/editor.nix +++ b/pkgs/nixvim/editor.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins = { # grug-far = { # enable = true; diff --git a/pkgs/nixvim/editor/gitsigns.nix b/pkgs/nixvim/editor/gitsigns.nix index d4eb3c6..fb568c1 100644 --- a/pkgs/nixvim/editor/gitsigns.nix +++ b/pkgs/nixvim/editor/gitsigns.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.gitsigns = { enable = true; luaConfig.post = @@ -24,19 +25,41 @@ numhl = true; linehl = false; signs = { - add = {text = "┃";}; - change = {text = "┃";}; - delete = {text = "";}; - topdelete = {text = "";}; - changedelete = {text = "┃";}; - untracked = {text = "┃";}; + add = { + text = "┃"; + }; + change = { + text = "┃"; + }; + delete = { + text = ""; + }; + topdelete = { + text = ""; + }; + changedelete = { + text = "┃"; + }; + untracked = { + text = "┃"; + }; }; signs_staged = { - add = {text = "┃";}; - change = {text = "┃";}; - delete = {text = "";}; - topdelete = {text = "";}; - changedelete = {text = "┃";}; + add = { + text = "┃"; + }; + change = { + text = "┃"; + }; + delete = { + text = ""; + }; + topdelete = { + text = ""; + }; + changedelete = { + text = "┃"; + }; }; on_attach = { __raw = diff --git a/pkgs/nixvim/editor/trouble.nix b/pkgs/nixvim/editor/trouble.nix index ec79cd4..eca64ac 100644 --- a/pkgs/nixvim/editor/trouble.nix +++ b/pkgs/nixvim/editor/trouble.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.trouble = { enable = true; settings = { @@ -16,7 +17,10 @@ border = "rounded"; title = "Preview"; title_pos = "center"; - position = [0 (-2)]; + position = [ + 0 + (-2) + ]; size = { width = 0.3; height = 0.3; diff --git a/pkgs/nixvim/editor/which-key.nix b/pkgs/nixvim/editor/which-key.nix index 57d19dc..edf12f1 100644 --- a/pkgs/nixvim/editor/which-key.nix +++ b/pkgs/nixvim/editor/which-key.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins = { which-key = { enable = true; diff --git a/pkgs/nixvim/formatting.nix b/pkgs/nixvim/formatting.nix index d0c373b..d3f8d5b 100644 --- a/pkgs/nixvim/formatting.nix +++ b/pkgs/nixvim/formatting.nix @@ -1,82 +1,85 @@ -{...}: { - userCommands = let - formatCmd = { - desc = "Format all the buffer"; - # conform.format function can deal with range by itself - range = "%"; - bang = true; - bar = true; - nargs = "?"; - complete = { - __raw = - #lua - '' - function(ArgLead, CmdLine, CursorPos) - return vim.iter(require("conform").list_all_formatters()):filter(function(val) - return val.available - end):map(function(val) +{ ... }: +{ + userCommands = + let + formatCmd = { + desc = "Format all the buffer"; + # conform.format function can deal with range by itself + range = "%"; + bang = true; + bar = true; + nargs = "?"; + complete = { + __raw = + #lua + '' + function(ArgLead, CmdLine, CursorPos) + return vim.iter(require("conform").list_all_formatters()):filter(function(val) + return val.available + end):map(function(val) + return val.name + end):filter(function(name) + return string.match(name, "^" .. ArgLead) ~= nil + end):totable() + end + ''; + }; + command = { + __raw = + #lua + '' + function(opts) + local format = require("conform").format + if #(opts.fargs) == 0 then + return format() + else + return format({ formatters = { opts.fargs[1] } }) + end + end + ''; + }; + }; + in + { + Format = formatCmd; + Fmt = formatCmd; + Formatter = { + desc = "Show config of formatter"; + nargs = "?"; + bar = true; + complete = { + __raw = + #lua + '' + function(ArgLead, CmdLine, CursorPos) + return vim.iter(require("conform").list_all_formatters()):map(function(val) return val.name - end):filter(function(name) - return string.match(name, "^" .. ArgLead) ~= nil - end):totable() - end - ''; - }; - command = { - __raw = - #lua - '' - function(opts) - local format = require("conform").format - if #(opts.fargs) == 0 then - return format() - else - return format({ formatters = { opts.fargs[1] } }) + end):filter(function(name) + return string.match(name, "^" .. ArgLead) ~= nil + end):totable() end - end - ''; + ''; + }; + command = { + __raw = + #lua + '' + function(opts) + local conform = require("conform") + if #(opts.fargs) == 0 then + local formatters = conform.list_all_formatters() + print(vim.inspect(formatters)) + return formatters + else + local config = conform.get_formatter_config(opts.fargs[1]) + print(vim.inspect(config)) + return config + end + end + ''; + }; }; }; - in { - Format = formatCmd; - Fmt = formatCmd; - Formatter = { - desc = "Show config of formatter"; - nargs = "?"; - bar = true; - complete = { - __raw = - #lua - '' - function(ArgLead, CmdLine, CursorPos) - return vim.iter(require("conform").list_all_formatters()):map(function(val) - return val.name - end):filter(function(name) - return string.match(name, "^" .. ArgLead) ~= nil - end):totable() - end - ''; - }; - command = { - __raw = - #lua - '' - function(opts) - local conform = require("conform") - if #(opts.fargs) == 0 then - local formatters = conform.list_all_formatters() - print(vim.inspect(formatters)) - return formatters - else - local config = conform.get_formatter_config(opts.fargs[1]) - print(vim.inspect(config)) - return config - end - end - ''; - }; - }; - }; keymaps = [ { action = { @@ -89,7 +92,10 @@ ''; }; key = "="; - mode = ["n" "v"]; + mode = [ + "n" + "v" + ]; options = { desc = "Format with conform"; }; diff --git a/pkgs/nixvim/keymaps.nix b/pkgs/nixvim/keymaps.nix index 6462967..c915eb0 100644 --- a/pkgs/nixvim/keymaps.nix +++ b/pkgs/nixvim/keymaps.nix @@ -1 +1 @@ -{...}: {} +{ ... }: { } diff --git a/pkgs/nixvim/lang/c.nix b/pkgs/nixvim/lang/c.nix index 4681dbc..940ac8f 100644 --- a/pkgs/nixvim/lang/c.nix +++ b/pkgs/nixvim/lang/c.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.c = { __unkeyed-1 = "clang-format"; diff --git a/pkgs/nixvim/lang/cxx.nix b/pkgs/nixvim/lang/cxx.nix index 5fd866b..7d06ce0 100644 --- a/pkgs/nixvim/lang/cxx.nix +++ b/pkgs/nixvim/lang/cxx.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.cpp = { __unkeyed-1 = "clang-format"; diff --git a/pkgs/nixvim/lang/idris2.nix b/pkgs/nixvim/lang/idris2.nix index 53e6fa8..b38a4ff 100644 --- a/pkgs/nixvim/lang/idris2.nix +++ b/pkgs/nixvim/lang/idris2.nix @@ -1,5 +1,6 @@ -{pkgs, ...}: { - extraPackagesAfter = with pkgs; [idris2Packages.idris2Lsp]; +{ pkgs, ... }: +{ + extraPackagesAfter = with pkgs; [ idris2Packages.idris2Lsp ]; lsp.servers.idris2 = { enable = true; }; diff --git a/pkgs/nixvim/lang/json.nix b/pkgs/nixvim/lang/json.nix index f740749..482597d 100644 --- a/pkgs/nixvim/lang/json.nix +++ b/pkgs/nixvim/lang/json.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.json = { __unkeyed-1 = "deno_fmt"; diff --git a/pkgs/nixvim/lang/lua.nix b/pkgs/nixvim/lang/lua.nix index b66574f..be2eca2 100644 --- a/pkgs/nixvim/lang/lua.nix +++ b/pkgs/nixvim/lang/lua.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ lsp.servers.lua_ls = { enable = true; }; diff --git a/pkgs/nixvim/lang/markdown.nix b/pkgs/nixvim/lang/markdown.nix index cae1834..17fbfdf 100644 --- a/pkgs/nixvim/lang/markdown.nix +++ b/pkgs/nixvim/lang/markdown.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.markdown = { __unkeyed-1 = "deno_fmt"; diff --git a/pkgs/nixvim/lang/nix.nix b/pkgs/nixvim/lang/nix.nix index 98af73c..a000f7a 100644 --- a/pkgs/nixvim/lang/nix.nix +++ b/pkgs/nixvim/lang/nix.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ lsp.servers = { nixd = { enable = true; diff --git a/pkgs/nixvim/lang/python.nix b/pkgs/nixvim/lang/python.nix index 67f08c7..c53d345 100644 --- a/pkgs/nixvim/lang/python.nix +++ b/pkgs/nixvim/lang/python.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.python = { __unkeyed-1 = "ruff_format"; diff --git a/pkgs/nixvim/lang/rust.nix b/pkgs/nixvim/lang/rust.nix index bcbf89b..2931731 100644 --- a/pkgs/nixvim/lang/rust.nix +++ b/pkgs/nixvim/lang/rust.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.rust = { __unkeyed-1 = "rustfmt"; diff --git a/pkgs/nixvim/lang/toml.nix b/pkgs/nixvim/lang/toml.nix index b674308..6ff4f0a 100644 --- a/pkgs/nixvim/lang/toml.nix +++ b/pkgs/nixvim/lang/toml.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.toml = { __unkeyed-1 = "taplo"; diff --git a/pkgs/nixvim/lang/yaml.nix b/pkgs/nixvim/lang/yaml.nix index d04f189..adecd76 100644 --- a/pkgs/nixvim/lang/yaml.nix +++ b/pkgs/nixvim/lang/yaml.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ youthlic.plugins.conform-nvim.settings = { formatters_by_ft.yaml = { __unkeyed-1 = "deno_fmt"; diff --git a/pkgs/nixvim/linting.nix b/pkgs/nixvim/linting.nix index 6462967..c915eb0 100644 --- a/pkgs/nixvim/linting.nix +++ b/pkgs/nixvim/linting.nix @@ -1 +1 @@ -{...}: {} +{ ... }: { } diff --git a/pkgs/nixvim/lsp.nix b/pkgs/nixvim/lsp.nix index bc2e419..2e949b4 100644 --- a/pkgs/nixvim/lsp.nix +++ b/pkgs/nixvim/lsp.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.lspconfig.enable = true; lsp = { inlayHints.enable = true; diff --git a/pkgs/nixvim/module.nix b/pkgs/nixvim/module.nix index 8426876..42b2240 100644 --- a/pkgs/nixvim/module.nix +++ b/pkgs/nixvim/module.nix @@ -3,27 +3,35 @@ config, options, ... -}: let +}: +let cfg = config.youthlic; -in { +in +{ options = { youthlic.plugins = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule ({ - name, - lib, - ... - }: { - freeformType = lib.types.anything; - options = { - enable = lib.mkEnableOption "nvimPlugins.${name}"; - }; - })); - default = {}; + type = lib.types.attrsOf ( + lib.types.submodule ( + { + name, + lib, + ... + }: + { + freeformType = lib.types.anything; + options = { + enable = lib.mkEnableOption "nvimPlugins.${name}"; + }; + } + ) + ); + default = { }; }; }; - config = let - enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins; - in + config = + let + enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins; + in lib.mkMerge [ { plugins = enabledPlugins; @@ -32,14 +40,16 @@ in { plugins = lib.pipe enabledPlugins [ builtins.attrNames (lib.filter (name: options.plugins.${name} ? luaConfig)) - (map (name: + (map ( + name: lib.nameValuePair name { luaConfig.post = #lua '' _M.load("${name}") ''; - })) + } + )) lib.listToAttrs ]; } diff --git a/pkgs/nixvim/neovide.nix b/pkgs/nixvim/neovide.nix index cb88ab3..84d7c17 100644 --- a/pkgs/nixvim/neovide.nix +++ b/pkgs/nixvim/neovide.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ extraConfigLua = #lua '' diff --git a/pkgs/nixvim/options.nix b/pkgs/nixvim/options.nix index 7ce19e8..ff42db3 100644 --- a/pkgs/nixvim/options.nix +++ b/pkgs/nixvim/options.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ globals = { mapleader = { __raw = @@ -11,7 +12,11 @@ opts = { autoindent = true; autoread = true; - backspace = ["indent" "eol" "start"]; + backspace = [ + "indent" + "eol" + "start" + ]; backup = false; breakindent = true; @@ -21,18 +26,33 @@ cdhome = true; cedit = ""; cmdheight = 1; - completeopt = ["fuzzy" "menuone" "noselect" "popup"]; + completeopt = [ + "fuzzy" + "menuone" + "noselect" + "popup" + ]; concealcursor = "v"; confirm = true; cursorline = true; - diffopt = ["algorithm:minimal" "closeoff" "context:20" "followwrap" "internal" "linematch:40"]; + diffopt = [ + "algorithm:minimal" + "closeoff" + "context:20" + "followwrap" + "internal" + "linematch:40" + ]; errorbells = true; expandtab = true; exrc = true; foldcolumn = "auto"; fsync = true; gdefault = false; - helplang = ["zh" "en"]; + helplang = [ + "zh" + "en" + ]; history = 10000; hlsearch = true; @@ -66,11 +86,17 @@ termguicolors = true; undofile = true; undolevels = 100000; - virtualedit = ["block" "onemore"]; + virtualedit = [ + "block" + "onemore" + ]; whichwrap = "b,s,<,>"; wildmenu = true; - wildmode = ["full"]; - wildoptions = ["fuzzy" "pum"]; + wildmode = [ "full" ]; + wildoptions = [ + "fuzzy" + "pum" + ]; winborder = "rounded"; wrap = true; }; diff --git a/pkgs/nixvim/package.nix b/pkgs/nixvim/package.nix index 454b0bd..39d149c 100644 --- a/pkgs/nixvim/package.nix +++ b/pkgs/nixvim/package.nix @@ -11,7 +11,9 @@ makeNixvimWithModule { inherit nixvimPlugins; }; module = { - imports = with lib; youthlic.loadImports' ./. (filter (name: !hasSuffix "/package.nix" (toString name))); + imports = + with lib; + youthlic.loadImports' ./. (filter (name: !hasSuffix "/package.nix" (toString name))); enableMan = true; enablePrintInit = true; package = neovim_git; diff --git a/pkgs/nixvim/treesitter.nix b/pkgs/nixvim/treesitter.nix index 95b46aa..49ceeb8 100644 --- a/pkgs/nixvim/treesitter.nix +++ b/pkgs/nixvim/treesitter.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins = { treesitter = { enable = true; diff --git a/pkgs/nixvim/ui/bufferline.nix b/pkgs/nixvim/ui/bufferline.nix index 109272a..164a680 100644 --- a/pkgs/nixvim/ui/bufferline.nix +++ b/pkgs/nixvim/ui/bufferline.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.bufferline = { enable = true; settings = { diff --git a/pkgs/nixvim/ui/colorschemes.nix b/pkgs/nixvim/ui/colorschemes.nix index 81523cf..5d7cffe 100644 --- a/pkgs/nixvim/ui/colorschemes.nix +++ b/pkgs/nixvim/ui/colorschemes.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ colorschemes.gruvbox = { enable = true; settings = { diff --git a/pkgs/nixvim/ui/lualine.nix b/pkgs/nixvim/ui/lualine.nix index 4925ee2..5bafe08 100644 --- a/pkgs/nixvim/ui/lualine.nix +++ b/pkgs/nixvim/ui/lualine.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.lualine = { enable = true; luaConfig.pre = @@ -16,6 +17,6 @@ vim.o.laststatus = vim.g.lualine_laststatus end ''; - settings = {}; + settings = { }; }; } diff --git a/pkgs/nixvim/util/lazy-load.nix b/pkgs/nixvim/util/lazy-load.nix index 4b515c3..0c901ef 100644 --- a/pkgs/nixvim/util/lazy-load.nix +++ b/pkgs/nixvim/util/lazy-load.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ extraConfigLuaPre = #lua '' diff --git a/pkgs/nixvim/util/snacks.nix b/pkgs/nixvim/util/snacks.nix index 0d653b1..08c4e1f 100644 --- a/pkgs/nixvim/util/snacks.nix +++ b/pkgs/nixvim/util/snacks.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ youthlic.plugins.snacks = { enable = true; luaConfig.content = diff --git a/pkgs/nixvim/util/vim-startuptime.nix b/pkgs/nixvim/util/vim-startuptime.nix index 5430c38..3d6899a 100644 --- a/pkgs/nixvim/util/vim-startuptime.nix +++ b/pkgs/nixvim/util/vim-startuptime.nix @@ -1,4 +1,5 @@ -{nixvimPlugins, ...}: { +{ nixvimPlugins, ... }: +{ extraPlugins = [ { config = diff --git a/pkgs/nixvimPlugins/vim-startuptime.nix b/pkgs/nixvimPlugins/vim-startuptime.nix index bda263c..5e10ce2 100644 --- a/pkgs/nixvimPlugins/vim-startuptime.nix +++ b/pkgs/nixvimPlugins/vim-startuptime.nix @@ -1,11 +1,12 @@ { srcs, vimUtils, -}: let +}: +let inherit (srcs.nvim_vim-startuptime) src version date; in - vimUtils.buildVimPlugin { - pname = "vim-startuptime"; - version = "0-unstable-${date}-git${version}"; - inherit src; - } +vimUtils.buildVimPlugin { + pname = "vim-startuptime"; + version = "0-unstable-${date}-git${version}"; + inherit src; +} diff --git a/pkgs/radicle-ci-broker.nix b/pkgs/radicle-ci-broker.nix index 9fdc0a9..8a919a2 100644 --- a/pkgs/radicle-ci-broker.nix +++ b/pkgs/radicle-ci-broker.nix @@ -2,19 +2,20 @@ rustPlatform, srcs, git, -}: let +}: +let inherit (srcs) radicle-ci-broker; in - rustPlatform.buildRustPackage (finalAttrs: { - pname = "radicle-ci-broker"; - version = "0-unstable-${radicle-ci-broker.date}-git${radicle-ci-broker.version}"; - inherit (radicle-ci-broker) src; - nativeBuildInputs = [git]; +rustPlatform.buildRustPackage (finalAttrs: { + pname = "radicle-ci-broker"; + version = "0-unstable-${radicle-ci-broker.date}-git${radicle-ci-broker.version}"; + inherit (radicle-ci-broker) src; + nativeBuildInputs = [ git ]; - cargoLock = { - lockFile = "${finalAttrs.src}/Cargo.lock"; - allowBuiltinFetchGit = true; - }; + cargoLock = { + lockFile = "${finalAttrs.src}/Cargo.lock"; + allowBuiltinFetchGit = true; + }; - doCheck = false; - }) + doCheck = false; +}) diff --git a/pkgs/radicle-explorer.nix b/pkgs/radicle-explorer.nix index f402393..95f8316 100644 --- a/pkgs/radicle-explorer.nix +++ b/pkgs/radicle-explorer.nix @@ -25,11 +25,14 @@ scheme = "https"; } ]; -}).overrideAttrs (prev: { - postInstall = - (prev.postInstall or "") - + '' - ln -s ${rootPath + "/assets/radicle-explorer/youthlic-seed-header.png"} $out/images/youthlic-seed-header.png - ln -s ${rootPath + "/assets/radicle-explorer/youthlic-seed-avatar.jpg"} $out/images/youthlic-seed-avatar.jpg +}).overrideAttrs + (prev: { + postInstall = (prev.postInstall or "") + '' + ln -s ${ + rootPath + "/assets/radicle-explorer/youthlic-seed-header.png" + } $out/images/youthlic-seed-header.png + ln -s ${ + rootPath + "/assets/radicle-explorer/youthlic-seed-avatar.jpg" + } $out/images/youthlic-seed-avatar.jpg ''; -}) + }) diff --git a/pkgs/rime-yuhaostar/package.nix b/pkgs/rime-yuhaostar/package.nix index 5b20d77..407b3b7 100644 --- a/pkgs/rime-yuhaostar/package.nix +++ b/pkgs/rime-yuhaostar/package.nix @@ -2,32 +2,36 @@ srcs, stdenv, unzip, -}: let +}: +let inherit (srcs.rime-yuhaostar) src version; in - stdenv.mkDerivation { - pname = "rime-yuhaostar"; - version = - if version != "v3.9.0" - then - throw '' - Please update 宇浩输入法。 - '' - else version; - inherit src; - nativeBuildInputs = [unzip]; +stdenv.mkDerivation { + pname = "rime-yuhaostar"; + version = + if version != "v3.9.0" then + throw '' + Please update 宇浩输入法。 + '' + else + version; + inherit src; + nativeBuildInputs = [ unzip ]; - sourceRoot = "schema"; + sourceRoot = "schema"; - patches = [./punctuator.patch ./key_binder.patch]; + patches = [ + ./punctuator.patch + ./key_binder.patch + ]; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out/share/rime-data - cp -rt $out/share/rime-data -- ./* - rm $out/share/rime-data/default.custom.yaml + mkdir -p $out/share/rime-data + cp -rt $out/share/rime-data -- ./* + rm $out/share/rime-data/default.custom.yaml - runHook postInstall - ''; - } + runHook postInstall + ''; +} diff --git a/pkgs/spotifyx.nix b/pkgs/spotifyx.nix index bb9ab7f..be0eade 100644 --- a/pkgs/spotifyx.nix +++ b/pkgs/spotifyx.nix @@ -5,28 +5,29 @@ perl, symlinkJoin, srcs, -}: let +}: +let inherit (srcs) spotx; - spotifyx = spotify.overrideAttrs (_final: prev: { - nativeBuildInputs = - prev.nativeBuildInputs - ++ [ + spotifyx = spotify.overrideAttrs ( + _final: prev: { + nativeBuildInputs = prev.nativeBuildInputs ++ [ unzip zip perl ]; - spotx = spotx.src; - postUnpack = '' - cp $spotx/spotx.sh ./spotx.sh - chmod +x ./spotx.sh - patchShebangs --build ./spotx.sh - ''; - postInstall = '' - ./spotx.sh -P $out/share/spotify -h - ''; - }); + spotx = spotx.src; + postUnpack = '' + cp $spotx/spotx.sh ./spotx.sh + chmod +x ./spotx.sh + patchShebangs --build ./spotx.sh + ''; + postInstall = '' + ./spotx.sh -P $out/share/spotify -h + ''; + } + ); in - symlinkJoin { - name = "spotifyx"; - paths = [spotifyx]; - } +symlinkJoin { + name = "spotifyx"; + paths = [ spotifyx ]; +} diff --git a/pkgs/wallpapers.nix b/pkgs/wallpapers.nix index f9412e4..2837113 100644 --- a/pkgs/wallpapers.nix +++ b/pkgs/wallpapers.nix @@ -3,13 +3,18 @@ runCommandNoCCLocal, rootPath, lib, -}: let - wallpapers = with lib; srcs |> filterAttrs (name: _value: hasPrefix "wallpaper" name) |> concatMapAttrsStringSep "\n" (name: value: "ln -s ${value.src} $out/${name}"); +}: +let + wallpapers = + with lib; + srcs + |> filterAttrs (name: _value: hasPrefix "wallpaper" name) + |> concatMapAttrsStringSep "\n" (name: value: "ln -s ${value.src} $out/${name}"); in - runCommandNoCCLocal "wallpapers" {} '' - mkdir -p $out +runCommandNoCCLocal "wallpapers" { } '' + mkdir -p $out - ${wallpapers} + ${wallpapers} - ln -s ${rootPath + "/assets/wallpaper/01.png"} $out/01.png - '' + ln -s ${rootPath + "/assets/wallpaper/01.png"} $out/01.png +'' diff --git a/pkgs/wshowkeys-mao.nix b/pkgs/wshowkeys-mao.nix index 4e85026..299cc82 100644 --- a/pkgs/wshowkeys-mao.nix +++ b/pkgs/wshowkeys-mao.nix @@ -1,11 +1,14 @@ { srcs, wshowkeys, -}: let +}: +let inherit (srcs) wshowkeys-mao; in - wshowkeys.overrideAttrs (_final: _prev: { +wshowkeys.overrideAttrs ( + _final: _prev: { inherit (wshowkeys-mao) src; pname = "wshowkeys-mao"; version = wshowkeys-mao.date + "-" + wshowkeys-mao.version; - }) + } +) diff --git a/templates/cxx/flake.nix b/templates/cxx/flake.nix index 0de5c71..fc6b487 100644 --- a/templates/cxx/flake.nix +++ b/templates/cxx/flake.nix @@ -5,27 +5,32 @@ url = "github:numtide/flake-utils"; }; }; - outputs = { - flake-utils, - nixpkgs, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - }; - in { - formatter = pkgs.alejandra; - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - clang-tools + outputs = + { + flake-utils, + nixpkgs, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + formatter = pkgs.alejandra; + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + clang-tools - gcc - bear - gnumake - ]; - }; - }); + gcc + bear + gnumake + ]; + }; + } + ); nixConfig = { keepOutputs = true; }; diff --git a/templates/cxxWithXmake/flake.nix b/templates/cxxWithXmake/flake.nix index 90fa65e..f8d4ff5 100644 --- a/templates/cxxWithXmake/flake.nix +++ b/templates/cxxWithXmake/flake.nix @@ -5,51 +5,56 @@ url = "github:numtide/flake-utils"; }; }; - outputs = { - self, - flake-utils, - nixpkgs, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - }; - in { - formatter = pkgs.alejandra; - checks = { - inherit (self.packages.${system}) default; - }; - devShells.default = pkgs.mkShell { - inputsFrom = [] ++ (builtins.attrValues self.checks.${system}); - packages = with pkgs; [ - clang-tools - ]; - }; - packages = rec { - cxx-demo = pkgs.stdenv.mkDerivation { - pname = "cxx-demo"; - version = "unstable"; - src = ./.; - strictDeps = true; - nativeBuildInputs = with pkgs; [ - xmake - gnumake - ]; - preConfigure = '' - xmake config -m release - xmake project -k xmakefile - ''; - env = { - INSTALLDIR = "${placeholder "out"}"; - NIX_DEBUG = 1; - V = 1; - D = 1; - }; + outputs = + { + self, + flake-utils, + nixpkgs, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; }; - default = cxx-demo; - }; - }); + in + { + formatter = pkgs.alejandra; + checks = { + inherit (self.packages.${system}) default; + }; + devShells.default = pkgs.mkShell { + inputsFrom = [ ] ++ (builtins.attrValues self.checks.${system}); + packages = with pkgs; [ + clang-tools + ]; + }; + packages = rec { + cxx-demo = pkgs.stdenv.mkDerivation { + pname = "cxx-demo"; + version = "unstable"; + src = ./.; + strictDeps = true; + nativeBuildInputs = with pkgs; [ + xmake + gnumake + ]; + preConfigure = '' + xmake config -m release + xmake project -k xmakefile + ''; + env = { + INSTALLDIR = "${placeholder "out"}"; + NIX_DEBUG = 1; + V = 1; + D = 1; + }; + }; + default = cxx-demo; + }; + } + ); nixConfig = { keepOutputs = true; }; diff --git a/templates/python/flake.nix b/templates/python/flake.nix index 3dd3a56..56828e2 100644 --- a/templates/python/flake.nix +++ b/templates/python/flake.nix @@ -5,47 +5,52 @@ url = "github:numtide/flake-utils"; }; }; - outputs = { - flake-utils, - nixpkgs, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - inherit (pkgs) lib; - pkgs = import nixpkgs { - inherit system; - config = { - cudaSupport = true; - allowUnfree = true; + outputs = + { + flake-utils, + nixpkgs, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + inherit (pkgs) lib; + pkgs = import nixpkgs { + inherit system; + config = { + cudaSupport = true; + allowUnfree = true; + }; }; - }; - defaultPython = pkgs.python3; - in { - formatter = pkgs.alejandra; - devShells.default = pkgs.mkShell { - packages = - (with pkgs; [ - ruff - pyright + defaultPython = pkgs.python3; + in + { + formatter = pkgs.alejandra; + devShells.default = pkgs.mkShell { + packages = + (with pkgs; [ + ruff + pyright - uv - defaultPython - ]) - ++ (with pkgs.python3Packages; [ - pydantic - torchWithCuda - ]); - shellHook = '' - uv sync - . ./.venv/bin/activate - ''; - env = { - UV_PYTHON_DOWNLOADS = "never"; - UV_PYTHON = "${lib.getExe' defaultPython "python"}"; - UV_TORCH_BACKEND = "auto"; + uv + defaultPython + ]) + ++ (with pkgs.python3Packages; [ + pydantic + torchWithCuda + ]); + shellHook = '' + uv sync + . ./.venv/bin/activate + ''; + env = { + UV_PYTHON_DOWNLOADS = "never"; + UV_PYTHON = "${lib.getExe' defaultPython "python"}"; + UV_TORCH_BACKEND = "auto"; + }; }; - }; - }); + } + ); nixConfig = { keepOutputs = true; }; diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index 13917fc..f4c8e45 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -24,133 +24,146 @@ }; }; }; - outputs = { - self, - flake-utils, - nixpkgs, - rust-overlay, - advisory-db, - crane, - pre-commit-hooks, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - inherit (pkgs) lib; - pkgs = import nixpkgs { - inherit system; - overlays = [ - (import rust-overlay) - (_final: prev: { - lib = prev.lib // (import ./nix/lib.nix prev.lib); - }) - ]; - }; - rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; - craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; - srcFilters = path: type: - builtins.any (lib.flip lib.hasSuffix path) [ - ".sql" - ".diff" - ".md" - ".adoc" - ".json" - ] - || (craneLib.filterCargoSources path type); - src = lib.cleanSourceWith { - src = ./.; - filter = srcFilters; - }; - basicArgs = { - inherit src; - strictDeps = true; - }; - nativeBuildInputs = []; - buildInputs = []; - genInputs = lib.genInputsWith pkgs; - commonArgs = - basicArgs - // { + outputs = + { + self, + flake-utils, + nixpkgs, + rust-overlay, + advisory-db, + crane, + pre-commit-hooks, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + inherit (pkgs) lib; + pkgs = import nixpkgs { + inherit system; + overlays = [ + (import rust-overlay) + (_final: prev: { + lib = prev.lib // (import ./nix/lib.nix prev.lib); + }) + ]; + }; + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + srcFilters = + path: type: + builtins.any (lib.flip lib.hasSuffix path) [ + ".sql" + ".diff" + ".md" + ".adoc" + ".json" + ] + || (craneLib.filterCargoSources path type); + src = lib.cleanSourceWith { + src = ./.; + filter = srcFilters; + }; + basicArgs = { + inherit src; + strictDeps = true; + }; + nativeBuildInputs = [ ]; + buildInputs = [ ]; + genInputs = lib.genInputsWith pkgs; + commonArgs = basicArgs // { cargoArtifacts = self.packages.${system}.cargo-artifacts; buildInputs = genInputs buildInputs; nativeBuildInputs = genInputs nativeBuildInputs; }; - in { - formatter = pkgs.alejandra; - checks = { - pre-commit-check = pre-commit-hooks.lib.${system}.run { - src = ./.; - hooks = { - alejandra = { - enable = true; - }; - rustfmt.enable = true; - cargo-check = { - enable = true; - stages = ["pre-push"]; - }; - clippy = { - enable = true; - stages = ["pre-push"]; - settings.denyWarnings = true; + in + { + formatter = pkgs.alejandra; + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + alejandra = { + enable = true; + }; + rustfmt.enable = true; + cargo-check = { + enable = true; + stages = [ "pre-push" ]; + }; + clippy = { + enable = true; + stages = [ "pre-push" ]; + settings.denyWarnings = true; + }; }; }; + package = self.packages.${system}.default.overrideAttrs { + doCheck = true; + }; + clippy = craneLib.cargoClippy ( + commonArgs + // { + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + } + ); + doc = craneLib.cargoDoc commonArgs; + deny = craneLib.cargoDeny commonArgs; + fmt = craneLib.cargoFmt basicArgs; + audit = craneLib.cargoAudit { + inherit src advisory-db; + }; + nextest = craneLib.cargoNextest ( + commonArgs + // { + partitions = 1; + partitionType = "count"; + cargoNextestExtraArgs = "--no-tests pass"; + env = { + CARGO_PROFILE = "dev"; + }; + } + ); }; - package = self.packages.${system}.default.overrideAttrs { - doCheck = true; - }; - clippy = craneLib.cargoClippy (commonArgs - // { - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - }); - doc = craneLib.cargoDoc commonArgs; - deny = craneLib.cargoDeny commonArgs; - fmt = craneLib.cargoFmt basicArgs; - audit = craneLib.cargoAudit { - inherit src advisory-db; - }; - nextest = craneLib.cargoNextest (commonArgs - // { - partitions = 1; - partitionType = "count"; - cargoNextestExtraArgs = "--no-tests pass"; - env = { - CARGO_PROFILE = "dev"; + packages = + let + callPackage = lib.callPackageWith (pkgs // { inherit craneLib callPackage; }); + packageArgs = { + inherit + lib + basicArgs + buildInputs + nativeBuildInputs + ; }; - }); - }; - packages = let - callPackage = lib.callPackageWith (pkgs // {inherit craneLib callPackage;}); - packageArgs = { - inherit lib basicArgs buildInputs nativeBuildInputs; + importWithArgs = with lib; flip import packageArgs; + in + rec { + cargo-artifacts = callPackage (importWithArgs ./nix/cargo-artifacts.nix) { }; + rust-demo = callPackage (importWithArgs ./nix/package.nix) { + cargoArtifacts = cargo-artifacts; + }; + default = rust-demo; + }; + apps.default = flake-utils.lib.mkApp { + drv = self.packages."${system}".default; }; - importWithArgs = with lib; flip import packageArgs; - in rec { - cargo-artifacts = callPackage (importWithArgs ./nix/cargo-artifacts.nix) {}; - rust-demo = callPackage (importWithArgs ./nix/package.nix) { - cargoArtifacts = cargo-artifacts; + devShells.default = craneLib.devShell { + checks = self.checks.${system}; + shellHook = '''' + self.checks.${system}.pre-commit-check.shellHook; + packages = with pkgs; [ + rust-analyzer + cargo-audit + cargo-deny + cargo-watch + cargo-nextest + ]; + env = { + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + }; }; - default = rust-demo; - }; - apps.default = flake-utils.lib.mkApp { - drv = self.packages."${system}".default; - }; - devShells.default = craneLib.devShell { - checks = self.checks.${system}; - shellHook = - '''' - + self.checks.${system}.pre-commit-check.shellHook; - packages = with pkgs; [ - rust-analyzer - cargo-audit - cargo-deny - cargo-watch - cargo-nextest - ]; - env = { - RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; - }; - }; - }); + } + ); nixConfig = { keepOutputs = true; }; diff --git a/templates/rust/nix/cargo-artifacts.nix b/templates/rust/nix/cargo-artifacts.nix index df41cad..e3b77b3 100644 --- a/templates/rust/nix/cargo-artifacts.nix +++ b/templates/rust/nix/cargo-artifacts.nix @@ -3,18 +3,24 @@ basicArgs, buildInputs, nativeBuildInputs, -}: let - f = { - craneLib, - lib, - ... - } @ args: let - genInputs = lib.genInputsWith args; - in - craneLib.buildDepsOnly (basicArgs +}: +let + f = + { + craneLib, + lib, + ... + }@args: + let + genInputs = lib.genInputsWith args; + in + craneLib.buildDepsOnly ( + basicArgs // { buildInputs = genInputs buildInputs; nativeBuildInputs = genInputs nativeBuildInputs; - }); + } + ); in - with lib; setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs))) +with lib; +setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs))) diff --git a/templates/rust/nix/lib.nix b/templates/rust/nix/lib.nix index f965403..60d8964 100644 --- a/templates/rust/nix/lib.nix +++ b/templates/rust/nix/lib.nix @@ -7,7 +7,24 @@ nameValuePair, getAttrFromPath, ... -}: { - genFunctionArgs = flip pipe [(map (flip pipe [(splitString ".") head (flip nameValuePair false)])) listToAttrs]; - genInputsWith = pkgs: map (flip pipe [(splitString ".") (flip getAttrFromPath pkgs)]); +}: +{ + genFunctionArgs = flip pipe [ + (map ( + flip pipe [ + (splitString ".") + head + (flip nameValuePair false) + ] + )) + listToAttrs + ]; + genInputsWith = + pkgs: + map ( + flip pipe [ + (splitString ".") + (flip getAttrFromPath pkgs) + ] + ); } diff --git a/templates/rust/nix/package.nix b/templates/rust/nix/package.nix index 744cad2..2c48936 100644 --- a/templates/rust/nix/package.nix +++ b/templates/rust/nix/package.nix @@ -3,16 +3,20 @@ basicArgs, buildInputs, nativeBuildInputs, -}: let - f = { - craneLib, - lib, - cargoArtifacts, - ... - } @ args: let - genInputs = lib.genInputsWith args; - in - craneLib.buildPackage (basicArgs +}: +let + f = + { + craneLib, + lib, + cargoArtifacts, + ... + }@args: + let + genInputs = lib.genInputsWith args; + in + craneLib.buildPackage ( + basicArgs // { inherit (craneLib.crateNameFromCargoToml { @@ -25,6 +29,8 @@ buildInputs = genInputs buildInputs; nativeBuildInputs = genInputs nativeBuildInputs; doCheck = false; - }); + } + ); in - with lib; setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs))) +with lib; +setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs))) diff --git a/treefmt.nix b/treefmt.nix index 5b64408..cb2cca0 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,60 +1,69 @@ { - perSystem = {pkgs, ...}: { - treefmt = { - programs = { - alejandra = { - enable = true; - excludes = ["_sources/*.nix"]; - }; - biome = { - enable = true; - includes = ["*.json"]; - excludes = ["_sources/*.json"]; - settings = { - javascript.formatter.enabled = false; - css.formatter.enabled = false; + perSystem = + { pkgs, ... }: + { + treefmt = { + programs = { + nixfmt = { + enable = true; + excludes = [ "_sources/*.nix" ]; }; - }; - dprint = { - enable = true; - includes = ["*.md" "*.toml" "*.yaml"]; - excludes = ["secrets/*.yaml"]; - settings = { - plugins = pkgs.dprint-plugins.getPluginList (plugins: - with plugins; [ - dprint-plugin-toml - dprint-plugin-markdown - g-plane-pretty_yaml - ]); + biome = { + enable = true; + includes = [ "*.json" ]; + excludes = [ "_sources/*.json" ]; + settings = { + javascript.formatter.enabled = false; + css.formatter.enabled = false; + }; }; - }; - just = { - enable = true; - includes = [".justfile"]; - }; - typos = let - config = ./.typos.toml |> builtins.readFile |> builtins.fromTOML; - in { - enable = true; - includes = ["*"]; - excludes = ["assets/*"] ++ config.files.extend-exclude; - configFile = toString ./.typos.toml; - # Disable all extra option in treefmt module. - # Use config file. - sort = false; - isolated = false; - hidden = false; - noIgnore = false; - noIgnoreDot = false; - noIgnoreGlobal = false; - noIgnoreParent = false; - noIgnoreVCS = false; - binary = false; - noCheckFilenames = false; - noCheckFiles = false; - noUnicode = false; + dprint = { + enable = true; + includes = [ + "*.md" + "*.toml" + "*.yaml" + ]; + excludes = [ "secrets/*.yaml" ]; + settings = { + plugins = pkgs.dprint-plugins.getPluginList ( + plugins: with plugins; [ + dprint-plugin-toml + dprint-plugin-markdown + g-plane-pretty_yaml + ] + ); + }; + }; + just = { + enable = true; + includes = [ ".justfile" ]; + }; + typos = + let + config = ./.typos.toml |> builtins.readFile |> builtins.fromTOML; + in + { + enable = true; + includes = [ "*" ]; + excludes = [ "assets/*" ] ++ config.files.extend-exclude; + configFile = toString ./.typos.toml; + # Disable all extra option in treefmt module. + # Use config file. + sort = false; + isolated = false; + hidden = false; + noIgnore = false; + noIgnoreDot = false; + noIgnoreGlobal = false; + noIgnoreParent = false; + noIgnoreVCS = false; + binary = false; + noCheckFilenames = false; + noCheckFiles = false; + noUnicode = false; + }; }; }; }; - }; }