diff options
author | sefidel <contact@sefidel.net> | 2021-12-28 01:11:25 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2021-12-28 01:12:48 +0900 |
commit | 56992b8c945d497a623fe693847c91235be1ae02 (patch) | |
tree | 102ff8c8872d7e14ce3e3dba69bf16685374504e /home/modules/programs | |
download | nixrc-56992b8c945d497a623fe693847c91235be1ae02.tar.gz nixrc-56992b8c945d497a623fe693847c91235be1ae02.zip |
initial commit
Diffstat (limited to 'home/modules/programs')
-rw-r--r-- | home/modules/programs/nixpkgs/default.nix | 20 | ||||
-rw-r--r-- | home/modules/programs/zshell/default.nix | 44 |
2 files changed, 64 insertions, 0 deletions
diff --git a/home/modules/programs/nixpkgs/default.nix b/home/modules/programs/nixpkgs/default.nix new file mode 100644 index 0000000..92653a1 --- /dev/null +++ b/home/modules/programs/nixpkgs/default.nix @@ -0,0 +1,20 @@ +{ config, lib, ... }: + +let + allowed = config.nixpkgs.allowedUnfree; +in + +{ + options.nixpkgs.allowedUnfree = lib.mkOption { + type = lib.types.listOf lib.types.string; + default = [ ]; + description = '' + Allows for unfree packages by their name. + ''; + }; + + config.nixpkgs.config.allowUnfreePredicate = + if (allowed == [ ]) + then (_: false) + else (pkg: __elem (lib.getName pkg) allowed); +} diff --git a/home/modules/programs/zshell/default.nix b/home/modules/programs/zshell/default.nix new file mode 100644 index 0000000..514002a --- /dev/null +++ b/home/modules/programs/zshell/default.nix @@ -0,0 +1,44 @@ +{ config, lib, ... }: +let + cfg = config.programs.zshell; + aliasesStr = lib.concatStringsSep "\n" + (lib.mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") + cfg.aliases); + sourcesStr = + lib.concatStringsSep "\n" (builtins.map (s: ". ${s}") cfg.sources); +in +{ + options.programs.zshell = { + aliases = lib.mkOption { + default = { }; + example = { + ll = "ls -l"; + ".." = "cd .."; + }; + description = '' + An attribute set that maps aliases (the top level attribute names in + this option) to command strings or directly to build outputs. + ''; + type = lib.types.attrsOf lib.types.str; + }; + sources = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + }; + }; + + config = { + home.file = { + ".zsh/boot/aliases.zsh" = { + text = '' + ${aliasesStr} + ''; + }; + ".zsh/boot/sourcing.zsh" = { + text = '' + ${sourcesStr} + ''; + }; + }; + }; +} |