From def1e23be848848400d1d097d4f044e3c401f9dd Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 14 Apr 2024 23:02:32 +0200 Subject: treewide: remove lib.mdDoc --- modules/environment/default.nix | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index c4883c3..753ee31 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -21,7 +21,7 @@ in type = types.listOf types.package; default = []; example = literalExpression "[ pkgs.curl pkgs.vim ]"; - description = lib.mdDoc '' + description = '' The set of packages that appear in /run/current-system/sw. These packages are automatically available to all users, and are @@ -34,39 +34,39 @@ in environment.systemPath = mkOption { type = types.listOf (types.either types.path types.str); - description = lib.mdDoc "The set of paths that are added to PATH."; + description = "The set of paths that are added to PATH."; apply = x: if isList x then makeDrvBinPath x else x; }; environment.profiles = mkOption { type = types.listOf types.str; - description = lib.mdDoc "A list of profiles used to setup the global environment."; + description = "A list of profiles used to setup the global environment."; }; environment.postBuild = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Commands to execute when building the global environment."; + description = "Commands to execute when building the global environment."; }; environment.extraOutputsToInstall = mkOption { type = types.listOf types.str; default = []; example = [ "doc" "info" "devdoc" ]; - description = lib.mdDoc "List of additional package outputs to be symlinked into {file}`/run/current-system/sw`."; + description = "List of additional package outputs to be symlinked into {file}`/run/current-system/sw`."; }; environment.pathsToLink = mkOption { type = types.listOf types.str; default = []; example = [ "/share/doc" ]; - description = lib.mdDoc "List of directories to be symlinked in {file}`/run/current-system/sw`."; + description = "List of directories to be symlinked in {file}`/run/current-system/sw`."; }; environment.darwinConfig = mkOption { type = types.either types.path types.str; default = "$HOME/.nixpkgs/darwin-configuration.nix"; - description = lib.mdDoc '' + description = '' The path of the darwin configuration.nix used to configure the system, this updates the default darwin-config entry in NIX_PATH. Since this changes an environment variable it will only apply to new shells. @@ -79,14 +79,14 @@ in environment.loginShell = mkOption { type = types.str; default = "$SHELL -l"; - description = lib.mdDoc "Configure default login shell."; + description = "Configure default login shell."; }; environment.variables = mkOption { type = types.attrsOf (types.either types.str (types.listOf types.str)); default = {}; example = { EDITOR = "vim"; LANG = "nl_NL.UTF-8"; }; - description = lib.mdDoc '' + 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 @@ -100,7 +100,7 @@ in type = types.attrsOf types.str; default = {}; example = { ll = "ls -l"; }; - description = lib.mdDoc '' + description = '' An attribute set that maps aliases (the top level attribute names in this option) to command strings or directly to build outputs. The alises are added to all users' shells. @@ -110,7 +110,7 @@ in environment.extraInit = mkOption { type = types.lines; default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during global environment initialisation after all variables and profileVariables have been set. This code is asumed to be shell-independent, which means you should @@ -120,7 +120,7 @@ in environment.shellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during shell initialisation. This code is asumed to be shell-independent, which means you should stick to pure sh without sh word split. @@ -130,7 +130,7 @@ in environment.loginShellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during login shell initialisation. This code is asumed to be shell-independent, which means you should stick to pure sh without sh word split. @@ -140,7 +140,7 @@ in environment.interactiveShellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during interactive shell initialisation. This code is asumed to be shell-independent, which means you should stick to pure sh without sh word split. -- cgit v1.2.3 From 7f897008d4f3c7dda86e19106169eb947a0ac308 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 22 May 2024 09:41:12 -0400 Subject: environment: Adjust systemPath order to allow injecting in the middle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, it was not possible to inject PATH entries between profiles and the “default system” PATH entries. This confounds adding, e.g. Homebrew on aarch64’s non-standard prefix as higher priority than the builtin system paths, but lower than Nix profiles. This is a backwards-incompatible change for some users, but should only be so in the case a user used `mkOrder` with a value between 1000 (the default priority) and 1200. Value of 1200 chosen as the same delta from the default as just below in `environment.profiles` (which uses 800), and mkAfter is 1500 so will still go after this. --- modules/environment/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index 753ee31..bb99622 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -151,7 +151,10 @@ in config = { - environment.systemPath = [ (makeBinPath cfg.profiles) "/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" ]; + environment.systemPath = mkMerge [ + [ (makeBinPath cfg.profiles) ] + (mkOrder 1200 [ "/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" ]) + ]; # Use user, default and system profiles. environment.profiles = mkMerge [ -- cgit v1.2.3 From e88eb66c2b5e7066786f5d6343f3737567a71734 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 27 Jul 2024 13:35:35 +1000 Subject: `mapAttrsFlatten` -> `mapAttrsToList` deprecated in https://github.com/NixOS/nixpkgs/commit/473e469d5a921a57b484a09d446cee6c231cd592 --- modules/environment/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index bb99622..3b97a3e 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -9,7 +9,7 @@ let mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg.variables; aliasCommands = - mapAttrsFlatten (n: v: ''alias ${n}=${escapeShellArg v}'') + mapAttrsToList (n: v: ''alias ${n}=${escapeShellArg v}'') (filterAttrs (k: v: v != null) cfg.shellAliases); makeDrvBinPath = concatMapStringsSep ":" (p: if isDerivation p then "${p}/bin" else p); -- cgit v1.2.3 From d5dba1c6f5b4069988f9601df861fff2490fb3d2 Mon Sep 17 00:00:00 2001 From: Alice Carroll Date: Sat, 3 Aug 2024 14:57:36 +0300 Subject: refactor: rename environment.postBuild to environment.extraSetup --- modules/environment/default.nix | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index 3b97a3e..00d58c0 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -16,6 +16,10 @@ let in { + imports = [ + (mkRenamedOptionModule ["environment" "postBuild"] ["environment" "extraSetup"]) + ]; + options = { environment.systemPackages = mkOption { type = types.listOf types.package; @@ -43,12 +47,6 @@ in description = "A list of profiles used to setup the global environment."; }; - environment.postBuild = mkOption { - type = types.lines; - default = ""; - description = "Commands to execute when building the global environment."; - }; - environment.extraOutputsToInstall = mkOption { type = types.listOf types.str; default = []; @@ -147,6 +145,17 @@ in ''; type = types.lines; }; + + environment.extraSetup = mkOption { + type = types.lines; + default = ""; + description = '' + Shell fragments to be run after the system environment has been created. + This should only be used for things that need to modify the internals + of the environment, e.g. generating MIME caches. + The environment being built can be accessed at $out. + ''; + }; }; config = { @@ -188,7 +197,8 @@ in system.path = pkgs.buildEnv { name = "system-path"; paths = cfg.systemPackages; - inherit (cfg) postBuild pathsToLink extraOutputsToInstall; + postBuild = cfg.extraSetup; + inherit (cfg) pathsToLink extraOutputsToInstall; }; system.build.setEnvironment = pkgs.writeText "set-environment" '' @@ -205,6 +215,5 @@ in system.build.setAliases = pkgs.writeText "set-aliases" '' ${concatStringsSep "\n" aliasCommands} ''; - }; } -- cgit v1.2.3 From 1588cb2e997fb37a4eab78da13808faf49df903f Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 31 Oct 2024 15:02:36 +1100 Subject: environment: remove misleading `environment.loginShell` option --- modules/environment/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index 00d58c0..994c77a 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -18,6 +18,11 @@ in { imports = [ (mkRenamedOptionModule ["environment" "postBuild"] ["environment" "extraSetup"]) + (mkRemovedOptionModule [ "environment" "loginShell" ] '' + This option was only used to change the default command in tmux. + + This has been removed in favour of changing the default command or default shell in tmux directly. + '') ]; options = { @@ -74,12 +79,6 @@ in ''; }; - environment.loginShell = mkOption { - type = types.str; - default = "$SHELL -l"; - description = "Configure default login shell."; - }; - environment.variables = mkOption { type = types.attrsOf (types.either types.str (types.listOf types.str)); default = {}; -- cgit v1.2.3 From 2bacd8db310f479fab713829663d4b36913553cf Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 11 Nov 2024 00:54:26 +1100 Subject: environment: fix `lowPrio` support in `environment.systemPackages` --- modules/environment/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/environment') diff --git a/modules/environment/default.nix b/modules/environment/default.nix index 994c77a..fc4db2a 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -197,6 +197,7 @@ in name = "system-path"; paths = cfg.systemPackages; postBuild = cfg.extraSetup; + ignoreCollisions = true; inherit (cfg) pathsToLink extraOutputsToInstall; }; -- cgit v1.2.3