A Nix Flake to use the in development singularity desktop.
# Run the packaged Singularity Desktop binary directly without installing.
# This is useful for quick experiments, but it is not a full display-manager
# session.
nix run github:mateoalfaro/singularity-flake
# Build the package
nix build github:mateoalfaro/singularity-flakeFor a real desktop session, use the NixOS module. Add the flake to your inputs and enable it with a single option:
{
inputs.singularity-desktop.url = "github:mateoalfaro/singularity-flake";
outputs = { self, nixpkgs, singularity-desktop, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
singularity-desktop.nixosModules.default
];
};
};
}You can also use the experimental module to replace some subprojects with my own forked versions, in order to help me test new features or bug fixes.
{
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
singularity-desktop.nixosModules.experimental
];
};
}The experimental module uses the same NixOS options as the default module, but its default package currently replaces these subprojects in the Singularity Desktop source tree:
subprojects/singularity-shellsubprojects/singularity-sessionsubprojects/xdg-desktop-portal-singularitysubprojects/labwc
{
programs.singularity-desktop = {
enable = true;
# Optional: you can also exclude bundled applications from the system profile.
excludePackages = with pkgs; [
singularity-calculator
singularity-music
singularity-store
];
greeter = {
enable = true; # enables the Singularity greeter via greetd (disabled by default)
#You can also customize greetd by replacing the default background image
#background = "/path/to/image.jpg";
};
};
}programs.singularity-desktop.excludePackages accepts package values, like
environment.gnome.excludePackages. Importing either Singularity NixOS module
adds an overlay that exposes these default applications under pkgs:
singularity-filessingularity-calculatorsingularity-calendarsingularity-editsingularity-gitsingularity-leafssingularity-monitorsingularity-musicsingularity-photossingularity-storesingularity-videossingularity-write
The desktop session, shell, greeter, portal, themes, wallpapers, and other required desktop infrastructure are kept in the core package and cannot be excluded.
When programs.singularity-desktop.greeter.enable = true, your desktop session
is started by greetd on tty1. If you later switch to another display
manager such as GDM with nixos-rebuild switch while still logged into that session,
the existing greetd session will still be present in tty1/tty2.
Reboot for the old session to disappear.
This appears to be intended greetd behavior and cannot be fixed by this flake.
For display manager changes such as greetd <-> gdm, prefer one of these:
- use
nixos-rebuild bootand reboot - run
nixos-rebuild switchfrom another TTY or over SSH - after switching, move to the VT where the new display manager started
(commonly
Ctrl+Alt+F2orCtrl+Alt+F3)
programs.singularity-desktop.package can be overridden, but the replacement
package must provide the same runtime interface as the default package:
bin/singularity-labwc-sessionbin/singularity-desktop-sessionbin/labwc- the greeter executables used by the module
- Wayland session metadata under
share/wayland-sessions - xdg-desktop-portal metadata and services
passthru.providedSessions
-
nixpkgs— pinned tonixos-unstable. -
labwc-src— tracks the latest commit of singularityos-lab/labwc. -
singularity-desktop-src— tracks the latest commit of singularityos-lab/singularity-desktop (with submodules). -
singularity-shell-src— tracksgit@github.com:mateoalfaro/singularity-shell.gitforpackages.experimentalandnixosModules.experimental. -
singularity-session-src— tracksgit@github.com:mateoalfaro/singularity-session.gitforpackages.experimentalandnixosModules.experimental. -
xdg-desktop-portal-singularity-src— tracksgit@github.com:mateoalfaro/xdg-desktop-portal-singularity.gitforpackages.experimentalandnixosModules.experimental. -
labwc-fork— tracksgit@github.com:mateoalfaro/xdg-desktop-portal-singularity.gitforpackages.experimentalandnixosModules.experimental.
To update inputs manually:
nix flake update