make an installable derivation
untested as yet
This commit is contained in:
parent
cba4549304
commit
4c4bd9e997
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*~
|
||||||
|
result*
|
||||||
|
*.img
|
61
README.md
61
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**Broken, not ready for use**
|
**Broken, not ready for use**
|
||||||
|
|
||||||
> *euphony*: _noun_ Harmonious aqrrangement of sounds in composition; a smooth and agreeable combination of articulate elements in any piece of writing.
|
> *euphony*: _noun_ Harmonious arrangement of sounds in composition; a smooth and agreeable combination of articulate elements in any piece of writing.
|
||||||
|
|
||||||
A mostly Fennel-based graphical environment tailored for Linux-based
|
A mostly Fennel-based graphical environment tailored for Linux-based
|
||||||
mobile devices. The principles we aspire to are
|
mobile devices. The principles we aspire to are
|
||||||
@ -19,35 +19,12 @@ mobile devices. The principles we aspire to are
|
|||||||
As of 2022 these principles are more aspirational than actual. _This
|
As of 2022 these principles are more aspirational than actual. _This
|
||||||
repo is basically in an advanced state of brokenness_
|
repo is basically in an advanced state of brokenness_
|
||||||
|
|
||||||
## Building for a device
|
|
||||||
|
|
||||||
To build an image, unpack [Mobile NixOS](https://github.com/NixOS/mobile-nixos/) in a sibling directory
|
|
||||||
of this repo (so that `../mobile-nixos` addresses it) and then do
|
|
||||||
something like this (substituing an appropriate device name for
|
|
||||||
`motorola-potter`)
|
|
||||||
|
|
||||||
$ nix-build ../mobile-nixos/ -I mobile-nixos-configuration=./configuration.nix --argstr device motorola-potter -A build.default
|
|
||||||
|
|
||||||
You are warmly encouraged to refer to the [Mobile Nixos
|
|
||||||
docs](https://mobile.nixos.org/devices/) for how to use this image.
|
|
||||||
|
|
||||||
Once you have your device up and running and you can ssh into it
|
|
||||||
somehow (this may take further research, again I invite you to look at
|
|
||||||
the Mobile Nixos site) then you should be able to use
|
|
||||||
`nix-copy-closure` to update it without reinstalling.
|
|
||||||
|
|
||||||
$ phone=myphone.lan
|
|
||||||
$ nix-build ../mobile-nixos/ -I mobile-nixos-configuration=./configuration.nix --argstr device motorola-potter -A config.system.build.toplevel
|
|
||||||
$ nix-copy-closure --to root@${phone} --include-outputs \
|
|
||||||
./result && ssh root@${phone} \
|
|
||||||
`readlink result`/bin/switch-to-configuration switch
|
|
||||||
|
|
||||||
|
|
||||||
## Running the shell/apps locally
|
## Running the shell/apps locally
|
||||||
|
|
||||||
You may prefer to develop on a desktop device of some kind, especially
|
Eufon is intendfed for phones, but you may prefer to develop on a
|
||||||
if you're changing C code and have that edit/compile run cycle to go
|
desktop device of some kind, especially if you're changing C code and
|
||||||
round. You can start the shell locally with
|
have that edit/compile run cycle to go round. You can start the shell
|
||||||
|
locally with
|
||||||
|
|
||||||
$ nix-shell --run "kiwmi -c init.lua"
|
$ nix-shell --run "kiwmi -c init.lua"
|
||||||
|
|
||||||
@ -58,11 +35,31 @@ for the Lua interpreter itself, but it doesn't do the same for kiwmi.
|
|||||||
|
|
||||||
## Connecting to the repl
|
## Connecting to the repl
|
||||||
|
|
||||||
If you are using the example rc.fnl, it opens a Unix socket that you
|
If you are using the example rc.fnl, it opens a Unix socket to which
|
||||||
can connect to and interact with a Fennel REPL. I use
|
you can connect to interact with a Fennel REPL. The `eufonctl`
|
||||||
[socat](http://www.dest-unreach.org/socat/) for this purpose:
|
script is a wrapper around [socat](http://www.dest-unreach.org/socat/)
|
||||||
|
|
||||||
|
$ eufonctl $WAYLAND_DISPLAY
|
||||||
|
|
||||||
|
|
||||||
|
## Building for a device
|
||||||
|
|
||||||
|
Eufon can be installed as a [Mobile NixOS](https://github.com/NixOS/mobile-nixos/) module, by adding
|
||||||
|
`module.nix` to the `imports` in `your configuration.nix`. For example, on my development phone I
|
||||||
|
have
|
||||||
|
|
||||||
|
```nix
|
||||||
|
imports = [
|
||||||
|
(import <mobile-nixos/lib/configuration.nix> {
|
||||||
|
device = "motorola-potter";
|
||||||
|
})
|
||||||
|
/home/dan/src/phoen/eufon/module.nix
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
Instructions for using Mobile NixOS are currently outside the scope of
|
||||||
|
this README.
|
||||||
|
|
||||||
$ socat - unix-connect:${XDG_RUNTIME_DIR}/kiwmi-repl.wayland-1.socket
|
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
2
bin/eufon.sh
Executable file
2
bin/eufon.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
kiwmi -V -V -c init.lua
|
15
default.nix
15
default.nix
@ -11,6 +11,9 @@
|
|||||||
, gtk-layer-shell
|
, gtk-layer-shell
|
||||||
, lua5_3
|
, lua5_3
|
||||||
, socat
|
, socat
|
||||||
|
, cpio
|
||||||
|
|
||||||
|
, makeWrapper
|
||||||
} :
|
} :
|
||||||
let
|
let
|
||||||
lua = lua5_3;
|
lua = lua5_3;
|
||||||
@ -63,11 +66,21 @@ stdenv.mkDerivation {
|
|||||||
gtk3
|
gtk3
|
||||||
webkitgtk
|
webkitgtk
|
||||||
];
|
];
|
||||||
|
nativeBuildInputs = [ cpio makeWrapper ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
export LUA_PATH="`lua -e 'print(package.path)'`"
|
||||||
|
export LUA_CPATH="`lua -e 'print(package.cpath)'`"
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
substitute bin/eufon.sh $out/bin/eufon \
|
find . -name kiwmi -prune -o -type l -prune -o -print0 | cpio -0 -v --pass-through $out
|
||||||
|
substitute bin/eufonctl.sh $out/bin/eufonctl \
|
||||||
--replace SOCAT=socat SOCAT=${socat}/bin/socat
|
--replace SOCAT=socat SOCAT=${socat}/bin/socat
|
||||||
|
makeWrapper ${kiwmi}/bin/kiwmi $out/bin/eufon \
|
||||||
|
--set LUA_PATH ".;$out/?.fnl;$LUA_PATH" \
|
||||||
|
--set LUA_CPATH ".;$out/?.so;$LUA_CPATH" \
|
||||||
|
--prefix PATH : ${kiwmi}/bin \
|
||||||
|
--add-flags "-c $out/init.lua"
|
||||||
|
|
||||||
chmod +x $out/bin/eufon
|
chmod +x $out/bin/eufon
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
14
module.nix
14
module.nix
@ -1,4 +1,5 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
let eufon = pkgs.callPckage ./default.nix; in
|
||||||
{
|
{
|
||||||
systemd.services."eufon" = {
|
systemd.services."eufon" = {
|
||||||
wants = [
|
wants = [
|
||||||
@ -19,6 +20,7 @@
|
|||||||
"systemd-udev-settle.service"
|
"systemd-udev-settle.service"
|
||||||
];
|
];
|
||||||
conflicts = [
|
conflicts = [
|
||||||
|
"getty@tty1.service" # not sure if needed
|
||||||
"getty@tty2.service"
|
"getty@tty2.service"
|
||||||
"plymouth-quit.service"
|
"plymouth-quit.service"
|
||||||
];
|
];
|
||||||
@ -27,11 +29,11 @@
|
|||||||
let run-eufon = pkgs.writeScript "run-eufon" ''
|
let run-eufon = pkgs.writeScript "run-eufon" ''
|
||||||
#!${pkgs.bash}/bin/bash
|
#!${pkgs.bash}/bin/bash
|
||||||
source ${config.system.build.setEnvironment}
|
source ${config.system.build.setEnvironment}
|
||||||
${pkgs.dbus}/bin/dbus-run-session /home/dan/src/eufon/run.sh
|
${pkgs.dbus}/bin/dbus-run-session ${eufon}/bin/eufon
|
||||||
systemd-cat echo "dbus-run-session $?"
|
systemd-cat echo "dbus-run-session $?"
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
WorkingDirectory = "/home/dan/src/eufon";
|
WorkingDirectory = "${eufon}";
|
||||||
TTYPath = "/dev/tty2";
|
TTYPath = "/dev/tty2";
|
||||||
TTYReset = "yes";
|
TTYReset = "yes";
|
||||||
TTYVHangup = "yes";
|
TTYVHangup = "yes";
|
||||||
@ -52,7 +54,13 @@
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
];
|
];
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
boot.postBootCommands = lib.mkOrder (-1) ''
|
||||||
|
brightness=4000
|
||||||
|
echo "Setting brightness to $brightness"
|
||||||
|
echo $brightness > /sys/class/backlight/wled/brightness
|
||||||
|
'';
|
||||||
|
|
||||||
services.logind.extraConfig = ''
|
services.logind.extraConfig = ''
|
||||||
HandlePowerKey=ignore
|
HandlePowerKey=ignore
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user