mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
Add modules
This commit is contained in:
parent
5cc656fffc
commit
f40362898a
19 changed files with 1045 additions and 0 deletions
60
modules/environment/links.nix
Normal file
60
modules/environment/links.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.environment;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
environment = {
|
||||
binSh = mkOption {
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
description = "Path to /bin/sh executable.";
|
||||
};
|
||||
|
||||
usrBinEnv = mkOption {
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
description = "Path to /usr/bin/env executable.";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = {
|
||||
|
||||
build.activation = {
|
||||
linkBinSh = ''
|
||||
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
|
||||
$DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force ${cfg.binSh} /bin/.sh.tmp
|
||||
$DRY_RUN_CMD mv $VERBOSE_ARG /bin/.sh.tmp /bin/sh
|
||||
'';
|
||||
|
||||
linkUsrBinEnv = ''
|
||||
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /usr/bin
|
||||
$DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force ${cfg.usrBinEnv} /usr/bin/.env.tmp
|
||||
$DRY_RUN_CMD mv $VERBOSE_ARG /usr/bin/.env.tmp /usr/bin/env
|
||||
'';
|
||||
};
|
||||
|
||||
environment = {
|
||||
binSh = "${pkgs.bashInteractive}/bin/sh";
|
||||
usrBinEnv = "${pkgs.coreutils}/bin/env";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue