Skip to content

Instantly share code, notes, and snippets.

@kalbasit
Last active January 27, 2020 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalbasit/1abf317c4961b96dbd2a8b0c78e64f5c to your computer and use it in GitHub Desktop.
Save kalbasit/1abf317c4961b96dbd2a8b0c78e64f5c to your computer and use it in GitHub Desktop.
{ lib, config, ... }:
with lib;
let
cfg = config.shabka.amethyst;
keyboardShortcutOptions = {
options = with types; {
mod = mkOption {
type = enum ["mod1" "mod2"];
};
key = mkOption {
type = enum ["a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"];
};
};
};
in {
options.shabka.amethyst = {
enable = mkEnableOption "Automatic tiling window manager for macOS à la xmonad";
cycle-layout = {
type = types.submodule keyboardShortcutOptions;
default = {
mod = "mod1";
key = "space";
};
};
};
config = mkIf cfg.enable {
home.file.".amethyst".text = builtins.toJSON (builtins.removeAttrs cfg ["enable" "_module"]);
};
}
λ nix repl
Welcome to Nix version 2.3.2. Type :? for help.
nix-repl> lib = (import <nixpkgs> {}).lib
nix-repl> config = lib.evalModules { modules = [ ./modules/home/software/amethyst.nix ]; }
nix-repl> config
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
{ config = { ... }; options = { ... }; }
nix-repl> config.config
{ _module = { ... }; shabka = { ... }; }
nix-repl> config.config.shabka
{ amethyst = { ... }; }
nix-repl> config.config.shabka.amethyst
error: value is a string while a set was expected, at /nix/store/9cy9n30pzg98xv1k76dwgpfliknl4laq-szrnwkyylgsas8p82xysg0dqa4a22aka-nixpkgs-release-unstable-90441b4b47fc7280de6a5bd1a228017caaa0f97f/lib/modules.nix:262:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment