From 327c2010613a9af30028695c40a0ca193c8cd9aa Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Mon, 11 Jan 2021 21:50:18 +0300 Subject: [PATCH] Set up GOA declaratively --- modules/applications/geary.nix | 5 +- modules/default.nix | 2 +- modules/secrets.nix | 4 +- modules/workspace/gnome3.nix | 150 ------------------ modules/workspace/gnome3/accounts.conf | 10 ++ modules/workspace/gnome3/default.nix | 71 +++++++++ .../gnome3/gnome-keyring-template.conf | 84 ++++++++++ modules/workspace/gnome3/nextcloud.source | 31 ++++ 8 files changed, 203 insertions(+), 154 deletions(-) delete mode 100644 modules/workspace/gnome3.nix create mode 100644 modules/workspace/gnome3/accounts.conf create mode 100644 modules/workspace/gnome3/default.nix create mode 100644 modules/workspace/gnome3/gnome-keyring-template.conf create mode 100644 modules/workspace/gnome3/nextcloud.source diff --git a/modules/applications/geary.nix b/modules/applications/geary.nix index 8f46388..cc7d30b 100644 --- a/modules/applications/geary.nix +++ b/modules/applications/geary.nix @@ -65,6 +65,9 @@ in { font-size: 16px; } ''; - xdg.configFile."geary/account_03/geary.ini".text = genIni gearyConfig; + home.activation.geary = '' + mkdir -p "$XDG_CONFIG_HOME/geary/account_03" + $DRY_RUN_CMD ln -sf $VERBOSE_ARG ${builtins.toFile "geary.ini" (genIni gearyConfig)} "$XDG_CONFIG_HOME/geary/account_03/geary.ini" + ''; }; } diff --git a/modules/default.nix b/modules/default.nix index 9475211..a68c815 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -14,7 +14,7 @@ device: ./workspace/i3blocks ./workspace/zsh.nix ./workspace/gtk.nix - ./workspace/gnome3.nix + ./workspace/gnome3 ./workspace/misc.nix ./workspace/kde ./workspace/ssh.nix diff --git a/modules/secrets.nix b/modules/secrets.nix index cf46ad2..3ccff11 100755 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -113,7 +113,7 @@ in { pkgs.writeShellScript "push" "${pkgs.git}/bin/git push origin master" } "$HOME/.password-store/.git/hooks/post-commit" cat $HOME/.password-store/email/balsoft@balsoft.ru.gpg | ${pkgs.gnupg}/bin/gpg --decrypt > /dev/null - sudo systemctl restart '*-secrets.service' '*-envsubst.service' + sudo systemctl start --all '*-secrets.service' '*-envsubst.service' '') ]; @@ -121,7 +121,7 @@ in { users = [ "balsoft" ]; commands = [{ command = - "/run/current-system/sw/bin/systemctl restart '*-secrets.service' '*-envsubst.service'"; + "/run/current-system/sw/bin/systemctl start --all '*-secrets.service' '*-envsubst.service'"; options = [ "NOPASSWD" ]; }]; }]; diff --git a/modules/workspace/gnome3.nix b/modules/workspace/gnome3.nix deleted file mode 100644 index 052d929..0000000 --- a/modules/workspace/gnome3.nix +++ /dev/null @@ -1,150 +0,0 @@ -{ config, pkgs, lib, ... }: { - services.gnome3 = { - core-os-services.enable = true; - core-utilities.enable = true; - sushi.enable = true; - tracker.enable = true; - tracker-miners.enable = true; - gnome-settings-daemon.enable = true; - glib-networking.enable = true; - }; - services.gvfs.enable = true; - services.geoclue2.enable = true; - home-manager.users.balsoft = { - xdg.userDirs.enable = true; - home.activation.gnome-keyring = '' - ln -sf ${config.secrets-envsubst.gnome-keyring} "$XDG_DATA_HOME/keyrings/Default_keyring.keyring" - echo "Default_keyring" > "$XDG_DATA_HOME/keyrings/default" - ''; - dconf.settings = { - "org/gnome/nautilus/icon-view" = { - captions = [ "size" "date_modified" "none" ]; - }; - "org/gnome/nautilus/list-view" = { - default-column-order = [ - "name" - "size" - "type" - "owner" - "group" - "permissions" - "where" - "date_modified" - "date_modified_with_time" - "date_accessed" - "recency" - "starred" - "detailed_type" - ]; - default-visible-columns = [ "name" "size" "date_modified" "starred" ]; - }; - "org/gnome/nautilus/preferences" = { - default-folder-viewer = "list-view"; - executable-text-activation = "display"; - search-filter-time-type = "last_modified"; - search-view = "list-view"; - show-image-thumbnails = "always"; - thumbnail-limit = 10; - }; - - "org/gnome/evince/default" = { - inverted-colors = true; - }; - - "org/gnome/maps" = { - night-mode = true; - transportation-type = "car"; - }; - }; - }; - secrets-envsubst.gnome-keyring = { - owner = "balsoft:users"; - secrets = [ "matrix_token" "matrix_password" "email" "nextcloud" ]; - template = '' - [keyring] - display-name=Default keyring - ctime=1609508068 - mtime=0 - lock-on-idle=false - lock-after=false - - [5] - item-type=0 - display-name=fractal-token - secret=$matrix_token - mtime=1610374847 - ctime=1610374847 - - [5:attribute0] - name=uid - type=string - value=@balsoft:balsoft.ru - - [3] - item-type=0 - display-name=Geary IMAP password - secret=$email - mtime=1610307006 - ctime=1609572471 - - [3:attribute0] - name=host - type=string - value=balsoft.ru - - [3:attribute1] - name=login - type=string - value=balsoft@balsoft.ru - - [3:attribute2] - name=proto - type=string - value=IMAP - - [3:attribute3] - name=xdg:schema - type=string - value=org.gnome.Geary - - [1] - item-type=0 - display-name=GOA owncloud credentials for identity account_1609508064_4 - secret={'password': <'$nextcloud'>} - mtime=1609508086 - ctime=1609508086 - - [1:attribute0] - name=goa-identity - type=string - value=owncloud:gen0:account_1609508064_4 - - [1:attribute1] - name=xdg:schema - type=string - value=org.gnome.OnlineAccounts - - [4] - item-type=0 - display-name=fractal - secret=$matrix_password - mtime=1610374846 - ctime=1610374846 - - [4:attribute0] - name=identity - type=string - value=https://vector.im/ - - [4:attribute1] - name=server - type=string - value=https://balsoft.ru/ - - [4:attribute2] - name=username - type=string - value=balsoft - ''; - }; -} diff --git a/modules/workspace/gnome3/accounts.conf b/modules/workspace/gnome3/accounts.conf new file mode 100644 index 0000000..fae39c1 --- /dev/null +++ b/modules/workspace/gnome3/accounts.conf @@ -0,0 +1,10 @@ +[Account account_1609508064_4] +Provider=owncloud +Identity=balsoft +PresentationIdentity=balsoft@nextcloud.balsoft.ru +CalendarEnabled=true +ContactsEnabled=true +DocumentsEnabled=true +FilesEnabled=true +Uri=https://nextcloud.balsoft.ru/ +AcceptSslErrors=false \ No newline at end of file diff --git a/modules/workspace/gnome3/default.nix b/modules/workspace/gnome3/default.nix new file mode 100644 index 0000000..44e365b --- /dev/null +++ b/modules/workspace/gnome3/default.nix @@ -0,0 +1,71 @@ +{ config, pkgs, lib, ... }: { + services.gnome3 = { + core-os-services.enable = true; + core-utilities.enable = true; + sushi.enable = true; + tracker.enable = true; + tracker-miners.enable = true; + gnome-settings-daemon.enable = true; + glib-networking.enable = true; + }; + services.gvfs.enable = true; + services.geoclue2.enable = true; + home-manager.users.balsoft = { + xdg.userDirs.enable = true; + home.activation.gnome = '' + $DRY_RUN_CMD mkdir -p "$XDG_DATA_HOME/keyrings/Default_keyring" + $DRY_RUN_CMD cp -f ${config.secrets-envsubst.gnome-keyring} "$XDG_DATA_HOME/keyrings/Default_keyring.keyring" + echo "Default_keyring" > "$XDG_DATA_HOME/keyrings/default" + $DRY_RUN_CMD mkdir -p "$XDG_CONFIG_HOME/goa-1.0" + $DRY_RUN_CMD cp -f ${./accounts.conf} "$XDG_CONFIG_HOME/goa-1.0/accounts.conf" + $DRY_RUN_CMD mkdir -p "$XDG_CONFIG_HOME/evolution/sources" + $DRY_RUN_CMD cp -f ${./nextcloud.source} "$XDG_CONFIG_HOME/evolution/sources/nextcloud.source" + ''; + + dconf.settings = { + "org/gnome/nautilus/icon-view" = { + captions = [ "size" "date_modified" "none" ]; + }; + "org/gnome/nautilus/list-view" = { + default-column-order = [ + "name" + "size" + "type" + "owner" + "group" + "permissions" + "where" + "date_modified" + "date_modified_with_time" + "date_accessed" + "recency" + "starred" + "detailed_type" + ]; + default-visible-columns = [ "name" "size" "date_modified" "starred" ]; + }; + "org/gnome/nautilus/preferences" = { + default-folder-viewer = "list-view"; + executable-text-activation = "display"; + search-filter-time-type = "last_modified"; + search-view = "list-view"; + show-image-thumbnails = "always"; + thumbnail-limit = 10; + }; + + "org/gnome/evince/default" = { + inverted-colors = true; + }; + + "org/gnome/maps" = { + night-mode = true; + transportation-type = "car"; + }; + }; + }; + secrets-envsubst.gnome-keyring = { + owner = "balsoft:users"; + secrets = [ "matrix_token" "matrix_password" "email" "nextcloud" ]; + template = builtins.readFile ./gnome-keyring-template.conf; + }; +} diff --git a/modules/workspace/gnome3/gnome-keyring-template.conf b/modules/workspace/gnome3/gnome-keyring-template.conf new file mode 100644 index 0000000..43e4cd5 --- /dev/null +++ b/modules/workspace/gnome3/gnome-keyring-template.conf @@ -0,0 +1,84 @@ +[keyring] +display-name=Default keyring +ctime=1609508068 +mtime=0 +lock-on-idle=false +lock-after=false + +[5] +item-type=0 +display-name=fractal-token +secret=$matrix_token +mtime=1610374847 +ctime=1610374847 + +[5:attribute0] +name=uid +type=string +value=@balsoft:balsoft.ru + +[3] +item-type=0 +display-name=Geary IMAP password +secret=$email +mtime=1610307006 +ctime=1609572471 + +[3:attribute0] +name=host +type=string +value=balsoft.ru + +[3:attribute1] +name=login +type=string +value=balsoft@balsoft.ru + +[3:attribute2] +name=proto +type=string +value=IMAP + +[3:attribute3] +name=xdg:schema +type=string +value=org.gnome.Geary + +[1] +item-type=0 +display-name=GOA owncloud credentials for identity account_1609508064_4 +secret={'password': <'$nextcloud'>} +mtime=1609508086 +ctime=1609508086 + +[1:attribute0] +name=goa-identity +type=string +value=owncloud:gen0:account_1609508064_4 + +[1:attribute1] +name=xdg:schema +type=string +value=org.gnome.OnlineAccounts + +[4] +item-type=0 +display-name=fractal +secret=$matrix_password +mtime=1610374846 +ctime=1610374846 + +[4:attribute0] +name=identity +type=string +value=https://vector.im/ + +[4:attribute1] +name=server +type=string +value=https://balsoft.ru/ + +[4:attribute2] +name=username +type=string +value=balsoft \ No newline at end of file diff --git a/modules/workspace/gnome3/nextcloud.source b/modules/workspace/gnome3/nextcloud.source new file mode 100644 index 0000000..07ac679 --- /dev/null +++ b/modules/workspace/gnome3/nextcloud.source @@ -0,0 +1,31 @@ +[Data Source] +DisplayName=balsoft@nextcloud.balsoft.ru +Enabled=true +Parent= + +[Authentication] +Host= +Method=none +Port=0 +ProxyUid=system-proxy +RememberPassword=true +User= +CredentialName= +IsExternal=true + +[Collection] +BackendName=webdav +CalendarEnabled=true +ContactsEnabled=true +Identity=balsoft +MailEnabled=true +AllowSourcesRename=false +CalendarUrl= +ContactsUrl= + +[GNOME Online Accounts] +AccountId=account_1609508064_4 +CalendarUrl=https://balsoft@nextcloud.balsoft.ru/remote.php/caldav/ +ContactsUrl=https://balsoft@nextcloud.balsoft.ru/remote.php/carddav/ +Name= +Address=