Compare commits
4 commits
8fd6a0d2d8
...
684d9b4d8b
Author | SHA1 | Date | |
---|---|---|---|
|
684d9b4d8b | ||
|
aceb44293f | ||
|
460ab8938f | ||
|
3335f90de4 |
|
@ -213,6 +213,10 @@
|
|||
system = "x86_64-linux";
|
||||
modules = [ ./abavorana/standin.nix ];
|
||||
};
|
||||
nixosConfigurations.ludwig = lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [ ./ludwig/standin.nix ];
|
||||
};
|
||||
nixosConfigurations.sprinkles = lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [ ./sprinkles/standin.nix ];
|
||||
|
|
|
@ -370,7 +370,11 @@ class Bar(ComposableText):
|
|||
while True:
|
||||
line = await proc.stdout.readline()
|
||||
command = line.decode().strip()
|
||||
callback = self.actions[command]
|
||||
callback = self.actions.get(command)
|
||||
if callback is None:
|
||||
# In some conditions on start it's empty
|
||||
log.error(f"Unknown command: {command}")
|
||||
return
|
||||
callback()
|
||||
|
||||
async with self.taskGroup:
|
||||
|
|
|
@ -19,7 +19,7 @@ from frobar.common import (AlertingProvider, Button, MirrorProvider, Module,
|
|||
MultiSectionsProvider, PeriodicProvider,
|
||||
PeriodicStatefulProvider, Screen, Section,
|
||||
SingleSectionProvider, StatefulSection,
|
||||
StatefulSectionProvider, clip, humanSize, ramp)
|
||||
StatefulSectionProvider, clip, humanSize, log, ramp)
|
||||
|
||||
gi.require_version("Playerctl", "2.0")
|
||||
import gi.repository.Playerctl
|
||||
|
@ -81,7 +81,12 @@ class I3WorkspacesProvider(MultiSectionsProvider):
|
|||
section.setAction(Button.CLICK_LEFT, switch_to_workspace)
|
||||
|
||||
async def update() -> None:
|
||||
workspace = self.workspaces[num]
|
||||
workspace = self.workspaces.get(num)
|
||||
if workspace is None:
|
||||
log.warning(f"Can't find workspace {num}")
|
||||
section.setText("X")
|
||||
return
|
||||
|
||||
name = workspace.name
|
||||
if workspace.urgent:
|
||||
section.color = self.COLOR_URGENT
|
||||
|
|
10
ludwig/standin.nix
Normal file
10
ludwig/standin.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
config = {
|
||||
frogeye = {
|
||||
name = "ludwig";
|
||||
storageSize = "big";
|
||||
syncthing.name = "Ludwig";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -40,17 +40,31 @@ sudo nom build "$derivation^*" --no-link "$@"
|
|||
info "Showing diff"
|
||||
nvd diff "$(readlink -f /nix/var/nix/profiles/system)" "$toplevel"
|
||||
|
||||
# Figure out specialisation
|
||||
specialisationArgs=()
|
||||
info "Figuring current specialisation"
|
||||
systemLink=
|
||||
currentSystem="$(readlink -f /run/current-system)"
|
||||
while read -r specialisation
|
||||
while read -r system
|
||||
do
|
||||
if [ "$(readlink -f "/nix/var/nix/profiles/system/specialisation/$specialisation")" = "$currentSystem" ]
|
||||
if [ "$(readlink -f "$system")" = "$currentSystem" ]
|
||||
then
|
||||
systemLink="$system"
|
||||
break
|
||||
fi
|
||||
done <<< "$(ls -d /nix/var/nix/profiles/system-*-link{,/specialisation/*})"
|
||||
|
||||
specialisationArgs=()
|
||||
if [ -n "$systemLink" ]
|
||||
then
|
||||
specialisation=$(echo "$systemLink" | cut -d/ -f8)
|
||||
if [ -n "$specialisation" ]
|
||||
then
|
||||
debug "Using specialisation: $specialisation"
|
||||
specialisationArgs=("--specialisation" "$specialisation")
|
||||
fi
|
||||
done <<< "$(ls /nix/var/nix/profiles/system/specialisation)"
|
||||
else
|
||||
warning "Could not find link for $currentSystem, will switch to non-specialized system"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Apply
|
||||
confirm="n"
|
||||
|
|
|
@ -24,7 +24,9 @@ let
|
|||
);
|
||||
allDevices = nixosDevices;
|
||||
syncingDevices = builtins.filter (device: device.syncthing.id != null) allDevices;
|
||||
peerDevices = builtins.filter (device: device.name != config.frogeye.name) syncingDevices;
|
||||
peerDevices = builtins.filter (
|
||||
device: device.syncthing.id != config.frogeye.syncthing.id
|
||||
) syncingDevices;
|
||||
|
||||
# Can't use the module's folders enable option, as it still requests things somehow
|
||||
allFolders = builtins.attrValues config.frogeye.folders;
|
||||
|
@ -34,12 +36,58 @@ let
|
|||
folder: device:
|
||||
(lib.hasAttrByPath [ folder.name ] device.folders)
|
||||
&& device.folders.${folder.name}.syncthing.enable;
|
||||
folderDeviceEntry = folder: device: { deviceID = device.syncthing.id; };
|
||||
|
||||
enable = (builtins.length syncedFolders) > 0;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
# Allow to export configuration to other systems
|
||||
system.build.syncthingConfig = {
|
||||
folders = lib.trivial.pipe syncedFolders [
|
||||
(builtins.map (folder: {
|
||||
name = folder.name;
|
||||
value = folder;
|
||||
}))
|
||||
builtins.listToAttrs
|
||||
(lib.attrsets.mapAttrs (
|
||||
folderName: folder:
|
||||
(lib.attrsets.filterAttrs (
|
||||
k: v:
|
||||
builtins.elem k [
|
||||
"label"
|
||||
"path"
|
||||
"syncthing"
|
||||
"user"
|
||||
]
|
||||
))
|
||||
folder
|
||||
))
|
||||
];
|
||||
devices = lib.trivial.pipe syncingDevices [
|
||||
(builtins.map (device: {
|
||||
name = device.name;
|
||||
value = device;
|
||||
}))
|
||||
builtins.listToAttrs
|
||||
(lib.attrsets.mapAttrs (
|
||||
deviceName: device:
|
||||
{
|
||||
folders = lib.trivial.pipe device.folders [
|
||||
(lib.attrsets.filterAttrs (folderName: folder: folder.syncthing.enable))
|
||||
(lib.attrsets.mapAttrs (folderName: folder: { syncthing.enable = true; }))
|
||||
];
|
||||
}
|
||||
//
|
||||
(lib.attrsets.filterAttrs (
|
||||
k: v:
|
||||
builtins.elem k [
|
||||
"syncthing"
|
||||
]
|
||||
))
|
||||
device
|
||||
))
|
||||
];
|
||||
};
|
||||
services.${service} = {
|
||||
inherit enable;
|
||||
openDefaultPorts = true;
|
||||
|
@ -63,8 +111,6 @@ in
|
|||
value = {
|
||||
label = "${capitalizeFirstLetter folder.user} ${folder.label}";
|
||||
path = "${config.users.users.${folder.user}.home}/${folder.path}";
|
||||
# Despite further in the code indicating this is possible, it is, actually not
|
||||
# devices = builtins.map (folderDeviceEntry folder) (builtins.filter (folderShouldSyncWith folder) peerDevices);
|
||||
devices = builtins.map (device: device.name) (
|
||||
builtins.filter (folderShouldSyncWith folder) peerDevices
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue