mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
added support for environment.variables
This commit is contained in:
parent
491e06ab15
commit
ce690db770
2 changed files with 33 additions and 2 deletions
11
config.nix
11
config.nix
|
@ -14,6 +14,7 @@ let
|
|||
};
|
||||
|
||||
config =
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages =
|
||||
[ pkgs.lnl.vim
|
||||
|
@ -30,14 +31,16 @@ let
|
|||
pkgs.nox
|
||||
];
|
||||
|
||||
environment.etc."profile".text = ''
|
||||
export HOMEBREW_CASK_OPTS="--appdir=/Applications/cask"
|
||||
environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask";
|
||||
|
||||
environment.etc."profile".text = ''
|
||||
conf=$HOME/src/nixpkgs-config
|
||||
pkgs=$HOME/.nix-defexpr/nixpkgs
|
||||
|
||||
alias ls='ls -G'
|
||||
alias l='ls -hl'
|
||||
|
||||
source ${config.system.build.setEnvironment}
|
||||
'';
|
||||
|
||||
environment.etc."tmux.conf".text = ''
|
||||
|
@ -49,6 +52,8 @@ let
|
|||
set -g base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
setw -g mode-keys vi
|
||||
|
||||
bind c new-window -c '#{pane_current_path}'
|
||||
bind % split-window -v -c '#{pane_current_path}'
|
||||
bind '"' split-window -h -c '#{pane_current_path}'
|
||||
|
@ -102,6 +107,8 @@ in {
|
|||
set et sw=2 ts=2
|
||||
set bs=indent,start
|
||||
|
||||
set nowrap
|
||||
|
||||
set list
|
||||
set listchars=tab:»·,trail:·,extends:⟩,precedes:⟨
|
||||
set fillchars+=vert:\ ,stl:\ ,stlnc:\
|
||||
|
|
|
@ -6,6 +6,12 @@ let
|
|||
|
||||
cfg = config.environment;
|
||||
|
||||
exportVariables =
|
||||
mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg.variables;
|
||||
|
||||
exportedEnvVars =
|
||||
concatStringsSep "\n" exportVariables;
|
||||
|
||||
in {
|
||||
options = {
|
||||
|
||||
|
@ -31,10 +37,28 @@ in {
|
|||
description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
|
||||
};
|
||||
|
||||
environment.variables = mkOption {
|
||||
default = {};
|
||||
description = ''
|
||||
A set of environment variables used in the global environment.
|
||||
These variables will be set on shell initialisation.
|
||||
The value of each variable can be either a string or a list of
|
||||
strings. The latter is concatenated, interspersed with colon
|
||||
characters.
|
||||
'';
|
||||
type = types.attrsOf (types.loeOf types.str);
|
||||
apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v);
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
system.build.setEnvironment = pkgs.writeText "set-environment" ''
|
||||
${exportedEnvVars}
|
||||
'';
|
||||
|
||||
system.path = pkgs.buildEnv {
|
||||
name = "system-path";
|
||||
paths = cfg.systemPackages;
|
||||
|
|
Loading…
Add table
Reference in a new issue