diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-03-08 21:00:24 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-03-08 21:09:54 -0600 |
| commit | 65bbf5411d8d3e30bffcc278ccace65c7e75c70c (patch) | |
| tree | 29c3e9b3e041cf68bee2947f2a66b7bf9f32982d | |
| parent | 3e509d0fd1034c1dd67e16ec6000e46be9dd65d9 (diff) | |
Implement shell environments
Diffstat (limited to '')
| -rw-r--r-- | flake.nix | 11 | ||||
| -rw-r--r-- | home/default.nix | 7 | ||||
| -rw-r--r-- | home/zshrc.nix | 4 | ||||
| -rw-r--r-- | pkgs/default.nix | 8 | ||||
| -rw-r--r-- | shenvs/.keep | 0 | ||||
| -rw-r--r-- | util/default.nix | 3 | ||||
| -rw-r--r-- | util/importAll.nix | 15 |
7 files changed, 44 insertions, 4 deletions
@@ -11,9 +11,16 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, home-manager, nur, ... }: { + outputs = { self, nixpkgs, home-manager, nur, ... }: let + pkgSet = pkgs: import ./pkgs { + inherit pkgs; + util = import ./util pkgs.lib; + }; + in { + packages."x86_64-linux" = pkgSet nixpkgs.legacyPackages."x86_64-linux"; + overlay = self: super: { - local = import ./pkgs self.local super; + local = pkgSet super; }; homeConfigurations."ale@p-user" = home-manager.lib.homeManagerConfiguration { diff --git a/home/default.nix b/home/default.nix index abd034b..10dbe18 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,6 +1,11 @@ { lib, config, pkgs, ... }: { imports = [ ./unfree.nix ]; + nix.registry."system".to = { + type = "path"; + path = "/home/ale/nix"; + }; + home = { # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage @@ -155,6 +160,8 @@ clock24 = true; escapeTime = 10; terminal = "xterm-256color"; + keyMode = "vi"; + extraConfig = '' set -g mouse on set -ga update-environment " LIFT_PID" diff --git a/home/zshrc.nix b/home/zshrc.nix index 68c3958..09b6e32 100644 --- a/home/zshrc.nix +++ b/home/zshrc.nix @@ -20,6 +20,10 @@ source $HOME/System/dot/git-aliases.zsh } + function shenv() { + nix shell 'system#shenvs.'"$1" + } + function xseli() { T=$(mktemp) $EDITOR -n $T diff --git a/pkgs/default.nix b/pkgs/default.nix index cf752d9..1a7f6ac 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,3 +1,7 @@ -self: super: { - tmux-lift = super.callPackage ./tmux-lift {}; +{ pkgs, util }: { + shenvs = let + env = name: env: pkgs.buildEnv (env pkgs // { name = "shenv-${name}"; }); + in pkgs.lib.mapAttrs env (util.importAll { root = ../shenvs; }); + + tmux-lift = pkgs.callPackage ./tmux-lift {}; } diff --git a/shenvs/.keep b/shenvs/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/shenvs/.keep diff --git a/util/default.nix b/util/default.nix new file mode 100644 index 0000000..226c69f --- /dev/null +++ b/util/default.nix @@ -0,0 +1,3 @@ +lib: { + importAll = import ./importAll.nix lib; +} diff --git a/util/importAll.nix b/util/importAll.nix new file mode 100644 index 0000000..c4a092e --- /dev/null +++ b/util/importAll.nix @@ -0,0 +1,15 @@ +lib: +{ root, exclude ? [] }: +with builtins; with lib; + +# http://chriswarbo.net/projects/nixos/useful_hacks.html +let + isMatch = name: type: (hasSuffix ".nix" name || type == "directory") + && ! elem name exclude; + + entry = name: _: { + name = removeSuffix ".nix" name; + value = import (root + "/${name}"); + }; +in + mapAttrs' entry (filterAttrs isMatch (readDir root)) |
