-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/nix-init
- Loading branch information
Showing
12 changed files
with
257 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
let | ||
cfg = config.programs.gnome-shell; | ||
|
||
extensionOpts = { config, ... }: { | ||
options = { | ||
id = mkOption { | ||
type = types.str; | ||
example = "[email protected]"; | ||
description = '' | ||
ID of the GNOME Shell extension. If not provided, it | ||
will be obtained from `package.extensionUuid`. | ||
''; | ||
}; | ||
|
||
package = mkOption { | ||
type = types.package; | ||
example = "pkgs.gnome.gnome-shell-extensions"; | ||
description = '' | ||
Package providing a GNOME Shell extension in | ||
`$out/share/gnome-shell/extensions/''${id}`. | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf (hasAttr "extensionUuid" config.package) { | ||
id = mkDefault config.package.extensionUuid; | ||
}; | ||
}; | ||
|
||
themeOpts = { | ||
options = { | ||
name = mkOption { | ||
type = types.str; | ||
example = "Plata-Noir"; | ||
description = '' | ||
Name of the GNOME Shell theme. | ||
''; | ||
}; | ||
|
||
package = mkOption { | ||
type = types.nullOr types.package; | ||
default = null; | ||
example = literalExpression "pkgs.plata-theme"; | ||
description = '' | ||
Package providing a GNOME Shell theme in | ||
`$out/share/themes/''${name}/gnome-shell`. | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
in { | ||
meta.maintainers = [ maintainers.terlar ]; | ||
|
||
options.programs.gnome-shell = { | ||
enable = mkEnableOption "GNOME Shell customization"; | ||
|
||
extensions = mkOption { | ||
type = types.listOf (types.submodule extensionOpts); | ||
default = [ ]; | ||
example = literalExpression '' | ||
[ | ||
{ package = pkgs.gnomeExtensions.dash-to-panel; } | ||
{ | ||
id = "[email protected]"; | ||
package = pkgs.gnome.gnome-shell-extensions; | ||
} | ||
] | ||
''; | ||
description = '' | ||
List of GNOME Shell extensions. | ||
''; | ||
}; | ||
|
||
theme = mkOption { | ||
type = types.nullOr (types.submodule themeOpts); | ||
default = null; | ||
example = literalExpression '' | ||
{ | ||
name = "Plata-Noir"; | ||
package = pkgs.plata-theme; | ||
} | ||
''; | ||
description = '' | ||
Theme to use for GNOME Shell. | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable (mkMerge [ | ||
(mkIf (cfg.extensions != [ ]) { | ||
dconf.settings."org/gnome/shell" = { | ||
disable-user-extensions = false; | ||
enabled-extensions = catAttrs "id" cfg.extensions; | ||
}; | ||
|
||
home.packages = catAttrs "package" cfg.extensions; | ||
}) | ||
|
||
(mkIf (cfg.theme != null) { | ||
dconf.settings."org/gnome/shell/extensions/user-theme".name = | ||
cfg.theme.name; | ||
|
||
programs.gnome-shell.extensions = [{ | ||
id = "[email protected]"; | ||
package = pkgs.gnome.gnome-shell-extensions; | ||
}]; | ||
|
||
home.packages = [ cfg.theme.package ]; | ||
}) | ||
]); | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[sendemail "hm-account"] | ||
from = "[email protected]" | ||
from = "H. M. Test Jr. <[email protected]>" | ||
smtpEncryption = "tls" | ||
smtpServer = "smtp.example.org" | ||
smtpSslCertPath = "/etc/test/certificates.crt" | ||
smtpUser = "home.manager.jr" | ||
|
||
[sendemail "[email protected]"] | ||
from = "[email protected]" | ||
from = "H. M. Test <[email protected]>" | ||
smtpEncryption = "ssl" | ||
smtpServer = "smtp.example.com" | ||
smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,8 @@ with lib; | |
./git-with-email-expected.conf | ||
} | ||
assertGitConfig "[email protected]" "[email protected]" | ||
assertGitConfig "sendemail.hm-account.from" "[email protected]" | ||
assertGitConfig "[email protected]" "H. M. Test <[email protected]>" | ||
assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. <[email protected]>" | ||
''; | ||
}; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
[sendemail "hm-account"] | ||
from = "[email protected]" | ||
from = "H. M. Test Jr. <[email protected]>" | ||
smtpEncryption = "tls" | ||
smtpServer = "smtp.example.org" | ||
smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" | ||
smtpUser = "home.manager.jr" | ||
|
||
[sendemail "[email protected]"] | ||
envelopeSender = "auto" | ||
from = "[email protected]" | ||
from = "H. M. Test <[email protected]>" | ||
smtpServer = "@msmtp@/bin/msmtp" | ||
|
||
[user] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ with lib; | |
|
||
config = { | ||
accounts.email.accounts."[email protected]".msmtp.enable = true; | ||
|
||
programs.git = { | ||
enable = true; | ||
package = pkgs.gitMinimal; | ||
|
@@ -33,8 +34,8 @@ with lib; | |
assertFileContent home-files/.config/git/config \ | ||
${./git-with-msmtp-expected.conf} | ||
assertGitConfig "[email protected]" "[email protected]" | ||
assertGitConfig "sendemail.hm-account.from" "[email protected]" | ||
assertGitConfig "[email protected]" "H. M. Test <[email protected]>" | ||
assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. <[email protected]>" | ||
assertGitConfig "[email protected]" "${pkgs.msmtp}/bin/msmtp" | ||
assertGitConfig "[email protected]" "auto" | ||
''; | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ gnome-shell = ./gnome-shell.nix; } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
dummy-gnome-shell-extensions = pkgs.runCommand "dummy-package" { } '' | ||
mkdir -p $out/share/gnome-shell/extensions/dummy-package | ||
touch $out/share/gnome-shell/extensions/dummy-package/test | ||
''; | ||
|
||
test-extension = pkgs.runCommand "test-extension" { } '' | ||
mkdir -p $out/share/gnome-shell/extensions/test-extension | ||
touch $out/share/gnome-shell/extensions/test-extension/test | ||
''; | ||
|
||
test-extension-uuid = pkgs.runCommand "test-extension-uuid" { | ||
passthru.extensionUuid = "test-extension-uuid"; | ||
} '' | ||
mkdir -p $out/share/gnome-shell/extensions/test-extension-uuid | ||
touch $out/share/gnome-shell/extensions/test-extension-uuid/test | ||
''; | ||
|
||
test-theme = pkgs.runCommand "test-theme" { } '' | ||
mkdir -p $out/share/themes/Test/gnome-shell | ||
touch $out/share/themes/Test/gnome-shell/test | ||
''; | ||
|
||
expectedEnabledExtensions = [ | ||
"[email protected]" | ||
"test-extension" | ||
"test-extension-uuid" | ||
]; | ||
|
||
actualEnabledExtensions = catAttrs "value" | ||
config.dconf.settings."org/gnome/shell".enabled-extensions.value; | ||
|
||
in { | ||
nixpkgs.overlays = [ | ||
(self: super: { | ||
gnome = super.gnome.overrideScope (gself: gsuper: { | ||
gnome-shell-extensions = dummy-gnome-shell-extensions; | ||
}); | ||
}) | ||
]; | ||
|
||
programs.gnome-shell.enable = true; | ||
|
||
programs.gnome-shell.extensions = [ | ||
{ | ||
id = "test-extension"; | ||
package = test-extension; | ||
} | ||
{ package = test-extension-uuid; } | ||
]; | ||
|
||
programs.gnome-shell.theme = { | ||
name = "Test"; | ||
package = test-theme; | ||
}; | ||
|
||
assertions = [ | ||
{ | ||
assertion = | ||
config.dconf.settings."org/gnome/shell".disable-user-extensions | ||
== false; | ||
message = "Expected disable-user-extensions to be false."; | ||
} | ||
{ | ||
assertion = | ||
all (e: elem e actualEnabledExtensions) expectedEnabledExtensions; | ||
message = '' | ||
Expected enabled-extensions to contain all of: | ||
${toString expectedEnabledExtensions} | ||
But it was: | ||
${toString actualEnabledExtensions} | ||
''; | ||
} | ||
{ | ||
assertion = | ||
config.dconf.settings."org/gnome/shell/extensions/user-theme".name | ||
== "Test"; | ||
message = "Expected extensions/user-theme/name to be 'Test'."; | ||
} | ||
]; | ||
|
||
test.stubs.dconf = { }; | ||
|
||
nmt.script = '' | ||
assertFileExists home-path/share/gnome-shell/extensions/dummy-package/test | ||
assertFileExists home-path/share/gnome-shell/extensions/test-extension/test | ||
assertFileExists home-path/share/gnome-shell/extensions/test-extension-uuid/test | ||
assertFileExists home-path/share/themes/Test/gnome-shell/test | ||
''; | ||
} |