Compare commits
3 Commits
19115dfb65
...
547d71c19a
Author | SHA1 | Date |
---|---|---|
Colin | 547d71c19a | |
Colin | 79bba42768 | |
Colin | 8dd4fe06f3 |
18
flake.lock
18
flake.lock
|
@ -167,11 +167,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-next-unpatched": {
|
"nixpkgs-next-unpatched": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713963406,
|
"lastModified": 1714164575,
|
||||||
"narHash": "sha256-UjESu2rC2UTxXIeYeRQrm6EwEuz8W0i66RMzVP4ocsw=",
|
"narHash": "sha256-qD6v6JaJcEecszEekUsq09lOg4p+C0B4xOjXctKSNSQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "acba655f267a49327f2cea95003f17b8540909c0",
|
"rev": "7d3f4eadec32d447a5f20d87fa309f00986cb288",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -199,11 +199,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-unpatched": {
|
"nixpkgs-unpatched": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713964117,
|
"lastModified": 1714163391,
|
||||||
"narHash": "sha256-OjGULV89fbmD+kSD83ZjSG1sT6rFwI1/Ijjg+amRBys=",
|
"narHash": "sha256-cNFOXSGBex7iuwVvTvLAOyaLJ2JrbpkazhN5sFsBd+E=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1eb9a6980dee3970850f47ba8139c7402f54a9a0",
|
"rev": "0b868df4ced96400774414f5baf30b696215b98f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -223,11 +223,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713950167,
|
"lastModified": 1714148467,
|
||||||
"narHash": "sha256-D/Vp8UJDA7t3X/wIHuZosHBTjuWBabeqr6roa2jwnfI=",
|
"narHash": "sha256-490twO3T4EYoQcQ0FuJjnwIdt8eRryNzIq3CVDnRzFw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "80659e4b2805654de851996e682b063a5d7eea5e",
|
"rev": "ca9d278400c170935a95dd75e7e2537c2afd1cb7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -98,7 +98,7 @@ in
|
||||||
# "picard" # music tagging
|
# "picard" # music tagging
|
||||||
# "libsForQt5.plasmatube" # Youtube player
|
# "libsForQt5.plasmatube" # Youtube player
|
||||||
"signal-desktop"
|
"signal-desktop"
|
||||||
"spot" # Gnome Spotfy client
|
"spot" # Gnome Spotify client
|
||||||
# "sublime-music"
|
# "sublime-music"
|
||||||
# "tdesktop" # broken on phosh
|
# "tdesktop" # broken on phosh
|
||||||
# "tokodon"
|
# "tokodon"
|
||||||
|
|
|
@ -68,7 +68,7 @@ let
|
||||||
# - "longrun"
|
# - "longrun"
|
||||||
# - "bundle"
|
# - "bundle"
|
||||||
# - "oneshot"?
|
# - "oneshot"?
|
||||||
serviceToFs = { name, check, contents, depends, finish, run, type }: let
|
serviceToFs = { name, check, contents, depends, finish, run, up, type }: let
|
||||||
logger = serviceToFs' {
|
logger = serviceToFs' {
|
||||||
name = "logger:${name}";
|
name = "logger:${name}";
|
||||||
consumerFor = name;
|
consumerFor = name;
|
||||||
|
@ -76,10 +76,11 @@ let
|
||||||
type = "longrun";
|
type = "longrun";
|
||||||
};
|
};
|
||||||
in (serviceToFs' {
|
in (serviceToFs' {
|
||||||
inherit name check depends finish run type;
|
inherit name check depends finish run type up;
|
||||||
contents = maybe (type == "bundle") contents;
|
contents = maybe (type == "bundle") contents;
|
||||||
producerFor = maybe (type != "bundle") "logger:${name}";
|
# XXX: apparently `oneshot` services can't have loggers: only `longrun` can log.
|
||||||
}) // (lib.optionalAttrs (type != "bundle") logger);
|
producerFor = maybe (type == "longrun") "logger:${name}";
|
||||||
|
}) // (lib.optionalAttrs (type == "longrun") logger);
|
||||||
|
|
||||||
serviceToFs'= {
|
serviceToFs'= {
|
||||||
name,
|
name,
|
||||||
|
@ -91,8 +92,40 @@ let
|
||||||
finish ? null,
|
finish ? null,
|
||||||
producerFor ? null,
|
producerFor ? null,
|
||||||
run ? null,
|
run ? null,
|
||||||
|
up ? null,
|
||||||
}: let
|
}: let
|
||||||
maybe-notify = lib.optionalString (check != null) "s6-notifyoncheck -n 0 ";
|
maybe-notify = lib.optionalString (check != null) "s6-notifyoncheck -n 0 ";
|
||||||
|
makeAbortable = op: maybe-notify: cli: ''
|
||||||
|
#!/bin/sh
|
||||||
|
log() {
|
||||||
|
printf 's6[%s/%s]: %s\n' '${name}' '${op}' "$1" | tee /dev/stderr
|
||||||
|
}
|
||||||
|
log "preparing"
|
||||||
|
|
||||||
|
# s6 is too gentle when i ask it to stop a service,
|
||||||
|
# so explicitly kill children on exit.
|
||||||
|
# see: <https://stackoverflow.com/a/2173421>
|
||||||
|
# before changing this, test that the new version actually kills a service with `s6-rc down <svcname>`
|
||||||
|
down() {
|
||||||
|
log "trapped on abort signal"
|
||||||
|
# "trap -": to avoid recursing
|
||||||
|
trap - SIGINT SIGQUIT SIGTERM
|
||||||
|
log "killing process group"
|
||||||
|
# "kill 0" means kill the current process group (i.e. all descendants)
|
||||||
|
kill 0
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
trap down SIGINT SIGQUIT SIGTERM
|
||||||
|
|
||||||
|
log "handoff"
|
||||||
|
# run the service from $HOME by default.
|
||||||
|
# particularly, this impacts things like "what directory does my terminal open in".
|
||||||
|
# N.B. do not run the notifier from $HOME, else it won't know where to find the `data/check` program.
|
||||||
|
# N.B. must be run with `&` + `wait`, else we lose the ability to `trap`.
|
||||||
|
${maybe-notify}env --chdir="$HOME" ${cli} <&0 &
|
||||||
|
wait
|
||||||
|
log "exiting"
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
"${name}".dir = {
|
"${name}".dir = {
|
||||||
"type".text = type;
|
"type".text = type;
|
||||||
|
@ -117,37 +150,8 @@ let
|
||||||
'';
|
'';
|
||||||
"notification-fd".text = maybe (check != null) "3";
|
"notification-fd".text = maybe (check != null) "3";
|
||||||
"producer-for".text = maybe (producerFor != null) producerFor;
|
"producer-for".text = maybe (producerFor != null) producerFor;
|
||||||
"run".executable = maybe (run != null) ''
|
"run".executable = maybe (run != null) (makeAbortable "run" maybe-notify run);
|
||||||
#!/bin/sh
|
"up".executable = maybe (up != null) (makeAbortable "up" "" up);
|
||||||
log() {
|
|
||||||
printf 's6[%s]: %s\n' '${name}' "$1" | tee /dev/stderr
|
|
||||||
}
|
|
||||||
log "preparing"
|
|
||||||
|
|
||||||
# s6 is too gentle when i ask it to stop a service,
|
|
||||||
# so explicitly kill children on exit.
|
|
||||||
# see: <https://stackoverflow.com/a/2173421>
|
|
||||||
# before changing this, test that the new version actually kills a service with `s6-rc down <svcname>`
|
|
||||||
down() {
|
|
||||||
log "trapped on abort signal"
|
|
||||||
# "trap -": to avoid recursing
|
|
||||||
trap - SIGINT SIGQUIT SIGTERM
|
|
||||||
log "killing process group"
|
|
||||||
# "kill 0" means kill the current process group (i.e. all descendants)
|
|
||||||
kill 0
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
trap down SIGINT SIGQUIT SIGTERM
|
|
||||||
|
|
||||||
log "starting"
|
|
||||||
# run the service from $HOME by default.
|
|
||||||
# particularly, this impacts things like "what directory does my terminal open in".
|
|
||||||
# N.B. do not run the notifier from $HOME, else it won't know where to find the `data/check` program.
|
|
||||||
# N.B. must be run with `&` + `wait`, else we lose the ability to `trap`.
|
|
||||||
${maybe-notify}env --chdir="$HOME" ${run} <&0 &
|
|
||||||
wait
|
|
||||||
log "exiting"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,13 +238,15 @@ let
|
||||||
lib.filterAttrs (_: cfg: lib.elem name cfg.dependencyOf) services
|
lib.filterAttrs (_: cfg: lib.elem name cfg.dependencyOf) services
|
||||||
);
|
);
|
||||||
finish = service.cleanupCommand;
|
finish = service.cleanupCommand;
|
||||||
inherit (if service.startCommand != null then
|
run = service.command;
|
||||||
{ type="oneshot"; run = service.startCommand; }
|
up = service.startCommand;
|
||||||
else if service.command != null then
|
type = if service.startCommand != null then
|
||||||
{ type="longshot"; run = service.command; }
|
"oneshot"
|
||||||
else
|
else if service.command != null then
|
||||||
{ type="bundle"; run = null; }
|
"longrun"
|
||||||
) type run;
|
else
|
||||||
|
"bundle"
|
||||||
|
;
|
||||||
})
|
})
|
||||||
services
|
services
|
||||||
;
|
;
|
||||||
|
|
|
@ -1862,10 +1862,15 @@ in with final; {
|
||||||
let
|
let
|
||||||
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
|
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
|
||||||
in {
|
in {
|
||||||
|
# blueprint-compiler runs on the build machine, but tries to load gobject-introspection types meant for the host.
|
||||||
postPatch = (upstream.postPatch or "") + ''
|
postPatch = (upstream.postPatch or "") + ''
|
||||||
substituteInPlace build-aux/cargo.sh --replace \
|
substituteInPlace src/meson.build \
|
||||||
'OUTPUT_BIN="$CARGO_TARGET_DIR"' \
|
--replace-fail \
|
||||||
'OUTPUT_BIN="$CARGO_TARGET_DIR/${rustTargetPlatform}"'
|
"find_program('blueprint-compiler')" \
|
||||||
|
"'env', 'GI_TYPELIB_PATH=${buildPackages.gdk-pixbuf.out}/lib/girepository-1.0:${buildPackages.harfbuzz.out}/lib/girepository-1.0:${buildPackages.gtk4.out}/lib/girepository-1.0:${buildPackages.graphene}/lib/girepository-1.0:${buildPackages.libadwaita}/lib/girepository-1.0:${buildPackages.pango.out}/lib/girepository-1.0', find_program('blueprint-compiler')" \
|
||||||
|
--replace-fail \
|
||||||
|
"meson.project_build_root() / cargo_output" \
|
||||||
|
"meson.project_build_root() / 'src' / '${rust.envVars.rustHostPlatformSpec}' / rust_target / meson.project_name()"
|
||||||
'';
|
'';
|
||||||
# nixpkgs sets CARGO_BUILD_TARGET to the build platform target, so correct that.
|
# nixpkgs sets CARGO_BUILD_TARGET to the build platform target, so correct that.
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|
Loading…
Reference in New Issue