But the problem is that I don’t know how to configure it, because the packages installed is pretty much untouchable, even with sudo privilege.
Here’s my setup:
In configuration.nix:
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# Get sugar-candy from github in sugar-candy.nix then call it here
(callPackage ./sugar-candy.nix{}).sddm-sugar-candy-theme
libsForQt5.qt5.qtgraphicaleffects #required for sugar candy
];
# Enable sddm and use theme sugar-candy
services.xserver.displayManager.sddm = {
enable = true;
theme = "sugar-candy";
};
}
Change in original sugar-theme.nix (top one)
fetchFromGitHub to fetchurl
replace src=fetchFromGitHub to
src = /path/to_edited_theme/sddm-sugar-candy;
meta = with stdenv.lib; {
try rebuild
Full disclosure - I am no longer using that, as my life became infinitely easier when I decided to simply use the stock themes that come with sddm and kde (and stuff in general).
This caused me many hours of headache because I did not want the bloat of having the full theme as part of my configuration, and only wanted to change some parts of the theme.conf. The solution is painfully simple.
The following does not work, and gives a permission error, as established:
{ stdenvNoCC, fetchFromGitHub, lib, libsForQt5, pkgs }:
stdenvNoCC.mkDerivation rec {
pname = "sddm-rose-pine-theme";
version = "1.2";
dontBuild = true;
propagatedUserEnvPkgs = [ libsForQt5.qt5.qtgraphicaleffects ];
src = fetchFromGitHub {
owner = "lwndhrst";
repo = "sddm-rose-pine";
rev = "v${version}";
sha256 = "+WOdazvkzpOKcoayk36VLq/6lLOHDWkDykDsy8p87JE=";
};
configOverride = builtins.readFile ./sddm-overrides.conf;
installPhase = ''
mkdir -p $out/share/sddm/themes/rose-pine
cp -R $src/* $out/share/sddm/themes/rose-pine/
# This is where we get the error, whether we use echo, cp or anything else
echo "${configOverride}" > $out/share/sddm/themes/rose-pine/theme.conf
'';
}
this is because fetchFromGitHub gives the file it fetches read-only permissions. We could change those permissions, except we can’t because something else throws an error, probably for good reason. So we can’t overwrite the file after we’ve copied it to $out from source. Here’s what we can do though:
{ ... }:
stdenvNoCC.mkDerivation rec {
pname = ...
src = fetchFromGitHub {
...
};
configOverride = builtins.readFile ./sddm-overrides.conf;
installPhase = ''
mkdir -p $out/share/sddm/themes/rose-pine
# First copy the cutom config,
# because once the source is copied the permissions are screwed up
echo "${configOverride}" > $out/share/sddm/themes/rose-pine/theme.conf
# Then copy the source without overriding existing files,
# Leaving our custom config in place
cp -Rn $src/* $out/share/sddm/themes/rose-pine/
'';
}
Simply copy / write the files you want to “overwrite” first, then copy the source files with -n to not overwrite the ones you just copied. I hope this saves some poor soul the hours I spent fiddling with the different phases of the packaging process.