forked from DGNum/liminix
Compare commits
1 commit
main
...
shell-cust
Author | SHA1 | Date | |
---|---|---|---|
|
99e466a742 |
3 changed files with 26 additions and 18 deletions
|
@ -4,11 +4,13 @@
|
||||||
|
|
||||||
{ lib, pkgs, config, ...}:
|
{ lib, pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr concatStringsSep;
|
||||||
inherit (pkgs.pseudofile) dir symlink;
|
inherit (pkgs.pseudofile) dir symlink;
|
||||||
inherit (pkgs.liminix.networking) address interface;
|
inherit (pkgs.liminix.networking) address interface;
|
||||||
inherit (pkgs.liminix.services) bundle;
|
inherit (pkgs.liminix.services) bundle;
|
||||||
|
|
||||||
|
# TODO: escape shell argument.
|
||||||
|
exportVar = name: value: "export ${name}=\"${value}\"";
|
||||||
type_service = pkgs.liminix.lib.types.service;
|
type_service = pkgs.liminix.lib.types.service;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
@ -22,6 +24,24 @@ in {
|
||||||
/run/current-system, we just add the paths in /etc/profile
|
/run/current-system, we just add the paths in /etc/profile
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environmentVariables = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
description = ''
|
||||||
|
Attribute set of environment variables to make available
|
||||||
|
in a login shell.
|
||||||
|
|
||||||
|
The value is assumed to be escaped and the name to be valid.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
prompt = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "$(whoami)@$(hostname) # ";
|
||||||
|
description = ''
|
||||||
|
Prompt string (PS1) for the shell.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
services = mkOption {
|
services = mkOption {
|
||||||
type = types.attrsOf type_service;
|
type = types.attrsOf type_service;
|
||||||
|
@ -105,15 +125,14 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [ ./nixpkgs.nix ];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
# By default, we enable cross-compilation support.
|
# By default, we enable cross-compilation support.
|
||||||
nixpkgs.buildPlatform = lib.mkDefault builtins.currentSystem;
|
nixpkgs.buildPlatform = lib.mkDefault builtins.currentSystem;
|
||||||
|
|
||||||
defaultProfile.packages = with pkgs;
|
defaultProfile.packages = with pkgs;
|
||||||
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
|
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
|
||||||
|
# Set the useful PS1 prompt by default.
|
||||||
|
defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt;
|
||||||
|
|
||||||
boot.commandLine = [
|
boot.commandLine = [
|
||||||
"panic=10 oops=panic init=/bin/init loglevel=8"
|
"panic=10 oops=panic init=/bin/init loglevel=8"
|
||||||
|
@ -184,9 +203,10 @@ in {
|
||||||
etc = let
|
etc = let
|
||||||
profile = symlink
|
profile = symlink
|
||||||
(pkgs.writeScript ".profile" ''
|
(pkgs.writeScript ".profile" ''
|
||||||
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
|
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
|
||||||
export PATH
|
export PATH
|
||||||
'');
|
${concatStringsSep "\n" (map exportVar config.defaultProfile.environmentVariables)}
|
||||||
|
'');
|
||||||
in dir {
|
in dir {
|
||||||
inherit profile;
|
inherit profile;
|
||||||
ashrc = profile;
|
ashrc = profile;
|
||||||
|
|
|
@ -331,8 +331,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [ ./misc/assertions.nix ];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
_module.args = {
|
_module.args = {
|
||||||
pkgs =
|
pkgs =
|
||||||
|
|
|
@ -13,14 +13,6 @@ in
|
||||||
boot.initramfs = {
|
boot.initramfs = {
|
||||||
enable = mkEnableOption "initramfs";
|
enable = mkEnableOption "initramfs";
|
||||||
};
|
};
|
||||||
system.build.toplevel = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
description = ''
|
|
||||||
pkgs.systemconfig for the configured filesystem,
|
|
||||||
contains 'activate' and 'init' commands
|
|
||||||
'';
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
system.outputs = {
|
system.outputs = {
|
||||||
initramfs = mkOption {
|
initramfs = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -47,8 +39,6 @@ in
|
||||||
INITRAMFS_COMPRESSION_ZSTD = "y";
|
INITRAMFS_COMPRESSION_ZSTD = "y";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.build.toplevel = config.system.outputs.systemConfiguration;
|
|
||||||
|
|
||||||
system.outputs = {
|
system.outputs = {
|
||||||
initramfs =
|
initramfs =
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in a new issue