[launchers] Add launcher wrappers for compact env
Adds a module to launch specific nixpkgs dynamically, such that they won't be always included in the nix store
This commit is contained in:
@@ -18,7 +18,14 @@
|
|||||||
media.enable = true;
|
media.enable = true;
|
||||||
sync.enable = true;
|
sync.enable = true;
|
||||||
kubectl.enable = true;
|
kubectl.enable = true;
|
||||||
# office.enable = false; # Excluded for storage constraints
|
|
||||||
|
# Launcher wrappers for excluded/optional packages
|
||||||
|
launchers = {
|
||||||
|
enable = true;
|
||||||
|
packages = [
|
||||||
|
"libreoffice"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
targets.genericLinux.enable = true;
|
targets.genericLinux.enable = true;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
./gaming
|
./gaming
|
||||||
./kdeconnect
|
./kdeconnect
|
||||||
./kubectl
|
./kubectl
|
||||||
|
./launchers
|
||||||
./media
|
./media
|
||||||
./office
|
./office
|
||||||
./sync
|
./sync
|
||||||
|
|||||||
36
home/roles/launchers/default.nix
Normal file
36
home/roles/launchers/default.nix
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.home.roles.launchers;
|
||||||
|
|
||||||
|
# Generate a wrapper script for a package
|
||||||
|
makeLauncher = packageName: pkgs.writeShellScriptBin packageName ''
|
||||||
|
exec env NIXPKGS_ALLOW_UNFREE=1 ${pkgs.nix}/bin/nix run --impure nixpkgs#${packageName} -- "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Generate all launcher scripts from the package list
|
||||||
|
launcherPackages = map makeLauncher cfg.packages;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.home.roles.launchers = {
|
||||||
|
enable = mkEnableOption "wrapper launchers for excluded packages";
|
||||||
|
|
||||||
|
packages = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "steam" "libreoffice" "lutris" ];
|
||||||
|
description = ''
|
||||||
|
List of package names to create launcher wrappers for.
|
||||||
|
Each wrapper will run: NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#<package>
|
||||||
|
|
||||||
|
This is useful for occasionally running packages without permanently installing them.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = launcherPackages;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user