2023-11-27 12:33:52 +00:00
|
|
|
{
|
2023-11-28 19:03:29 +00:00
|
|
|
description = "staxman";
|
|
|
|
|
2023-11-27 12:33:52 +00:00
|
|
|
inputs = {
|
2023-11-28 19:03:29 +00:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
rust-crate2nix = {
|
|
|
|
url = "github:kolloch/crate2nix";
|
2023-11-27 12:33:52 +00:00
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-28 19:03:29 +00:00
|
|
|
outputs = inputs @ {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-parts,
|
|
|
|
rust-overlay,
|
|
|
|
rust-crate2nix,
|
|
|
|
...
|
|
|
|
} : flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
2023-11-28 19:54:04 +00:00
|
|
|
flake = with nixpkgs.lib; {
|
|
|
|
nixosModules.staxman = {
|
|
|
|
options = {
|
|
|
|
enable = mkEnableOption "staxman";
|
|
|
|
stackDir = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
defaultText = "/stacks";
|
|
|
|
example = "/stacks";
|
|
|
|
description = ''
|
|
|
|
Directory containing Arion stacks
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.staxman = {
|
|
|
|
description = "Scatting system management";
|
|
|
|
after = [ "network-online.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment.STAX_ARION_BIN = "${getBin nixpkgs.arion}";
|
|
|
|
environment.STAX_DIR = cfg.stackDir;
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = "root";
|
|
|
|
Group = "root";
|
|
|
|
Restart = "always";
|
|
|
|
ExecStart = "${getBin nixpkgs.staxman}/bin/staxman";
|
|
|
|
};
|
|
|
|
StateDirectory = "staxman";
|
|
|
|
StateDirectoryMode = "0750";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-11-28 19:03:29 +00:00
|
|
|
perSystem = { system, pkgs, ... }: let
|
|
|
|
overlays = [
|
|
|
|
(import rust-overlay)
|
|
|
|
(self: super: let
|
|
|
|
toolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
in {
|
|
|
|
rustc = toolchain;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
2023-11-27 12:33:52 +00:00
|
|
|
|
2023-11-28 19:03:29 +00:00
|
|
|
project = let
|
|
|
|
crateTools = pkgs.callPackage "${rust-crate2nix}/tools.nix" { inherit pkgs; };
|
|
|
|
in import (crateTools.generatedCargoNix {
|
|
|
|
name = "staxman";
|
|
|
|
src = ./.;
|
|
|
|
}) {
|
|
|
|
inherit pkgs;
|
2023-11-27 12:33:52 +00:00
|
|
|
};
|
2023-11-28 19:03:29 +00:00
|
|
|
in rec {
|
|
|
|
packages = {
|
|
|
|
staxman = project.rootCrate.build;
|
|
|
|
default = packages.staxman;
|
2023-11-27 12:33:52 +00:00
|
|
|
};
|
2023-11-28 19:03:29 +00:00
|
|
|
};
|
|
|
|
};
|
2023-11-28 19:54:04 +00:00
|
|
|
}
|