style(nix): alejandra -> nixfmt-rfc-style
This commit is contained in:
parent
bdb2ef7c4c
commit
068da95e36
4 changed files with 127 additions and 106 deletions
|
@ -31,19 +31,24 @@ rustPlatform.buildRustPackage {
|
|||
lockFile = ../Cargo.lock;
|
||||
};
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
||||
CoreFoundation
|
||||
Security
|
||||
SystemConfiguration
|
||||
]);
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (
|
||||
with darwin.apple_sdk.frameworks;
|
||||
[
|
||||
CoreFoundation
|
||||
Security
|
||||
SystemConfiguration
|
||||
]
|
||||
);
|
||||
|
||||
env = let
|
||||
toRustFlags = lib.mapAttrs' (
|
||||
name:
|
||||
lib.nameValuePair
|
||||
"CARGO_PROFILE_RELEASE_${lib.toUpper (builtins.replaceStrings ["-"] ["_"] name)}"
|
||||
);
|
||||
in
|
||||
env =
|
||||
let
|
||||
toRustFlags = lib.mapAttrs' (
|
||||
name:
|
||||
lib.nameValuePair "CARGO_PROFILE_RELEASE_${
|
||||
lib.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] name)
|
||||
}"
|
||||
);
|
||||
in
|
||||
lib.optionalAttrs lto (toRustFlags {
|
||||
lto = "thin";
|
||||
})
|
||||
|
@ -62,6 +67,9 @@ rustPlatform.buildRustPackage {
|
|||
description = "Discord bot for Prism Launcher";
|
||||
homepage = "https://github.com/PrismLauncher/refraction";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [getchoo Scrumplex];
|
||||
maintainers = with maintainers; [
|
||||
getchoo
|
||||
Scrumplex
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
self: {
|
||||
self:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.services.refraction;
|
||||
defaultUser = "refraction";
|
||||
|
||||
inherit
|
||||
(lib)
|
||||
inherit (lib)
|
||||
getExe
|
||||
literalExpression
|
||||
mdDoc
|
||||
|
@ -19,10 +20,11 @@ self: {
|
|||
optionals
|
||||
types
|
||||
;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.refraction = {
|
||||
enable = mkEnableOption "refraction";
|
||||
package = mkPackageOption self.packages.${pkgs.stdenv.hostPlatform.system} "refraction" {};
|
||||
package = mkPackageOption self.packages.${pkgs.stdenv.hostPlatform.system} "refraction" { };
|
||||
|
||||
user = mkOption {
|
||||
description = mdDoc ''
|
||||
|
@ -84,10 +86,8 @@ in {
|
|||
|
||||
systemd.services."refraction" = {
|
||||
enable = true;
|
||||
wantedBy = ["multi-user.target"];
|
||||
after =
|
||||
["network.target"]
|
||||
++ optionals (cfg.redisUrl == "local") ["redis-refraction.service"];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ] ++ optionals (cfg.redisUrl == "local") [ "redis-refraction.service" ];
|
||||
|
||||
script = ''
|
||||
${getExe cfg.package}
|
||||
|
@ -95,9 +95,10 @@ in {
|
|||
|
||||
environment = {
|
||||
BOT_REDIS_URL =
|
||||
if cfg.redisUrl == "local"
|
||||
then "unix:${config.services.redis.servers.refraction.unixSocket}"
|
||||
else cfg.redisUrl;
|
||||
if cfg.redisUrl == "local" then
|
||||
"unix:${config.services.redis.servers.refraction.unixSocket}"
|
||||
else
|
||||
cfg.redisUrl;
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
|
@ -141,9 +142,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
groups = mkIf (cfg.group == defaultUser) {
|
||||
${defaultUser} = {};
|
||||
};
|
||||
groups = mkIf (cfg.group == defaultUser) { ${defaultUser} = { }; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
refraction,
|
||||
rust-overlay,
|
||||
pkgsCross,
|
||||
}: {arch}: let
|
||||
}:
|
||||
{ arch }:
|
||||
let
|
||||
targets = with pkgsCross; {
|
||||
x86_64 = musl64.pkgsStatic;
|
||||
aarch64 = aarch64-multiplatform.pkgsStatic;
|
||||
|
@ -11,17 +13,21 @@
|
|||
|
||||
getRustcTarget = pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget;
|
||||
toolchain = rust-overlay.rust.minimal.override {
|
||||
extensions = ["rust-std"];
|
||||
extensions = [ "rust-std" ];
|
||||
targets = lib.mapAttrsToList (lib.const getRustcTarget) targets;
|
||||
};
|
||||
|
||||
mkRustPlatformWith = pkgs:
|
||||
mkRustPlatformWith =
|
||||
pkgs:
|
||||
pkgs.makeRustPlatform (
|
||||
lib.genAttrs ["cargo" "rustc"] (lib.const toolchain)
|
||||
lib.genAttrs [
|
||||
"cargo"
|
||||
"rustc"
|
||||
] (lib.const toolchain)
|
||||
);
|
||||
rustPlatforms = lib.mapAttrs (lib.const mkRustPlatformWith) targets;
|
||||
in
|
||||
refraction.override {
|
||||
rustPlatform = rustPlatforms.${arch};
|
||||
optimizeSize = true;
|
||||
}
|
||||
refraction.override {
|
||||
rustPlatform = rustPlatforms.${arch};
|
||||
optimizeSize = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue