File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 2
2
repo = builtins . toString ./.. ;
3
3
in
4
4
with ( import ./project.nix { } ) ; rec {
5
+ inherit pkgs ;
5
6
pkgBin = pkg : "${ pkgs . ${ pkg } } /bin/${ pkg } " ;
6
7
nix-bundle = pkgs . nix-bundle . overrideAttrs ( attrs : {
7
8
buildInputs =
62
63
} ;
63
64
mkService = {
64
65
srv ,
65
- usr ? null ,
66
+ opts ? { } ,
66
67
mkExe ,
67
68
} : {
68
69
lib ,
75
76
] ;
76
77
77
78
options = {
78
- services . "${ srv } " = {
79
- enable = mkOption {
80
- default = false ;
81
- type = types . bool ;
82
- } ;
83
- } ;
79
+ services . "${ srv } " =
80
+ {
81
+ enable = mkOption {
82
+ default = false ;
83
+ type = types . bool ;
84
+ } ;
85
+ runAsUser = mkOption {
86
+ type = types . nullOr types . str ;
87
+ } ;
88
+ }
89
+ // opts ;
84
90
} ;
85
91
86
92
config = mkIf config . services . "${ srv } " . enable {
89
95
wantedBy = [ "default.target" ] ;
90
96
script = "PATH=$PATH:${ pkgs . busybox } /bin ${ mkExe config } " ;
91
97
serviceConfig = {
92
- User =
98
+ User = let
99
+ usr = config . services . "${ srv } " . runAsUser ;
100
+ in
93
101
if usr == null
94
102
then config . services . functora . userName
95
103
else usr ;
You can’t perform that action at this time.
0 commit comments