[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:
@@ -7,6 +7,7 @@
|
||||
./gaming
|
||||
./kdeconnect
|
||||
./kubectl
|
||||
./launchers
|
||||
./media
|
||||
./office
|
||||
./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