alpha
Login
or
Join now
lass.pds.lassul.us
/
superconfig
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
1
Pipelines
remove make-wrapper-module
author
lassulus
date
1 year ago
(Jul 29, 2025, 8:15 PM CEST)
commit
ea3cf66d
ea3cf66d38265ce0860c1bb28e34a1a41cdf2304
parent
07b8c859
07b8c85933a3bc52dd9fb47cbd98326398b031a8
-108
1 changed file
Expand all
Collapse all
Unified
Split
lib
make-wrapper-module.nix
-108
lib/make-wrapper-module.nix
Reviewed
···
1
1
-
{
2
2
-
lib,
3
3
-
superlib,
4
4
-
pkgs,
5
5
-
}:
6
6
-
let
7
7
-
makeWrapper = (import ./make-wrapper.nix { inherit lib superlib pkgs; }).makeWrapper;
8
8
-
in
9
9
-
{
10
10
-
/**
11
11
-
Create a wrapper module that combines NixOS module evaluation with makeWrapper functionality.
12
12
-
13
13
-
This function creates a reusable wrapper configuration that can be instantiated
14
14
-
with different settings using the NixOS module system.
15
15
-
16
16
-
# Arguments
17
17
-
18
18
-
- `name`: String identifier for the wrapper module
19
19
-
- `options`: Attribute set of `lib.mkOption` definitions for configurable settings
20
20
-
- `module`: Function that receives the evaluated config and returns:
21
21
-
- `package`: The base package to wrap (required)
22
22
-
- All other makeWrapper parameters (wrapper, env, runtimeInputs, etc.)
23
23
-
24
24
-
# Returns
25
25
-
26
26
-
A function that takes settings and returns the wrapped package.
27
27
-
28
28
-
# Example
29
29
-
30
30
-
```nix
31
31
-
# Define the wrapper module
32
32
-
muttWrapperModule = makeWrapperModule {
33
33
-
name = "mutt";
34
34
-
options = {
35
35
-
muttrc = lib.mkOption {
36
36
-
type = lib.types.lines;
37
37
-
default = "";
38
38
-
description = "Mutt configuration";
39
39
-
};
40
40
-
editor = lib.mkOption {
41
41
-
type = lib.types.str;
42
42
-
default = "vim";
43
43
-
description = "Editor to use for composing emails";
44
44
-
};
45
45
-
};
46
46
-
module = { config, pkgs, ... }: {
47
47
-
package = pkgs.mutt;
48
48
-
env = {
49
49
-
EDITOR = config.editor;
50
50
-
};
51
51
-
wrapper = { exePath, ... }: ''
52
52
-
exec ${exePath} -F ${pkgs.writeText "muttrc" config.muttrc} "$@"
53
53
-
'';
54
54
-
};
55
55
-
};
56
56
-
57
57
-
# Use with settings
58
58
-
packages.mutt = muttWrapperModule {
59
59
-
muttrc = ''
60
60
-
set editor = "nvim"
61
61
-
set sort = threads
62
62
-
'';
63
63
-
editor = "nvim";
64
64
-
};
65
65
-
```
66
66
-
*/
67
67
-
makeWrapperModule =
68
68
-
{
69
69
-
name,
70
70
-
options,
71
71
-
module,
72
72
-
}:
73
73
-
# Return a function that takes settings
74
74
-
settings:
75
75
-
let
76
76
-
# Evaluate the module with the provided settings
77
77
-
evaluated = lib.evalModules {
78
78
-
modules = [
79
79
-
# Base module with options
80
80
-
{
81
81
-
options = options;
82
82
-
}
83
83
-
# The wrapper module definition
84
84
-
module
85
85
-
# User settings
86
86
-
{
87
87
-
config = settings;
88
88
-
}
89
89
-
];
90
90
-
# Provide standard module arguments
91
91
-
specialArgs = {
92
92
-
inherit pkgs lib;
93
93
-
};
94
94
-
};
95
95
-
96
96
-
# Extract the evaluated config
97
97
-
config = evaluated.config;
98
98
-
99
99
-
# The module must provide a package
100
100
-
package =
101
101
-
config.package or (throw "makeWrapperModule '${name}': module must define a 'package' attribute");
102
102
-
103
103
-
# Extract makeWrapper parameters from config (excluding 'package')
104
104
-
wrapperArgs = lib.filterAttrs (n: _v: n != "package") config;
105
105
-
in
106
106
-
# Call makeWrapper with the package and extracted arguments
107
107
-
makeWrapper package wrapperArgs;
108
108
-
}