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": {
|
||||
"locked": {
|
||||
"lastModified": 1713963406,
|
||||
"narHash": "sha256-UjESu2rC2UTxXIeYeRQrm6EwEuz8W0i66RMzVP4ocsw=",
|
||||
"lastModified": 1714164575,
|
||||
"narHash": "sha256-qD6v6JaJcEecszEekUsq09lOg4p+C0B4xOjXctKSNSQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "acba655f267a49327f2cea95003f17b8540909c0",
|
||||
"rev": "7d3f4eadec32d447a5f20d87fa309f00986cb288",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -199,11 +199,11 @@
|
|||
},
|
||||
"nixpkgs-unpatched": {
|
||||
"locked": {
|
||||
"lastModified": 1713964117,
|
||||
"narHash": "sha256-OjGULV89fbmD+kSD83ZjSG1sT6rFwI1/Ijjg+amRBys=",
|
||||
"lastModified": 1714163391,
|
||||
"narHash": "sha256-cNFOXSGBex7iuwVvTvLAOyaLJ2JrbpkazhN5sFsBd+E=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1eb9a6980dee3970850f47ba8139c7402f54a9a0",
|
||||
"rev": "0b868df4ced96400774414f5baf30b696215b98f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -223,11 +223,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713950167,
|
||||
"narHash": "sha256-D/Vp8UJDA7t3X/wIHuZosHBTjuWBabeqr6roa2jwnfI=",
|
||||
"lastModified": 1714148467,
|
||||
"narHash": "sha256-490twO3T4EYoQcQ0FuJjnwIdt8eRryNzIq3CVDnRzFw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "80659e4b2805654de851996e682b063a5d7eea5e",
|
||||
"rev": "ca9d278400c170935a95dd75e7e2537c2afd1cb7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -98,7 +98,7 @@ in
|
|||
# "picard" # music tagging
|
||||
# "libsForQt5.plasmatube" # Youtube player
|
||||
"signal-desktop"
|
||||
"spot" # Gnome Spotfy client
|
||||
"spot" # Gnome Spotify client
|
||||
# "sublime-music"
|
||||
# "tdesktop" # broken on phosh
|
||||
# "tokodon"
|
||||
|
|
|
@ -68,7 +68,7 @@ let
|
|||
# - "longrun"
|
||||
# - "bundle"
|
||||
# - "oneshot"?
|
||||
serviceToFs = { name, check, contents, depends, finish, run, type }: let
|
||||
serviceToFs = { name, check, contents, depends, finish, run, up, type }: let
|
||||
logger = serviceToFs' {
|
||||
name = "logger:${name}";
|
||||
consumerFor = name;
|
||||
|
@ -76,10 +76,11 @@ let
|
|||
type = "longrun";
|
||||
};
|
||||
in (serviceToFs' {
|
||||
inherit name check depends finish run type;
|
||||
inherit name check depends finish run type up;
|
||||
contents = maybe (type == "bundle") contents;
|
||||
producerFor = maybe (type != "bundle") "logger:${name}";
|
||||
}) // (lib.optionalAttrs (type != "bundle") logger);
|
||||
# XXX: apparently `oneshot` services can't have loggers: only `longrun` can log.
|
||||
producerFor = maybe (type == "longrun") "logger:${name}";
|
||||
}) // (lib.optionalAttrs (type == "longrun") logger);
|
||||
|
||||
serviceToFs'= {
|
||||
name,
|
||||
|
@ -91,8 +92,40 @@ let
|
|||
finish ? null,
|
||||
producerFor ? null,
|
||||
run ? null,
|
||||
up ? null,
|
||||
}: let
|
||||
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 {
|
||||
"${name}".dir = {
|
||||
"type".text = type;
|
||||
|
@ -117,37 +150,8 @@ let
|
|||
'';
|
||||
"notification-fd".text = maybe (check != null) "3";
|
||||
"producer-for".text = maybe (producerFor != null) producerFor;
|
||||
"run".executable = maybe (run != null) ''
|
||||
#!/bin/sh
|
||||
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"
|
||||
'';
|
||||
"run".executable = maybe (run != null) (makeAbortable "run" maybe-notify run);
|
||||
"up".executable = maybe (up != null) (makeAbortable "up" "" up);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -234,13 +238,15 @@ let
|
|||
lib.filterAttrs (_: cfg: lib.elem name cfg.dependencyOf) services
|
||||
);
|
||||
finish = service.cleanupCommand;
|
||||
inherit (if service.startCommand != null then
|
||||
{ type="oneshot"; run = service.startCommand; }
|
||||
else if service.command != null then
|
||||
{ type="longshot"; run = service.command; }
|
||||
else
|
||||
{ type="bundle"; run = null; }
|
||||
) type run;
|
||||
run = service.command;
|
||||
up = service.startCommand;
|
||||
type = if service.startCommand != null then
|
||||
"oneshot"
|
||||
else if service.command != null then
|
||||
"longrun"
|
||||
else
|
||||
"bundle"
|
||||
;
|
||||
})
|
||||
services
|
||||
;
|
||||
|
|
|
@ -1862,10 +1862,15 @@ in with final; {
|
|||
let
|
||||
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
|
||||
in {
|
||||
# blueprint-compiler runs on the build machine, but tries to load gobject-introspection types meant for the host.
|
||||
postPatch = (upstream.postPatch or "") + ''
|
||||
substituteInPlace build-aux/cargo.sh --replace \
|
||||
'OUTPUT_BIN="$CARGO_TARGET_DIR"' \
|
||||
'OUTPUT_BIN="$CARGO_TARGET_DIR/${rustTargetPlatform}"'
|
||||
substituteInPlace src/meson.build \
|
||||
--replace-fail \
|
||||
"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.
|
||||
buildPhase = ''
|
||||
|
|
Loading…
Reference in New Issue