Skip to content

Commit

Permalink
Merge branch 'NixOS:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
prinzdezibel authored Dec 5, 2024
2 parents 391d3af + 3f056db commit 807be0c
Show file tree
Hide file tree
Showing 102 changed files with 3,792 additions and 827 deletions.
5 changes: 4 additions & 1 deletion doc/build-helpers/fetchers.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,9 @@ Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `hash`

Used with Git. Expects `url` to a Git repo, `rev`, and `hash`. `rev` in this case can be full the git commit id (SHA1 hash) or a tag name like `refs/tags/v1.0`.

If you want to fetch a tag you should pass the `tag` parameter instead of `rev` which has the same effect as setting `rev = "refs/tags"/${version}"`.
This is safer than just setting `rev = version` w.r.t. possible branch and tag name conflicts.

Additionally, the following optional arguments can be given:

*`fetchSubmodules`* (Boolean)
Expand Down Expand Up @@ -833,7 +836,7 @@ A number of fetcher functions wrap part of `fetchurl` and `fetchzip`. They are m

## `fetchFromGitHub` {#fetchfromgithub}

`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred.
`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. If you need to fetch a tag however, you should prefer to use the `tag` parameter which achieves this in a safer way with less boilerplate. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred.

To use a different GitHub instance, use `githubBase` (defaults to `"github.com"`).

Expand Down
40 changes: 23 additions & 17 deletions doc/languages-frameworks/dotnet.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,48 @@ mkShell {
name = "dotnet-env";
packages = [
(with dotnetCorePackages; combinePackages [
sdk_6_0
sdk_7_0
sdk_8_0
sdk_9_0
])
];
}
```

This will produce a dotnet installation that has the dotnet 6.0 7.0 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:
This will produce a dotnet installation that has the dotnet 8.0 9.0 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:

```ShellSession
$ dotnet --info
.NET SDK:
Version: 7.0.202
Commit: 6c74320bc3
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660

Runtime Environment:
OS Name: nixos
OS Version: 23.05
OS Version: 25.05
OS Platform: Linux
RID: linux-x64
Base Path: /nix/store/n2pm44xq20hz7ybsasgmd7p3yh31gnh4-dotnet-sdk-7.0.202/sdk/7.0.202/
Base Path: /nix/store/a03c70i7x6rjdr6vikczsp5ck3v6rixh-dotnet-sdk-9.0.100/share/dotnet/sdk/9.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 7.0.4
Version: 9.0.0
Architecture: x64
Commit: 0a396acafe
Commit: 9d5a6a9aa4

.NET SDKs installed:
6.0.407 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/sdk]
7.0.202 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/sdk]
8.0.404 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/sdk]
9.0.100 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.15 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.15 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.NETCore.App]
Microsoft.AspNetCore.App 8.0.11 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None
Expand Down Expand Up @@ -146,8 +152,8 @@ in buildDotnetModule rec {
buildInputs = [ referencedProject ]; # `referencedProject` must contain `nupkg` in the folder structure.
dotnet-sdk = dotnetCorePackages.sdk_6_0;
dotnet-runtime = dotnetCorePackages.runtime_6_0;
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.runtime_8_0;
executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.
executables = []; # Don't install any executables.
Expand Down
32 changes: 32 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,13 @@
githubId = 6987136;
keys = [ { fingerprint = "2C6D 37D4 6AA1 DCDA BE8D F346 43E2 CF4C 01B9 4940"; } ];
};
BastianAsmussen = {
name = "Bastian Asmussen";
email = "[email protected]";
github = "BastianAsmussen";
githubId = 76102128;
keys = [ { fingerprint = "3B11 7469 0893 85E7 16C2 7CD9 0FE5 A355 DBC9 2568"; } ];
};
basvandijk = {
email = "[email protected]";
github = "basvandijk";
Expand Down Expand Up @@ -5584,6 +5591,12 @@
githubId = 15774340;
name = "Thomas Depierre";
};
DictXiong = {
email = "[email protected]";
github = "DictXiong";
githubId = 41772157;
name = "Dict Xiong";
};
diegolelis = {
email = "[email protected]";
github = "DiegoLelis";
Expand Down Expand Up @@ -12869,6 +12882,13 @@
githubId = 1202012;
name = "Ignat Loskutov";
};
lostmsu = {
email = "[email protected]";
github = "lostmsu";
githubId = 239520;
matrix = "@lostmsu:matrix.org";
name = "Victor Nova";
};
lostnet = {
email = "[email protected]";
github = "lostnet";
Expand Down Expand Up @@ -20259,6 +20279,12 @@
githubId = 293035;
name = "Shawn Dellysse";
};
ShawnToubeau = {
name = "Shawn Toubeau";
email = "[email protected]";
github = "ShawnToubeau";
githubId = 22332636;
};
shayne = {
email = "[email protected]";
github = "shayne";
Expand Down Expand Up @@ -22622,6 +22648,12 @@
githubId = 2125828;
name = "Alex Davies";
};
travgm = {
email = "[email protected]";
github = "travgm";
githubId = 99630881;
name = "Travis Montoya";
};
travisbhartwell = {
email = "[email protected]";
github = "travisbhartwell";
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/databases/victoriametrics.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ in
serviceConfig = {
ExecStart = lib.escapeShellArgs (
startCLIList
++ lib.optionals (cfg.prometheusConfig != null) [ "-promscrape.config=${prometheusConfigYml}" ]
++ lib.optionals (cfg.prometheusConfig != {}) [ "-promscrape.config=${prometheusConfigYml}" ]
);

DynamicUser = true;
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/misc/pykms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ in
serviceConfig = with pkgs; {
DynamicUser = true;
StateDirectory = baseNameOf libDir;
ExecStartPre = "${getBin pykms}/libexec/create_pykms_db.sh ${libDir}/clients.db";
ExecStartPre = "${lib.getBin pykms}/libexec/create_pykms_db.sh ${libDir}/clients.db";
ExecStart = lib.concatStringsSep " " ([
"${getBin pykms}/bin/server"
"${lib.getBin pykms}/bin/server"
"--logfile=STDOUT"
"--loglevel=${cfg.logLevel}"
"--sqlite=${libDir}/clients.db"
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/monitoring/vmagent.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ in {
CacheDirectory = "vmagent";
ExecStart = lib.escapeShellArgs (
startCLIList
++ lib.optionals (cfg.prometheusConfig != null) ["-promscrape.config=${prometheusConfigYml}"]
++ lib.optionals (cfg.prometheusConfig != {}) ["-promscrape.config=${prometheusConfigYml}"]
);
LoadCredential = lib.optional (cfg.remoteWrite.basicAuthPasswordFile != null) [
"remote_write_basic_auth_password:${cfg.remoteWrite.basicAuthPasswordFile}"
Expand Down
72 changes: 58 additions & 14 deletions nixos/modules/services/web-apps/akkoma.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
{ config, lib, pkgs, ... }:

with lib;
let
inherit (lib)
any
attrsets
attrByPath
catAttrs
collect
concatMapStrings
concatStringsSep
escape
escapeShellArg
escapeShellArgs
hasInfix
isAttrs
isList
isStorePath
isString
mapAttrs
mapAttrsToList
optionalString
optionals
replaceStrings
splitString
substring
versionOlder

fileContents
readFile

literalExpression
literalMD
mkBefore
mkEnableOption
mkIf
mkMerge
mkOption
mkOptionType
mkPackageOption
types;

cfg = config.services.akkoma;
ex = cfg.config;
db = ex.":pleroma"."Pleroma.Repo";
web = ex.":pleroma"."Pleroma.Web.Endpoint";

format = pkgs.formats.elixirConf { elixir = cfg.package.elixirPackage; };
inherit (format.lib)
mkAtom
mkMap
mkRaw
mkTuple;

isConfined = config.systemd.services.akkoma.confinement.enable;
hasSmtp = (attrByPath [ ":pleroma" "Pleroma.Emails.Mailer" "adapter" "value" ] null ex) == "Swoosh.Adapters.SMTP";

Expand Down Expand Up @@ -96,16 +141,15 @@ let
passAsFile = [ "code" ];
} ''elixir "$codePath" >"$out"'');

format = pkgs.formats.elixirConf { elixir = cfg.package.elixirPackage; };
configFile = format.generate "config.exs"
(replaceSec
(attrsets.updateManyAttrsByPath [{
path = [ ":pleroma" "Pleroma.Web.Endpoint" "http" "ip" ];
update = addr:
if isAbsolutePath addr
then format.lib.mkTuple
[ (format.lib.mkAtom ":local") addr ]
else format.lib.mkRaw (erlAddr addr);
then mkTuple
[ (mkAtom ":local") addr ]
else mkRaw (erlAddr addr);
}] cfg.config));

writeShell = { name, text, runtimeInputs ? [ ] }:
Expand Down Expand Up @@ -282,7 +326,7 @@ let
AKKOMA_CONFIG_PATH="''${RUNTIME_DIRECTORY%%:*}/config.exs" \
ERL_EPMD_ADDRESS="${cfg.dist.address}" \
ERL_EPMD_PORT="${toString cfg.dist.epmdPort}" \
ERL_FLAGS=${lib.escapeShellArg (lib.escapeShellArgs ([
ERL_FLAGS=${escapeShellArg (escapeShellArgs ([
"-kernel" "inet_dist_use_interface" (erlAddr cfg.dist.address)
"-kernel" "inet_dist_listen_min" (toString cfg.dist.portMin)
"-kernel" "inet_dist_listen_max" (toString cfg.dist.portMax)
Expand Down Expand Up @@ -639,7 +683,7 @@ in {
"Pleroma.Repo" = mkOption {
type = elixirValue;
default = {
adapter = format.lib.mkRaw "Ecto.Adapters.Postgres";
adapter = mkRaw "Ecto.Adapters.Postgres";
socket_dir = "/run/postgresql";
username = cfg.user;
database = "akkoma";
Expand Down Expand Up @@ -769,7 +813,7 @@ in {
in {
base_url = mkOption {
type = types.nonEmptyStr;
default = if lib.versionOlder config.system.stateVersion "24.05"
default = if versionOlder config.system.stateVersion "24.05"
then "${httpConf.scheme}://${httpConf.host}:${builtins.toString httpConf.port}/media/"
else null;
defaultText = literalExpression ''
Expand All @@ -787,7 +831,7 @@ in {
":frontends" = mkOption {
type = elixirValue;
default = mapAttrs
(key: val: format.lib.mkMap { name = val.name; ref = val.ref; })
(key: val: mkMap { name = val.name; ref = val.ref; })
cfg.frontends;
defaultText = literalExpression ''
lib.mapAttrs (key: val:
Expand Down Expand Up @@ -816,7 +860,7 @@ in {
};
base_url = mkOption {
type = types.nullOr types.nonEmptyStr;
default = if lib.versionOlder config.system.stateVersion "24.05"
default = if versionOlder config.system.stateVersion "24.05"
then "${httpConf.scheme}://${httpConf.host}:${builtins.toString httpConf.port}"
else null;
defaultText = literalExpression ''
Expand Down Expand Up @@ -899,7 +943,7 @@ in {
":backends" = mkOption {
type = types.listOf elixirValue;
visible = false;
default = with format.lib; [
default = [
(mkTuple [ (mkRaw "ExSyslogger") (mkAtom ":ex_syslogger") ])
];
};
Expand All @@ -913,7 +957,7 @@ in {

level = mkOption {
type = types.nonEmptyStr;
apply = format.lib.mkAtom;
apply = mkAtom;
default = ":info";
example = ":warning";
description = ''
Expand All @@ -931,7 +975,7 @@ in {
":data_dir" = mkOption {
type = elixirValue;
internal = true;
default = format.lib.mkRaw ''
default = mkRaw ''
Path.join(System.fetch_env!("CACHE_DIRECTORY"), "tzdata")
'';
};
Expand Down Expand Up @@ -1136,6 +1180,6 @@ in {
};
};

meta.maintainers = with maintainers; [ mvs ];
meta.maintainers = with lib.maintainers; [ mvs ];
meta.doc = ./akkoma.md;
}
Loading

0 comments on commit 807be0c

Please sign in to comment.