diff --git a/artwork/wallpapers/mobile-nixos-19.09.png b/artwork/wallpapers/mobile-nixos-19.09.png new file mode 100644 index 00000000..f32b216d Binary files /dev/null and b/artwork/wallpapers/mobile-nixos-19.09.png differ diff --git a/artwork/wallpapers/mobile-nixos-19.09.svg b/artwork/wallpapers/mobile-nixos-19.09.svg new file mode 100644 index 00000000..5994298f --- /dev/null +++ b/artwork/wallpapers/mobile-nixos-19.09.svg @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/demo/configuration.nix b/examples/demo/configuration.nix index ed882b78..0822eb94 100644 --- a/examples/demo/configuration.nix +++ b/examples/demo/configuration.nix @@ -2,28 +2,41 @@ let inherit (lib) mkForce; + system_type = config.mobile.system.type; + + # Why copy them all? + # Because otherwise the wallpaper picker will default to /nix/store as a path + # and this could get messy with the amazing amount of files there are in there. + # Why copy only pngs? + # Rendering of `svg` is hard! Not that it's costly in cpu time, but that the + # rendering might not be as expected depending on what renders it. + # The SVGs in that directory are used as an authoring format files, not files + # to be used as they are. They need to be pre-rendered. + wallpapers = pkgs.runCommandNoCC "wallpapers" {} '' + mkdir -p $out/ + cp ${../../artwork/wallpapers}/*.png $out/ + ''; in - { - imports = [ - ../../profiles/installer.nix - ]; - disabledModules = [ - - - ]; +{ + imports = [ + ../../profiles/installer.nix + ]; + + disabledModules = [ + + + ]; config = lib.mkMerge [ { + boot.growPartition = lib.mkDefault true; + services.xserver = { enable = true; libinput.enable = true; - videoDrivers = [ "fbdev" ]; - - # xfce has been chosen mainly because it is light, and quick to start. - # FIXME: Find a better demo environment. - desktopManager.xfce.enable = true; + videoDrivers = lib.mkDefault [ "fbdev" ]; # Automatically login as nixos. displayManager.lightdm = { @@ -35,12 +48,14 @@ in }; }; - powerManagement.enable = true; hardware.pulseaudio.enable = true; environment.systemPackages = with pkgs; [ - firefox + (writeShellScriptBin "firefox" '' + export MOZ_USE_XINPUT2=1 + exec ${pkgs.firefox}/bin/firefox "$@" + '') sgtpuzzles hard-reboot hard-shutdown @@ -85,8 +100,11 @@ in networking.networkmanager.enable = true; networking.networkmanager.unmanaged = [ "rndis0" "usb0" ]; + services.blueman.enable = true; + hardware.bluetooth.enable = true; + # Setup USB gadget networking in initrd... - mobile.boot.stage-1.networking.enable = true; + mobile.boot.stage-1.networking.enable = lib.mkDefault true; #mobile.boot.stage-1.ssh.enable = true; # Start SSH by default... @@ -105,5 +123,119 @@ in # FIXME : figure out why systemd-udev-settle doesn't work. systemd.services.systemd-udev-settle.enable = false; } + + # Customized XFCE environment + { + services.xserver = { + desktopManager.xfce.enable = true; + }; + + environment.systemPackages = with pkgs; [ + adapta-gtk-theme + breeze-icons + ]; + + fonts.fonts = with pkgs; [ + aileron + ]; + + environment.etc."xdg/xfce4" = { + # TODO: DPI/size settings, so that a DPI can be derived from the device info. + source = pkgs.runCommandNoCC "xfce4-defaults" {} '' + cp -r ${./xdg/xfce4} $out + wallpaper="${wallpapers}/mobile-nixos-19.09.png" + substituteInPlace $out/xfconf/xfce-perchannel-xml/xfce4-desktop.xml \ + --subst-var wallpaper + ''; + }; + } + + # Replace xfwm with awesome with a custom config. + { + services.xserver = { + desktopManager.xfce.enableXfwm = false; + desktopManager.xfce.extraSessionCommands = '' + awesome & + ''; + }; + + environment.systemPackages = with pkgs; + let + close = writeShellScript "action-close-window" '' + awesome-client ' + local awful = require("awful"); + local c = awful.client.focus.filter(client.focus) + if c then + c:kill() + end + ' + ''; + in + [ + awesome + (runCommandNoCC "awesome-actions" {} '' + mkdir -vp $out/share/applications/ + (cd $out/share/applications/ + cat > awesome-close.desktop < $out + echo "X-XFCE-Autostart-Override=true" >> $out + substituteInPlace $out \ + --replace "Icon=onboard" "Icon=input-keyboard" + ''; + }; + } + + # FIXME : depthcharge is the wrong assumption. + # A better abstraction over the X11 stack is required within mobile-nixos. + # The qemu VM requires the fbdev one to work as expcted. + # The android devices may have hwcomposer stuff coming. + (lib.mkIf (system_type == "depthcharge") { + services.xserver = { + videoDrivers = [ "modesetting" ]; + }; + }) ]; } diff --git a/examples/demo/default.nix b/examples/demo/default.nix index 469f5aac..f1745913 100644 --- a/examples/demo/default.nix +++ b/examples/demo/default.nix @@ -10,6 +10,13 @@ let }; in { - inherit (system-build.build) android-bootimg android-device; + inherit (system-build.build) + # Android devices + android-bootimg android-device + # QEMU VM + vm + # Depthcharge + disk-image + ; android-burn-tool = burn-tool-build.build.android-bootimg; } diff --git a/examples/demo/xdg/awesome/rc.lua b/examples/demo/xdg/awesome/rc.lua new file mode 100644 index 00000000..98ba6fd8 --- /dev/null +++ b/examples/demo/xdg/awesome/rc.lua @@ -0,0 +1,114 @@ +-- +-- Minimal "one window at a time" configuration. +-- +-- There are no features. No keyboard control. +-- + +local awful = require("awful") +awful.rules = require("awful.rules") +require("awful.autofocus") + +-- {{{ Layout + +-- Table of layouts to cover with awful.layout.inc, order matters. +local layouts = { + -- awful.layout.suit.tile, + -- awful.layout.suit.tile.left, + -- awful.layout.suit.tile.bottom, + -- awful.layout.suit.tile.top, + -- awful.layout.suit.fair, + -- awful.layout.suit.fair.horizontal, + -- awful.layout.suit.spiral, + -- awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + -- awful.layout.suit.max.fullscreen, + -- awful.layout.suit.magnifier, + -- awful.layout.suit.floating, +} + +-- }}} + +-- {{{ Tags +local tags = {} +awful.screen.connect_for_each_screen(function(s) + tags[s] = awful.tag({"1"}, s, layouts[1]) +end) +-- }}} + +-- {{{ Wibox +local mywibox = {} +awful.screen.connect_for_each_screen(function(s) + -- Hmmm, this is weird, but I *have* to add a wibar. + -- Otherwise awesome will not resize windows when onboard resizes... + -- Weird, eh? + mywibox[s] = awful.wibar({ position = "top", screen = s, visible = false }) +end) +-- }}} + +-- {{{ Rules +awful.rules.rules = { + -- All clients will match this rule. + { rule = { }, + properties = { + border_width = 0, + focus = awful.client.focus.filter, + raise = true, + placement = awful.placement.no_overlap+awful.placement.no_offscreen, + } + }, + + -- XFCE notification + -- Otherwise all notifications will interrupt input with a HW (bluetooth) keyboard + { rule = { instance = "xfce4-notifyd", class = "Xfce4-notifyd" }, + properties = { + border_width = 0, + sticky = true, + focusable = false, + nofocus = true, + ontop = true; + } + }, + + -- Onboard on-screen keyboard + { rule = { instance = "onboard", class = "Onboard" }, + properties = { + border_width = 0, + sticky = true, + focusable = false, + nofocus = true, + ontop = true; + } + }, + + -- Xfce desktop + -- Allows its use in all tags. + { rule = { instance = "xfdesktop", class = "Xfdesktop" }, + properties = { + border_width = 0, + sticky = true, + focusable = false, + nofocus = true, + } + }, + +} +-- }}} + +-- {{{ Signals + +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c, startup) + if not startup then + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Put windows in a smart way, only if they does not set an initial position. + if not c.size_hints.user_position and not c.size_hints.program_position then + awful.placement.no_overlap(c) + awful.placement.no_offscreen(c) + end + end +end) + +-- }}} diff --git a/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml new file mode 100644 index 00000000..197138a2 --- /dev/null +++ b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml new file mode 100644 index 00000000..cfc533bf --- /dev/null +++ b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml new file mode 100644 index 00000000..6511e419 --- /dev/null +++ b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-volumed-pulse.xml b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-volumed-pulse.xml new file mode 100644 index 00000000..feb1ab7c --- /dev/null +++ b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-volumed-pulse.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml new file mode 100644 index 00000000..a54a3922 --- /dev/null +++ b/examples/demo/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +