Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib: add comments

+15 -1
+15 -1
nix/lib.nix
··· 3 3 ... 4 4 }: 5 5 { 6 + # generateUnitFiles creates a derivatioon with systemd units 7 + # using the nixos module structure, but intended for using in 8 + # a sower service along with sowerServicesHook 6 9 flake.lib.generateUnitFiles = 7 10 { 8 11 pkgs, ··· 56 59 # TODO type this 57 60 }; 58 61 62 + # copy the options structure out of nixpkgs, or a subset anyway 63 + # unfortunately this isn't exposed in a consumable way in nixpkgs 59 64 systemd = { 60 65 package = mkPackageOption pkgs "systemd" { }; 61 66 ··· 169 174 }; 170 175 171 176 config = { 177 + # the bare minimum to init the necessary config, and merge all the units together 178 + # for consumption by generateUnits 172 179 systemd = { 173 180 package = pkgs.systemd; 174 181 defaultUnit = "default.target"; ··· 217 224 in 218 225 { 219 226 config = { 227 + # build the combined units into a package, and expose 228 + # then in a module option for consumption 220 229 service-units = pkgs.runCommand "service-units" { } '' 221 - cp -R ${system-units} $out 230 + cp --recursive ${system-units} $out 222 231 chmod +w -R $out 232 + # delete any broken links 223 233 find $out -xtype l -delete 234 + # delete empty directories 224 235 find $out -type d -empty -delete 236 + # remove the upstream targets 225 237 for unit in ${builtins.toString upstreamUnits}; do 226 238 rm $out/$unit 227 239 done ··· 230 242 } 231 243 ) 232 244 { 245 + # pass on the config from generateUnitFiles 233 246 systemd = config; 234 247 } 235 248 ]; ··· 237 250 }; 238 251 239 252 in 253 + # return back the units, aka the package with them 240 254 moduler.config.service-units; 241 255 }