flake: module
This commit is contained in:
parent
47c353c7da
commit
28a03bde35
1 changed files with 48 additions and 7 deletions
55
flake.nix
55
flake.nix
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
outputs = { nixpkgs, ... }: let
|
||||
spond = { rustPlatform, rustfmt, clippy, pkg-config, openssl, ... }: rustPlatform.buildRustPackage {
|
||||
pname = "spond";
|
||||
version = "0.0.0";
|
||||
pname = "tb-spond-rs";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
|
@ -14,18 +14,19 @@
|
|||
];
|
||||
};
|
||||
|
||||
allpkgs = system: pkgs: pkgs.extend (_: _: nixpkgs.lib.attrsets.filterAttrs (name: _: name != "default") (packages system pkgs));
|
||||
allpkgs = pkgs: pkgs.extend (_: _: nixpkgs.lib.attrsets.filterAttrs (name: _: name != "default") (packages' pkgs));
|
||||
|
||||
packages = system: pkgs': let
|
||||
pkgs = allpkgs system pkgs';
|
||||
packages = system: packages';
|
||||
packages' = pkgs': let
|
||||
pkgs = allpkgs pkgs';
|
||||
in {
|
||||
default = pkgs.spond;
|
||||
spond = pkgs.callPackage spond {};
|
||||
};
|
||||
|
||||
devShells = system: pkgs': let
|
||||
pkgs = allpkgs system pkgs';
|
||||
in builtins.mapAttrs (devShell pkgs) (packages system pkgs');
|
||||
pkgs = allpkgs pkgs';
|
||||
in builtins.mapAttrs (devShell pkgs) (packages pkgs');
|
||||
|
||||
devShell = pkgs: name: pkg: pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
|
|
@ -57,8 +58,48 @@
|
|||
printf 'Dev shell for %s ready!\n' '${pkg.name}'
|
||||
'';
|
||||
};
|
||||
|
||||
nixosModule = { pkgs, lib, config, ... }: let
|
||||
cli = lib.getExe (packages' pkgs).spond;
|
||||
in {
|
||||
config.systemd.timers."tb-spond-rs" = {
|
||||
description = "[TB] choose who is allowed to participate this week.";
|
||||
timerConfig.OnCalendar = "Sat 18:00:00";
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
config.systemd.services."tb-spond-rs" = {
|
||||
description = "[TB] choose who is allowed to participate this week.";
|
||||
after = [ "network.target" ];
|
||||
wants = [ "network.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = lib.escapeShellArgs [
|
||||
cli
|
||||
"--email" "jonas.rabenstein@web.de"
|
||||
"--heading" "Schwimmtraining Donnerstag"
|
||||
];
|
||||
EnvironmentFile=[ "%d/environment" ];
|
||||
User = "tb-spond-rs";
|
||||
Group = "tb-spond-rs";
|
||||
DynamicUser = true;
|
||||
RuntimeDirectory = "tb-spond-rs";
|
||||
StateDirectory = "tb-spond-rs";
|
||||
ProtectSystem = "full";
|
||||
ProtectHome = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
packages = builtins.mapAttrs packages nixpkgs.legacyPackages;
|
||||
devShells = builtins.mapAttrs devShells nixpkgs.legacyPackages;
|
||||
|
||||
nixosModules = {
|
||||
default = nixosModule;
|
||||
spond = nixosModule;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue