refactor
This commit is contained in:
parent
66c05f9093
commit
44067d35ff
205 changed files with 9037 additions and 338 deletions
39
modules/nixos/system/env/default.nix
vendored
Normal file
39
modules/nixos/system/env/default.nix
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.system.env;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.env = with types;
|
||||
mkOption {
|
||||
type = attrsOf (oneOf [ str path (listOf (either str path)) ]);
|
||||
apply = mapAttrs (n: v:
|
||||
if isList v then
|
||||
concatMapStringsSep ":" (x: toString x) v
|
||||
else
|
||||
(toString v));
|
||||
default = { };
|
||||
description = "A set of environment variables to set.";
|
||||
};
|
||||
|
||||
config = {
|
||||
environment = {
|
||||
sessionVariables = {
|
||||
XDG_CACHE_HOME = "$HOME/.cache";
|
||||
XDG_CONFIG_HOME = "$HOME/.config";
|
||||
XDG_DATA_HOME = "$HOME/.local/share";
|
||||
XDG_BIN_HOME = "$HOME/.local/bin";
|
||||
# To prevent firefox from creating ~/Desktop.
|
||||
XDG_DESKTOP_DIR = "$HOME";
|
||||
};
|
||||
variables = {
|
||||
# Make some programs "XDG" compliant.
|
||||
LESSHISTFILE = "$XDG_CACHE_HOME/less.history";
|
||||
WGETRC = "$XDG_CONFIG_HOME/wgetrc";
|
||||
};
|
||||
extraInit = concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg);
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue