fmt flake

This commit is contained in:
Robin Appelman 2022-06-25 15:40:12 +02:00
commit df88fd2102

View file

@ -4,7 +4,12 @@
naersk.url = "github:nix-community/naersk"; naersk.url = "github:nix-community/naersk";
}; };
outputs = { self, nixpkgs, utils, naersk }: outputs = {
self,
nixpkgs,
utils,
naersk,
}:
utils.lib.eachDefaultSystem (system: let utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}"; pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}"; naersk-lib = naersk.lib."${system}";
@ -29,12 +34,18 @@
# `nix develop` # `nix develop`
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo ]; nativeBuildInputs = with pkgs; [rustc cargo];
}; };
}) // { })
nixosModule = { config, lib, pkgs, ... }: // {
with lib; nixosModule = {
let cfg = config.palantir.services.palantir; config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.palantir.services.palantir;
in { in {
options.palantir.services.palantir = { options.palantir.services.palantir = {
enable = mkEnableOption "Enables the palantir service"; enable = mkEnableOption "Enables the palantir service";
@ -48,22 +59,23 @@
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ cfg.port ]; networking.firewall.allowedTCPPorts = [cfg.port];
users.groups.palantir = {}; users.groups.palantir = {};
users.groups.powermonitoring = {}; users.groups.powermonitoring = {};
users.users.palantir = { users.users.palantir = {
isSystemUser = true; isSystemUser = true;
group = "palantir"; group = "palantir";
extraGroups = [ "powermonitoring" ]; extraGroups = ["powermonitoring"];
}; };
services.udev.packages = [ self.defaultPackage.${pkgs.system} ]; services.udev.packages = [self.defaultPackage.${pkgs.system}];
systemd.services."palantir" = { systemd.services."palantir" = {
wantedBy = [ "multi-user.target" ]; wantedBy = ["multi-user.target"];
serviceConfig = let pkg = self.defaultPackage.${pkgs.system}; serviceConfig = let
pkg = self.defaultPackage.${pkgs.system};
in { in {
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${pkg}/bin/palantir"; ExecStart = "${pkg}/bin/palantir";