-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The old userenv module relied on nix envs, which are prone to breakage on system upgrades. the new approach will function the same, but eliminate the possibility of breakage while also being more discoverable in the `/etc/local/nixos` directory
- Loading branch information
Showing
2 changed files
with
21 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
let | ||
# see https://nixos.org/channels/ | ||
nixpkgs = fetchTarball {{component.channel}}; | ||
|
||
in | ||
{ pkgs ? import nixpkgs { } }: | ||
|
||
with pkgs; | ||
let | ||
{ pkgs, ... }: let | ||
{{component.let_extra}} | ||
|
||
shellInit = writeText "shellInit"'' | ||
in { | ||
users.users."{{component.environment.service_user}}".packages = with pkgs; [ | ||
# {%- for name in component.packages %} | ||
{{name}} | ||
# {%- endfor %} | ||
]; | ||
|
||
environment.shellInit = '' | ||
{{component.shellInit.replace('\n', '\n ').strip()}} | ||
''; | ||
|
||
{{component.let_extra}} | ||
|
||
in buildEnv { | ||
name = "{{ '{{' }}component.nix_env_name{{ '}}' }}"; | ||
paths = [ | ||
(runCommand "profile" { } "install -D ${shellInit} $out/etc/profile.d/{{component.profile_name}}.sh") | ||
{%- for name in component.packages %} | ||
{{name}} | ||
{%- endfor %} | ||
]; | ||
extraOutputsToInstall = [ "bin" "dev" "lib" "man" "out" ]; | ||
} |