diff options
| author | aristote <quentin.aristote@irif.fr> | 2025-07-29 15:25:11 +0200 |
|---|---|---|
| committer | aristote <quentin.aristote@irif.fr> | 2025-07-29 15:25:11 +0200 |
| commit | fc019d789523ce5f89436b8dbc458cf3b79abf43 (patch) | |
| tree | ec56fd1b1ed9fc75096c0b09db48a152975e4d53 /modules/devenv/integrations | |
| parent | a3d19bc509d9f39fb41256cd55d2bd7706de202f (diff) | |
reformat everything with nixfmt
Diffstat (limited to 'modules/devenv/integrations')
| -rw-r--r-- | modules/devenv/integrations/default.nix | 5 | ||||
| -rw-r--r-- | modules/devenv/integrations/emacs.nix | 38 | ||||
| -rw-r--r-- | modules/devenv/integrations/gitignore.nix | 65 |
3 files changed, 61 insertions, 47 deletions
diff --git a/modules/devenv/integrations/default.nix b/modules/devenv/integrations/default.nix index 7fa74bd..79c104d 100644 --- a/modules/devenv/integrations/default.nix +++ b/modules/devenv/integrations/default.nix @@ -1,3 +1,6 @@ { - imports = [./emacs.nix ./gitignore.nix]; + imports = [ + ./emacs.nix + ./gitignore.nix + ]; } diff --git a/modules/devenv/integrations/emacs.nix b/modules/devenv/integrations/emacs.nix index 347132f..ed20734 100644 --- a/modules/devenv/integrations/emacs.nix +++ b/modules/devenv/integrations/emacs.nix @@ -2,33 +2,31 @@ config, lib, ... -}: let +}: +let cfg = config.emacs; - attrs2alist = value: - if lib.isAttrs value - then "(${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "(${name} . ${attrs2alist value})") value)})" + attrs2alist = + value: + if lib.isAttrs value then + "(${ + lib.concatStringsSep "\n" ( + lib.mapAttrsToList (name: value: "(${name} . ${attrs2alist value})") value + ) + })" else ( - if lib.isList value - then "(${lib.concatStringsSep " " value})" + if lib.isList value then + "(${lib.concatStringsSep " " value})" else - ( - if lib.isBool value - then - ( - if value - then "t" - else "nil" - ) - else builtins.toString value - ) + (if lib.isBool value then (if value then "t" else "nil") else builtins.toString value) ); -in { +in +{ options.emacs = { enable = lib.mkEnableOption "emacs integration"; dirLocals = lib.mkOption { type = with lib.types; attrsOf (attrsOf anything); - default = {}; + default = { }; example = # the first example from https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html { @@ -46,7 +44,5 @@ in { }; }; - config.dotfiles.".dir-locals.el".text = - lib.mkIf (cfg.dirLocals != {}) - (attrs2alist cfg.dirLocals); + config.dotfiles.".dir-locals.el".text = lib.mkIf (cfg.dirLocals != { }) (attrs2alist cfg.dirLocals); } diff --git a/modules/devenv/integrations/gitignore.nix b/modules/devenv/integrations/gitignore.nix index bb216a7..3db8dfe 100644 --- a/modules/devenv/integrations/gitignore.nix +++ b/modules/devenv/integrations/gitignore.nix @@ -4,41 +4,56 @@ pkgs, inputs, ... -}: let +}: +let cfg = config.gitignore; ignoreDevenv = cfg.devenv.enable or false; - templates = lib.attrNames (lib.filterAttrs (name: value: (value.enable or false) && name != "devenv") cfg); + templates = lib.attrNames ( + lib.filterAttrs (name: value: (value.enable or false) && name != "devenv") cfg + ); toUncomment = builtins.concatLists (lib.collect lib.isList cfg); -in { +in +{ options.gitignore = lib.mkOption { - type = with lib.types; (submodule { - freeformType = with lib.types; - attrsOf (submodule { - options = { - enable = lib.mkEnableOption ""; - uncomment = lib.mkOption { - type = with lib.types; listOf str; - default = []; - description = "Lines that should be uncommented and thus enabled in the template file."; + type = + with lib.types; + (submodule { + freeformType = + with lib.types; + attrsOf (submodule { + options = { + enable = lib.mkEnableOption ""; + uncomment = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + description = "Lines that should be uncommented and thus enabled in the template file."; + }; }; - }; - }); - options.extra = lib.mkOption { - type = lib.types.lines; - default = ""; - example = '' - *.my-file-extension - ''; - }; - }); - default = {extra = "";}; + }); + options.extra = lib.mkOption { + type = lib.types.lines; + default = ""; + example = '' + *.my-file-extension + ''; + }; + }); + default = { + extra = ""; + }; }; config = { - dotfiles.".gitignore" = lib.mkIf (templates != {} || cfg.extra != "") { + dotfiles.".gitignore" = lib.mkIf (templates != { } || cfg.extra != "") { gitignore = lib.mkDefault false; text = - lib.optionalString (templates != []) (builtins.readFile ((pkgs.extend inputs.my-nixpkgs.overlays.personal).personal.static.gitignore.override {inherit templates toUncomment;})) + lib.optionalString (templates != [ ]) ( + builtins.readFile ( + (pkgs.extend inputs.my-nixpkgs.overlays.personal).personal.static.gitignore.override { + inherit templates toUncomment; + } + ) + ) + lib.optionalString ignoreDevenv '' ### devenv .devenv/ |
