lorri service module: init
This commit is contained in:
		
							parent
							
								
									ceccff3439
								
							
						
					
					
						commit
						e5db97d2b0
					
				@ -316,6 +316,7 @@
 | 
			
		||||
  ./services/development/bloop.nix
 | 
			
		||||
  ./services/development/hoogle.nix
 | 
			
		||||
  ./services/development/jupyter/default.nix
 | 
			
		||||
  ./services/development/lorri.nix
 | 
			
		||||
  ./services/editors/emacs.nix
 | 
			
		||||
  ./services/editors/infinoted.nix
 | 
			
		||||
  ./services/games/factorio.nix
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										45
									
								
								nixos/modules/services/development/lorri.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								nixos/modules/services/development/lorri.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,45 @@
 | 
			
		||||
{ config, lib, pkgs, ... }:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  cfg = config.services.lorri;
 | 
			
		||||
  socketPath = "lorri/daemon.socket";
 | 
			
		||||
in {
 | 
			
		||||
  options = {
 | 
			
		||||
    services.lorri = {
 | 
			
		||||
      enable = lib.mkOption {
 | 
			
		||||
        default = false;
 | 
			
		||||
        type = lib.types.bool;
 | 
			
		||||
        description = ''
 | 
			
		||||
          Enables the daemon for `lorri`, a nix-shell replacement for project
 | 
			
		||||
          development. The socket-activated daemon starts on the first request
 | 
			
		||||
          issued by the `lorri` command.
 | 
			
		||||
        '';
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf cfg.enable {
 | 
			
		||||
    systemd.user.sockets.lorri = {
 | 
			
		||||
      description = "Socket for Lorri Daemon";
 | 
			
		||||
      wantedBy = [ "sockets.target" ];
 | 
			
		||||
      socketConfig = {
 | 
			
		||||
        ListenStream = "%t/${socketPath}";
 | 
			
		||||
        RuntimeDirectory = "lorri";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    systemd.user.services.lorri = {
 | 
			
		||||
      description = "Lorri Daemon";
 | 
			
		||||
      requires = [ "lorri.socket" ];
 | 
			
		||||
      after = [ "lorri.socket" ];
 | 
			
		||||
      path = with pkgs; [ config.nix.package gnutar gzip ];
 | 
			
		||||
      serviceConfig = {
 | 
			
		||||
        ExecStart = "${pkgs.lorri}/bin/lorri daemon";
 | 
			
		||||
        PrivateTmp = true;
 | 
			
		||||
        ProtectSystem = "strict";
 | 
			
		||||
        ProtectHome = "read-only";
 | 
			
		||||
        Restart = "on-failure";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user