Last active
November 29, 2022 11:35
-
-
Save nakato/88e80dce04d1213ab41f51b1934ea1f5 to your computer and use it in GitHub Desktop.
Example using an overlay on a nixpkgs package used in home-manager with a nixos flake.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | |
home-manager.url = "github:nix-community/home-manager"; | |
home-manager.inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
outputs = | |
{ self | |
, nixpkgs | |
, home-manager | |
, ... | |
}: | |
let | |
lib = nixpkgs.lib; | |
in | |
{ | |
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; | |
formatter.aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.nixpkgs-fmt; | |
nixosConfigurations = { | |
pinixos = nixpkgs.lib.nixosSystem { | |
system = "aarch64-linux"; | |
modules = [ | |
({...}: { | |
users.mutableUsers = false; | |
users.users."demo".isNormalUser = true; | |
}) | |
(home-manager.nixosModules.home-manager { | |
home-manager.useGlobalPkgs = true; | |
# UseGlobalPkgs means nixpkgs override declaration must happen outside of | |
# home-manager, otherwise the override will not be evaluated. | |
home-manager.useUserPackages = true; | |
home-manager.users.demo = import ./user_demo.nix; | |
}) | |
({nixpkgs, ...}: { | |
# See above comment about the overlay | |
nixpkgs.overlays = [ (import ./overlays_mopidy.nix) ]; | |
}) | |
]; | |
}; | |
}; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8f1a91ba660786704dba964953ace077cbab902d Mon Sep 17 00:00:00 2001 | |
From: Mark Greenwood <[email protected]> | |
Date: Sun, 9 Oct 2022 13:00:30 +0100 | |
Subject: [PATCH] Fix dbus exception where algorithm 'plain' is not supported | |
--- | |
mopidy/config/keyring.py | 7 ++++++- | |
1 file changed, 6 insertions(+), 1 deletion(-) | |
diff --git a/mopidy/config/keyring.py b/mopidy/config/keyring.py | |
index 5e1b04dd11..36b1a8acbd 100644 | |
--- a/mopidy/config/keyring.py | |
+++ b/mopidy/config/keyring.py | |
@@ -41,7 +41,12 @@ def fetch(): | |
return [] | |
service = _service(bus) | |
- session = service.OpenSession("plain", EMPTY_STRING)[1] | |
+ try: | |
+ session = service.OpenSession("plain", EMPTY_STRING)[1] | |
+ except dbus.exceptions.DBusException as e: | |
+ logger.debug("%s (%s)", FETCH_ERROR, e) | |
+ return [] | |
+ | |
items, locked = service.SearchItems({"service": "mopidy"}) | |
if not locked and not items: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final: prev: | |
{ | |
/* Pay close attention to what's happening with mopidy in pkgs/top-level/all-packages.nix, as going | |
* directly after overlaying on mopidy leads to a world of confusing pain. Namely the "mopidy-with-extensions" | |
* is being built with the patched mopidy, but the patched version doesn't really get used because it is pulled | |
* in as a library dependency to mopidy-mpd, and ends up with the non-patched version in site-packages. */ | |
/* The mopidy packages are all declared in a custom scope to ensure consistency, as such the scope must be | |
* overriden to update the scope dependencies. So we start by overriding the scope. overrideScope' expects a | |
* function with two arguments, like the overlay, and not like the attrs overrides. */ | |
/* With scope, pay close attention to the name, the "'" in overrideScope' is not a typo. */ | |
mopidyPackages = prev.mopidyPackages.overrideScope' (mopidyFinal: mopidyPrev: { | |
# Inside the scope override, override the mopidy package. | |
mopidy = mopidyPrev.mopidy.overrideAttrs (oldAttrs: | |
let | |
# Patch has already been merged for the release that follows 3.3.0, so check | |
# the version to allow this overlay to be gracefully removed without a hard | |
# break as soon as the next release is made. | |
withDbusPatch = (lib.versionOlder oldAttrs.version "3.3.1"); | |
in | |
{ | |
patches = (oldAttrs.patches or [ ]) | |
++ [ ./overlays_mopidy-dbus-exception.patch ]; | |
}); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config | |
, pkgs | |
, lib | |
, options | |
, ... | |
}: | |
{ | |
home.username = "demo"; | |
home.homeDirectory = "/home/demo"; | |
services.mopidy.enable = true; | |
services.mopidy.extensionPackages = [ mopidy-mpd ]; | |
home.stateVersion = "22.11"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment