diff --git a/flake.nix b/flake.nix index ef7376a..a7089b2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - outputs = { + outputs = inputs @ { self, nixpkgs, nix-on-droid, @@ -8,10 +8,18 @@ home-manager, sops-nix, ... - } @ inputs: let + }: let + username = "joy"; + domain = "joygnu.org"; + mail = "contact@joygnu.org"; systemConfig = {modules}: nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + specialArgs = { + inherit inputs; + inherit username; + inherit domain; + inherit mail; + }; modules = modules ++ [home-manager.nixosModules.default sops-nix.nixosModules.sops]; }; in { diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 618441f..273940b 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -1,10 +1,12 @@ -{ +{username, ...}: { networking.hostName = "laptop"; led.enable = true; gnome.enable = true; - home-manager.users.joy.code.enable = true; - home-manager.users.joy.hypridle.enable = true; + home-manager.users.${username} = { + code.enable = true; + hypridle.enable = true; + }; imports = [ ./hardware.nix diff --git a/modules/games/emulator/default.nix b/modules/games/emulator/default.nix index 9ec168f..6254ba1 100644 --- a/modules/games/emulator/default.nix +++ b/modules/games/emulator/default.nix @@ -2,6 +2,7 @@ pkgs, lib, config, + username, ... }: let customPkgs = @@ -24,7 +25,7 @@ in { customPkgs.suyu ]; - home-manager.users.joy.xdg = { + home-manager.users.${username}.xdg = { desktopEntries = { suyu = { name = "Suyu"; diff --git a/modules/games/norisk/default.nix b/modules/games/norisk/default.nix index e45a364..49c0774 100644 --- a/modules/games/norisk/default.nix +++ b/modules/games/norisk/default.nix @@ -2,6 +2,7 @@ lib, config, pkgs, + username, ... }: let customPkgs = @@ -25,7 +26,7 @@ in { customPkgs.noriskclient ]; - home-manager.users.joy.xdg = { + home-manager.users.${username}.xdg = { desktopEntries = { NoRiskClient = { name = "NoRisk Client"; diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 6f237d1..9420533 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -1,8 +1,24 @@ -{inputs, ...}: { +{ + inputs, + username, + domain, + ... +}: let + mail = { + a = "contact"; + b = "mail"; + c = "spyware"; + }; +in { home-manager = { - extraSpecialArgs = {inherit inputs;}; + extraSpecialArgs = { + inherit inputs; + inherit username; + inherit mail; + inherit domain; + }; users = { - "joy" = import ./home.nix; + "${username}" = import ./home.nix; "root" = import ./root.nix; }; }; diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix index 58e8dfc..973cff6 100644 --- a/modules/programs/git/default.nix +++ b/modules/programs/git/default.nix @@ -1,8 +1,12 @@ { + mail, + username, + ... +}: { programs.git = { enable = true; - userEmail = "contact@joygnu.org"; - userName = "joygnu"; + userEmail = "${mail.a}"; + userName = "${username}"; extraConfig = { init.defaultBranch = "main"; }; diff --git a/modules/programs/mail/accounts.nix b/modules/programs/mail/accounts.nix deleted file mode 100644 index a17465f..0000000 --- a/modules/programs/mail/accounts.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - accounts.email = { - maildirBasePath = ".local/share/mail"; - - accounts = { - "mail@joygnu.org" = { - primary = true; - address = "mail@joygnu.org"; - userName = "mail"; - realName = "Joy"; - passwordCommand = "cat /run/secrets/mail"; - imap.host = "mail.joygnu.org"; - smtp.host = "mail.joygnu.org"; - }; - "spyware@joygnu.org" = { - address = "spyware@joygnu.org"; - userName = "spyware"; - realName = "Joy"; - passwordCommand = "cat /run/secrets/spyware"; - imap.host = "mail.joygnu.org"; - smtp.host = "mail.joygnu.org"; - }; - "contact@joygnu.org" = { - address = "contact@joygnu.org"; - userName = "contact"; - realName = "Joy"; - passwordCommand = "cat /run/secrets/contact"; - imap.host = "mail.joygnu.org"; - smtp.host = "mail.joygnu.org"; - }; - }; - }; -} diff --git a/modules/programs/mail/default.nix b/modules/programs/mail/default.nix index 1f88db8..c0aa377 100644 --- a/modules/programs/mail/default.nix +++ b/modules/programs/mail/default.nix @@ -1,59 +1,207 @@ -let - muttrc = builtins.readFile (./. + "/muttrc"); -in { - accounts.email.accounts = { - "mail@joygnu.org" = { - imap.port = 993; - mbsync.enable = true; - mbsync.create = "both"; - neomutt = { - enable = true; - extraMailboxes = [ - {mailbox = "Sent";} - {mailbox = "Junk";} - {mailbox = "Trash";} - {mailbox = "Drafts";} - ]; - }; - }; - "spyware@joygnu.org" = { - imap.port = 993; - mbsync.enable = true; - mbsync.create = "both"; - neomutt = { - enable = true; - extraMailboxes = [ - {mailbox = "Sent";} - {mailbox = "Junk";} - {mailbox = "Trash";} - {mailbox = "Drafts";} - ]; - }; - }; - "contact@joygnu.org" = { - imap.port = 993; - mbsync.enable = true; - mbsync.create = "both"; - neomutt = { - enable = true; - extraMailboxes = [ - {mailbox = "Sent";} - {mailbox = "Junk";} - {mailbox = "Trash";} - {mailbox = "Drafts";} - ]; - }; - }; - }; +{ + username, + mail, + domain, + ... +}: { programs.mbsync = { enable = true; }; + accounts.email = { + maildirBasePath = ".local/share/mail"; + + accounts = { + "${mail.a}@${domain}" = { + address = "${mail.a}@${domain}"; + userName = "${mail.a}"; + realName = "${username}"; + passwordCommand = "cat /run/secrets/contact"; + imap.host = "mail.${domain}"; + smtp.host = "mail.${domain}"; + imap.port = 993; + mbsync.enable = true; + mbsync.create = "both"; + neomutt = { + enable = true; + extraMailboxes = [ + {mailbox = "Sent";} + {mailbox = "Junk";} + {mailbox = "Trash";} + {mailbox = "Drafts";} + ]; + }; + }; + "${mail.b}@${domain}" = { + primary = true; + address = "${mail.b}@${domain}"; + userName = "${mail.b}"; + realName = "${username}"; + passwordCommand = "cat /run/secrets/mail"; + imap.host = "mail.${domain}"; + smtp.host = "mail.${domain}"; + imap.port = 993; + mbsync.enable = true; + mbsync.create = "both"; + neomutt = { + enable = true; + extraMailboxes = [ + {mailbox = "Sent";} + {mailbox = "Junk";} + {mailbox = "Trash";} + {mailbox = "Drafts";} + ]; + }; + }; + "${mail.c}@${domain}" = { + address = "${mail.c}@${domain}"; + userName = "${mail.c}"; + realName = "${username}"; + passwordCommand = "cat /run/secrets/spyware"; + imap.host = "mail.${domain}"; + smtp.host = "mail.${domain}"; + imap.port = 993; + mbsync.enable = true; + mbsync.create = "both"; + neomutt = { + enable = true; + extraMailboxes = [ + {mailbox = "Sent";} + {mailbox = "Junk";} + {mailbox = "Trash";} + {mailbox = "Drafts";} + ]; + }; + }; + }; + }; programs.neomutt = { enable = true; editor = "hx"; - extraConfig = muttrc; - }; + extraConfig = '' bind index i noop + bind pager i noop + macro index,pager i1 'source /home/${username}/.config/neomutt/${mail.a}@${domain}!;' "switch to ${mail.a}@${domain}" + macro index,pager i2 'source /home/${username}/.config/neomutt/${mail.b}@${domain}!;' "switch to ${mail.b}@${domain}" + macro index,pager i3 'source /home/${username}/.config/neomutt/${mail.c}@${domain}!;' "switch to ${mail.c}@${domain}" - imports = [./accounts.nix]; + # Sidebar mappings + set sidebar_visible = yes + set sidebar_width = 20 + set sidebar_short_path = yes + set sidebar_next_new_wrap = yes + set mail_check_stats + set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' + bind index,pager \Ck sidebar-prev + bind index,pager \Cj sidebar-next + bind index,pager \Co sidebar-open + bind index,pager \Cp sidebar-prev-new + bind index,pager \Cn sidebar-next-new + bind index,pager B sidebar-toggle-visible + + + color normal white black + color error brightwhite default + color status white brightblack + color sidebar_highlight blue default + + # Default index colors + color index white black '.*' + color index_author blue default '.*' + color index_number blue default + color index_subject white default '.*' + + # New mail + color index brightwhite brightblack "~N" + color index_author brightblue brightblack "~N" + color index_subject brightwhite brightblack "~N" + + # Tagged mail + color index brightwhite blue "~T" + color index_author brightblue blue "~T" + color index_subject brightwhite blue "~T" + + # Other colors and aesthetic settings + mono bold bold + mono underline underline + mono indicator reverse + mono error bold + color indicator brightblack white + color sidebar_divider brightblack black + color sidebar_flagged blue black + color sidebar_new white black + color normal white default + color message cyan default + color markers brightwhite white + color attachment white default + color search cyan default + color hdrdefault brightgreen default + + # Quoted text + color quoted white default + color quoted1 blue default + color quoted2 cyan default + color quoted3 brightwhite default + color quoted4 brightblue default + color quoted5 brightcyan default + + # Signature + color signature brightgreen default + + # Bold and Underline + color bold black default + color underline black default + + bind index,pager g noop + bind index \Cf noop + bind index,pager M noop + bind index,pager C noop + + # General rebindings + bind index gg first-entry + bind index j next-entry + bind index k previous-entry + bind attach view-mailcap + bind attach l view-mailcap + bind index G last-entry + bind index gg first-entry + bind pager,attach h exit + bind pager j next-line + bind pager k previous-line + bind pager l view-attachments + bind index D delete-message + bind index U undelete-message + bind index L limit + bind index h noop + bind index l display-message + bind index,query tag-entry + #bind browser h goto-parent + macro browser h '..' "Go to parent folder" + bind index,pager H view-raw-message + bind browser l select-entry + bind pager,browser gg top-page + bind pager,browser G bottom-page + bind index,pager,browser d half-down + bind index,pager,browser u half-up + bind index,pager S sync-mailbox + bind index,pager R group-reply + + macro index,pager gi "=Inbox" "go to inbox" + macro index,pager Mi ";=Inbox" "move mail to inbox" + macro index,pager Ci ";=Inbox" "copy mail to inbox" + macro index,pager gd "=Drafts" "go to drafts" + macro index,pager Md ";=Drafts" "move mail to drafts" + macro index,pager Cd ";=Drafts" "copy mail to drafts" + macro index,pager gj "=Junk" "go to junk" + macro index,pager Mj ";=Junk" "move mail to junk" + macro index,pager Cj ";=Junk" "copy mail to junk" + macro index,pager gt "=Trash" "go to trash" + macro index,pager Mt ";=Trash" "move mail to trash" + macro index,pager Ct ";=Trash" "copy mail to trash" + macro index,pager gs "=Sent" "go to sent" + macro index,pager Ms ";=Sent" "move mail to sent" + macro index,pager Cs ";=Sent" "copy mail to sent" + macro index,pager ga "=Archive" "go to archive" + macro index,pager Ma ";=Archive" "move mail to archive" + macro index,pager Ca ";=Archive" "copy mail to archive"''; + }; } diff --git a/modules/programs/mail/muttrc b/modules/programs/mail/muttrc deleted file mode 100644 index 63d3e9a..0000000 --- a/modules/programs/mail/muttrc +++ /dev/null @@ -1,125 +0,0 @@ -bind index i noop -bind pager i noop -macro index,pager i1 'source /home/joy/.config/neomutt/contact@joygnu.org!;' "switch to contact@joygnu.org" -macro index,pager i2 'source /home/joy/.config/neomutt/mail@joygnu.org!;' "switch to mail@joygnu.org" -macro index,pager i3 'source /home/joy/.config/neomutt/spyware@joygnu.org!;' "switch to spyware@joygnu.org" - -# Sidebar mappings -set sidebar_visible = yes -set sidebar_width = 20 -set sidebar_short_path = yes -set sidebar_next_new_wrap = yes -set mail_check_stats -set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' -bind index,pager \Ck sidebar-prev -bind index,pager \Cj sidebar-next -bind index,pager \Co sidebar-open -bind index,pager \Cp sidebar-prev-new -bind index,pager \Cn sidebar-next-new -bind index,pager B sidebar-toggle-visible - - -color normal white black -color error brightwhite default -color status white brightblack -color sidebar_highlight blue default - -# Default index colors -color index white black '.*' -color index_author blue default '.*' -color index_number blue default -color index_subject white default '.*' - -# New mail -color index brightwhite brightblack "~N" -color index_author brightblue brightblack "~N" -color index_subject brightwhite brightblack "~N" - -# Tagged mail -color index brightwhite blue "~T" -color index_author brightblue blue "~T" -color index_subject brightwhite blue "~T" - -# Other colors and aesthetic settings -mono bold bold -mono underline underline -mono indicator reverse -mono error bold -color indicator brightblack white -color sidebar_divider brightblack black -color sidebar_flagged blue black -color sidebar_new white black -color normal white default -color message cyan default -color markers brightwhite white -color attachment white default -color search cyan default -color hdrdefault brightgreen default - -# Quoted text -color quoted white default -color quoted1 blue default -color quoted2 cyan default -color quoted3 brightwhite default -color quoted4 brightblue default -color quoted5 brightcyan default - -# Signature -color signature brightgreen default - -# Bold and Underline -color bold black default -color underline black default - -bind index,pager g noop -bind index \Cf noop -bind index,pager M noop -bind index,pager C noop - -# General rebindings -bind index gg first-entry -bind index j next-entry -bind index k previous-entry -bind attach view-mailcap -bind attach l view-mailcap -bind index G last-entry -bind index gg first-entry -bind pager,attach h exit -bind pager j next-line -bind pager k previous-line -bind pager l view-attachments -bind index D delete-message -bind index U undelete-message -bind index L limit -bind index h noop -bind index l display-message -bind index,query tag-entry -#bind browser h goto-parent -macro browser h '..' "Go to parent folder" -bind index,pager H view-raw-message -bind browser l select-entry -bind pager,browser gg top-page -bind pager,browser G bottom-page -bind index,pager,browser d half-down -bind index,pager,browser u half-up -bind index,pager S sync-mailbox -bind index,pager R group-reply - -macro index,pager gi "=Inbox" "go to inbox" -macro index,pager Mi ";=Inbox" "move mail to inbox" -macro index,pager Ci ";=Inbox" "copy mail to inbox" -macro index,pager gd "=Drafts" "go to drafts" -macro index,pager Md ";=Drafts" "move mail to drafts" -macro index,pager Cd ";=Drafts" "copy mail to drafts" -macro index,pager gj "=Junk" "go to junk" -macro index,pager Mj ";=Junk" "move mail to junk" -macro index,pager Cj ";=Junk" "copy mail to junk" -macro index,pager gt "=Trash" "go to trash" -macro index,pager Mt ";=Trash" "move mail to trash" -macro index,pager Ct ";=Trash" "copy mail to trash" -macro index,pager gs "=Sent" "go to sent" -macro index,pager Ms ";=Sent" "move mail to sent" -macro index,pager Cs ";=Sent" "copy mail to sent" -macro index,pager ga "=Archive" "go to archive" -macro index,pager Ma ";=Archive" "move mail to archive" -macro index,pager Ca ";=Archive" "copy mail to archive" diff --git a/modules/programs/newsboat/default.nix b/modules/programs/newsboat/default.nix index 885f568..6bdc9bd 100644 --- a/modules/programs/newsboat/default.nix +++ b/modules/programs/newsboat/default.nix @@ -1,127 +1,127 @@ -{ +{domain, ...}: { programs.newsboat = { enable = true; browser = "firefox"; urls = [ { - url = "https://yt.joygnu.org/feed/channel/UCOSqzSTg4QZXdi7jvV-9rUg"; + url = "https://yt.${domain}/feed/channel/UCOSqzSTg4QZXdi7jvV-9rUg"; } { - url = "https://yt.joygnu.org/feed/channel/UCg6gPGh8HU2U01vaFCAsvmQ"; + url = "https://yt.${domain}/feed/channel/UCg6gPGh8HU2U01vaFCAsvmQ"; } { - url = "https://yt.joygnu.org/feed/channel/UCYAg4bYdyqENxEyHUX7t1FA"; + url = "https://yt.${domain}/feed/channel/UCYAg4bYdyqENxEyHUX7t1FA"; } { - url = "https://yt.joygnu.org/feed/channel/UCVls1GmFKf6WlTraIb_IaJg"; + url = "https://yt.${domain}/feed/channel/UCVls1GmFKf6WlTraIb_IaJg"; } { - url = "https://yt.joygnu.org/feed/channel/UC5KDiSAFxrDWhmysBcNqtMA"; + url = "https://yt.${domain}/feed/channel/UC5KDiSAFxrDWhmysBcNqtMA"; } { - url = "https://yt.joygnu.org/feed/channel/UCcBhwZNKqmPaw3Zk7mh6eBg"; + url = "https://yt.${domain}/feed/channel/UCcBhwZNKqmPaw3Zk7mh6eBg"; } { - url = "https://yt.joygnu.org/feed/channel/UCwnqDLYzLGPbghL9uIOwMnQ"; + url = "https://yt.${domain}/feed/channel/UCwnqDLYzLGPbghL9uIOwMnQ"; } { - url = "https://yt.joygnu.org/feed/channel/UCRSxdcWjoye7ohD_ibxzYhg"; + url = "https://yt.${domain}/feed/channel/UCRSxdcWjoye7ohD_ibxzYhg"; } { - url = "https://yt.joygnu.org/feed/channel/UChIs72whgZI9w6d6FhwGGHA"; + url = "https://yt.${domain}/feed/channel/UChIs72whgZI9w6d6FhwGGHA"; } { - url = "https://yt.joygnu.org/feed/channel/UCxdZ7XCQVMRMipj3gGemQfw"; + url = "https://yt.${domain}/feed/channel/UCxdZ7XCQVMRMipj3gGemQfw"; } { - url = "https://yt.joygnu.org/feed/channel/UC0L2SuL6AK_xtmx82hbqcTw"; + url = "https://yt.${domain}/feed/channel/UC0L2SuL6AK_xtmx82hbqcTw"; } { - url = "https://yt.joygnu.org/feed/channel/UCE_K_gW6ReBi4H3Gp0gi-hg"; + url = "https://yt.${domain}/feed/channel/UCE_K_gW6ReBi4H3Gp0gi-hg"; } { - url = "https://yt.joygnu.org/feed/channel/UCWRHrWUsjdF86dt7NKK2Ixw"; + url = "https://yt.${domain}/feed/channel/UCWRHrWUsjdF86dt7NKK2Ixw"; } { - url = "https://yt.joygnu.org/feed/channel/UCfeNmPbGRF6dkPt04HIl25A"; + url = "https://yt.${domain}/feed/channel/UCfeNmPbGRF6dkPt04HIl25A"; } { - url = "https://yt.joygnu.org/feed/channel/UCFzUEe9XUlkDLp6AmtNzmOA"; + url = "https://yt.${domain}/feed/channel/UCFzUEe9XUlkDLp6AmtNzmOA"; } { - url = "https://yt.joygnu.org/feed/channel/UCxBfQGaMuiMyw1dgW-tpZbg"; + url = "https://yt.${domain}/feed/channel/UCxBfQGaMuiMyw1dgW-tpZbg"; } { - url = "https://yt.joygnu.org/feed/channel/UCpes6DXY4XCSA8s9Q1G9ocg"; + url = "https://yt.${domain}/feed/channel/UCpes6DXY4XCSA8s9Q1G9ocg"; } { - url = "https://yt.joygnu.org/feed/channel/UCR42P1Uub9py2H5RkdcTnWA"; + url = "https://yt.${domain}/feed/channel/UCR42P1Uub9py2H5RkdcTnWA"; } { - url = "https://yt.joygnu.org/feed/channel/UCtwjD3551TskyUxnfaUw7Rg"; + url = "https://yt.${domain}/feed/channel/UCtwjD3551TskyUxnfaUw7Rg"; } { - url = "https://yt.joygnu.org/feed/channel/UCZpKTYOk5WAdCyMal3J1KHg"; + url = "https://yt.${domain}/feed/channel/UCZpKTYOk5WAdCyMal3J1KHg"; } { - url = "https://yt.joygnu.org/feed/channel/UCl2mFZoRqjw_ELax4Yisf6w"; + url = "https://yt.${domain}/feed/channel/UCl2mFZoRqjw_ELax4Yisf6w"; } { - url = "https://yt.joygnu.org/feed/channel/UC2eYFnH61tmytImy1mTYvhA"; + url = "https://yt.${domain}/feed/channel/UC2eYFnH61tmytImy1mTYvhA"; } { - url = "https://yt.joygnu.org/feed/channel/UC7YOGHUfC1Tb6E4pudI9STA"; + url = "https://yt.${domain}/feed/channel/UC7YOGHUfC1Tb6E4pudI9STA"; } { - url = "https://yt.joygnu.org/feed/channel/UC0sUzmZ0CHvVCVrpRfGKZfw"; + url = "https://yt.${domain}/feed/channel/UC0sUzmZ0CHvVCVrpRfGKZfw"; } { - url = "https://yt.joygnu.org/feed/channel/UCFFfGA991VRR4U8FNNs72Qg"; + url = "https://yt.${domain}/feed/channel/UCFFfGA991VRR4U8FNNs72Qg"; } { - url = "https://yt.joygnu.org/feed/channel/UCIS-e4W5wK2xG6NbI5Tdm_g"; + url = "https://yt.${domain}/feed/channel/UCIS-e4W5wK2xG6NbI5Tdm_g"; } { - url = "https://yt.joygnu.org/feed/channel/UCKmEAsezQ0kUQ6EC-BtBNbg"; + url = "https://yt.${domain}/feed/channel/UCKmEAsezQ0kUQ6EC-BtBNbg"; } { - url = "https://yt.joygnu.org/feed/channel/UCgj6MvuVmp0JVanAZkFQM5A"; + url = "https://yt.${domain}/feed/channel/UCgj6MvuVmp0JVanAZkFQM5A"; } { - url = "https://yt.joygnu.org/feed/channel/UCXQZRyhGN-1F8zwD0a8QuWA"; + url = "https://yt.${domain}/feed/channel/UCXQZRyhGN-1F8zwD0a8QuWA"; } { - url = "https://yt.joygnu.org/feed/channel/UCohllq0Pk5lQuuNANabHKcg"; + url = "https://yt.${domain}/feed/channel/UCohllq0Pk5lQuuNANabHKcg"; } { - url = "https://yt.joygnu.org/feed/channel/UCUKU3fl8z2rcK7GBdocd7Ww"; + url = "https://yt.${domain}/feed/channel/UCUKU3fl8z2rcK7GBdocd7Ww"; } { - url = "https://yt.joygnu.org/feed/channel/UCO57urWt8_T63SPFCA_QmNw"; + url = "https://yt.${domain}/feed/channel/UCO57urWt8_T63SPFCA_QmNw"; } { - url = "https://yt.joygnu.org/feed/channel/UCE972BOwKeCHsgfKV3NxEZA"; + url = "https://yt.${domain}/feed/channel/UCE972BOwKeCHsgfKV3NxEZA"; } { - url = "https://yt.joygnu.org/feed/channel/UCtMVHI3AJD4Qk4hcbZnI9ZQ"; + url = "https://yt.${domain}/feed/channel/UCtMVHI3AJD4Qk4hcbZnI9ZQ"; } { - url = "https://yt.joygnu.org/feed/channel/UC8ENHE5xdFSwx71u3fDH5Xw"; + url = "https://yt.${domain}/feed/channel/UC8ENHE5xdFSwx71u3fDH5Xw"; } { - url = "https://yt.joygnu.org/feed/channel/UCMXLdjrQi4JzY0NNvCdUEUQ"; + url = "https://yt.${domain}/feed/channel/UCMXLdjrQi4JzY0NNvCdUEUQ"; } { - url = "https://yt.joygnu.org/feed/channel/UCEKtvLc3EIS0T7shmgPbVrw"; + url = "https://yt.${domain}/feed/channel/UCEKtvLc3EIS0T7shmgPbVrw"; } { - url = "https://yt.joygnu.org/feed/channel/UC_zBdZ0_H_jn41FDRG7q4Tw"; + url = "https://yt.${domain}/feed/channel/UC_zBdZ0_H_jn41FDRG7q4Tw"; } { - url = "https://yt.joygnu.org/feed/channel/UChuDUAo3Hfr_0dn54GpwdUQ"; + url = "https://yt.${domain}/feed/channel/UChuDUAo3Hfr_0dn54GpwdUQ"; } { - url = "https://yt.joygnu.org/feed/channel/UClonyx8pReBvkjropmrS6jQ"; + url = "https://yt.${domain}/feed/channel/UClonyx8pReBvkjropmrS6jQ"; } ]; extraConfig = '' diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 9eb08d2..5da3074 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + pkgs, + domain, + username, + ... +}: { programs.zsh = { enable = true; syntaxHighlighting.enable = true; @@ -15,7 +20,7 @@ cat = "bat"; lg = "${pkgs.lazygit}/bin/lazygit"; rs = "z ~ && ssh root@45.145.42.193"; - hs = "z ~ && ssh joy@joygnu.org"; + hs = "z ~ && ssh ${username}@${domain}"; su = "z ~ && su"; ip = "sh ~/nix/modules/programs/zsh/scripts/ip.sh"; rb = "sh ~/nix/modules/programs/zsh/scripts/rebuild.sh"; diff --git a/modules/secrets/default.nix b/modules/secrets/default.nix index 8f8966c..afb3eb7 100644 --- a/modules/secrets/default.nix +++ b/modules/secrets/default.nix @@ -1,16 +1,16 @@ -{ +{username, ...}: { sops.defaultSopsFile = ./secrets.yaml; sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = "/home/joy/.config/age/keys.txt"; + sops.age.keyFile = "/home/${username}/.config/age/keys.txt"; sops.secrets.mail = { - owner = "joy"; + owner = username; }; sops.secrets.spyware = { - owner = "joy"; + owner = username; }; sops.secrets.contact = { - owner = "joy"; + owner = username; }; } diff --git a/modules/services/docker/default.nix b/modules/services/docker/default.nix index 3b16170..9a9730b 100644 --- a/modules/services/docker/default.nix +++ b/modules/services/docker/default.nix @@ -1,5 +1,5 @@ -{ +{username, ...}: { virtualisation.docker.rootless.enable = true; virtualisation.docker.enable = true; - users.users.joy.extraGroups = ["docker"]; + users.users.${username}.extraGroups = ["docker"]; } diff --git a/modules/services/forgejo/default.nix b/modules/services/forgejo/default.nix index e82960f..ccb36ec 100644 --- a/modules/services/forgejo/default.nix +++ b/modules/services/forgejo/default.nix @@ -1,4 +1,8 @@ -{config, ...}: let +{ + config, + domain, + ... +}: let cfg = config.services.forgejo; srv = cfg.settings.server; in { @@ -18,7 +22,7 @@ in { lfs.enable = true; settings = { server = { - DOMAIN = "git.joygnu.org"; + DOMAIN = "git.${domain}"; ROOT_URL = "https://${srv.DOMAIN}/"; HTTP_PORT = 2000; }; diff --git a/modules/services/immich/default.nix b/modules/services/immich/default.nix index f06e7bb..d81bb01 100644 --- a/modules/services/immich/default.nix +++ b/modules/services/immich/default.nix @@ -1,6 +1,6 @@ -{ +{domain, ...}: { services.nginx = { - virtualHosts."immich.joygnu.org" = { + virtualHosts."immich.${domain}" = { forceSSL = true; enableACME = true; extraConfig = '' diff --git a/modules/services/invidious/default.nix b/modules/services/invidious/default.nix index b9b1780..36df0ee 100644 --- a/modules/services/invidious/default.nix +++ b/modules/services/invidious/default.nix @@ -1,4 +1,8 @@ { + domain, + mail, + ... +}: { services.invidious = { enable = true; settings = { @@ -8,8 +12,8 @@ }; }; }; - services.invidious.domain = "yt.joygnu.org"; + services.invidious.domain = "yt.${domain}"; services.invidious.nginx.enable = true; - security.acme.defaults.email = "contact@joygnu.org"; + security.acme.defaults.email = "${mail}"; security.acme.acceptTerms = true; } diff --git a/modules/services/nginx/default.nix b/modules/services/nginx/default.nix index d66018e..631bdea 100644 --- a/modules/services/nginx/default.nix +++ b/modules/services/nginx/default.nix @@ -1,42 +1,39 @@ -{ +{domain, ...}: { services.nginx = { virtualHosts."xn--xck.xyz" = { forceSSL = true; enableACME = true; - root = "/var/www/www.joygnu.org"; + root = "/var/www/${domain}"; }; - virtualHosts."joygnu.org" = { + virtualHosts."${domain}" = { forceSSL = true; enableACME = true; - root = "/var/www/www.joygnu.org"; + root = "/var/www/www.${domain}"; }; - virtualHosts."www.joygnu.org" = { + virtualHosts."www.${domain}" = { forceSSL = true; enableACME = true; - root = "/var/www/www.joygnu.org"; + root = "/var/www/${domain}"; }; - virtualHosts."4get.joygnu.org" = { + virtualHosts."4get.${domain}" = { forceSSL = true; enableACME = true; locations."/".proxyPass = "http://localhost:8080"; }; - virtualHosts."pin.joygnu.org" = { + virtualHosts."pin.${domain}" = { forceSSL = true; enableACME = true; locations."/".proxyPass = "http://localhost:6060"; }; - virtualHosts."trans.joygnu.org" = { + virtualHosts."trans.${domain}" = { forceSSL = true; enableACME = true; locations."/".proxyPass = "http://localhost:5000"; }; - virtualHosts."wallpapers.joygnu.org" = { + virtualHosts."wallpapers.${domain}" = { forceSSL = true; enableACME = true; - root = "/var/www/wallpapers.joygnu.org"; + root = "/var/www/${domain}"; }; }; - security.acme.certs = { - "www.joygnu.org".email = "contact@joygnu.org"; - }; } diff --git a/modules/services/ssh/default.nix b/modules/services/ssh/default.nix index cca8282..4e67b20 100644 --- a/modules/services/ssh/default.nix +++ b/modules/services/ssh/default.nix @@ -1,4 +1,4 @@ -{ +{username, ...}: { services.openssh = { enable = true; settings = { @@ -7,7 +7,7 @@ }; }; - users.users.joy = { + users.users.${username} = { isNormalUser = true; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8FnfVKPbbzPmZ3L0KuSMc8GD42rkIoIMay3c/r9zGkMBwRyluwP7OBR7SaTlp/w7iPHom3YwhGYa37HOXp/icSEMvFlYsCQOXWPkf7cNqyhEnycRsMojpKP2a6qxvcnuuCLY+xMwtlsX1h4nJFpsWHb2A62qBgdaOVrBlbVGd2ZuVCgiB+eenVagW3EFAO9jK5r6rSFciND7EMxBKfi6DbRma6UCejwGjpU0AHCZDikw5XKFhLUDbhdb9e02gyQxD5cs4Q2CuZ1PVt+Jb1GwHVnfh3wdEz5v7TWF+RUv85JXlRLrIYd2SEDpA6yvQIIT4YR2Bb1Tc/aC+zTdUdP+HMiBI32GGyplMfrE1dbj3quTfGN6cJ0TfPFOx7K+0N108fM7mehPtGT/uyB9nnMyYeLO45cgA1wMZZcT4egSvnnqe+6NO7j+zR0whl8+SbIru7HUK2Oa67SzxotQ7D8F27rx02Ie4UJqwbPsZGrxL7TlvNKUXQ4mOINkyE79tIshWncO71O6vJWzaoeYiye0mxc0AP3vYozdV3MgN34+5zscb/o4pwOQtthin8Nf1Y6o6H0poUz5YXYBdEKK/O0Wz3kxT6i/oZWZG7a18xCCKYnF1Jgdr7mfxkizLMkRqYsgM9CS0e0KoVJhu78TmMz8Eip9za1ncvGg3w1ZW6VG/6w==" diff --git a/modules/services/syncthing/default.nix b/modules/services/syncthing/default.nix index c231b69..4b76b3b 100644 --- a/modules/services/syncthing/default.nix +++ b/modules/services/syncthing/default.nix @@ -1,10 +1,14 @@ { + username, + domain, + ... +}: { services.syncthing = { enable = true; - dataDir = "/home/joy"; + dataDir = "/home/${username}"; openDefaultPorts = true; - configDir = "/home/joy/.config/syncthing"; - user = "joy"; + configDir = "/home/${username}/.config/syncthing"; + user = username; group = "users"; guiAddress = "0.0.0.0:8384"; }; @@ -12,7 +16,7 @@ enable = true; recommendedProxySettings = true; recommendedTlsSettings = true; - virtualHosts."sync.joygnu.org" = { + virtualHosts."sync.${domain}" = { enableACME = true; forceSSL = true; locations."/" = { diff --git a/modules/services/vm/default.nix b/modules/services/vm/default.nix index 20b7c77..9b91cec 100644 --- a/modules/services/vm/default.nix +++ b/modules/services/vm/default.nix @@ -1,7 +1,11 @@ -{pkgs, ...}: { +{ + pkgs, + username, + ... +}: { programs.dconf.enable = true; - users.users.joy.extraGroups = ["libvirtd"]; + users.users.${username}.extraGroups = ["libvirtd"]; environment.systemPackages = with pkgs; [ virt-manager diff --git a/modules/system/doas/default.nix b/modules/system/doas/default.nix index d6c2e2c..8fdc451 100644 --- a/modules/system/doas/default.nix +++ b/modules/system/doas/default.nix @@ -1,9 +1,9 @@ -{ +{username, ...}: { security.doas.enable = true; security.sudo.enable = false; security.doas.extraRules = [ { - users = ["joy"]; + users = [username]; keepEnv = true; persist = true; } diff --git a/modules/system/homemanger/default.nix b/modules/system/homemanger/default.nix index f8afc92..8e1c63b 100644 --- a/modules/system/homemanger/default.nix +++ b/modules/system/homemanger/default.nix @@ -1,11 +1,11 @@ -{ +{username, ...}: { home-manager = { backupFileExtension = "bkp"; - users.joy = { + users.${username} = { programs.home-manager.enable = true; home = { - username = "joy"; - homeDirectory = "/home/joy"; + username = username; + homeDirectory = "/home/" + username; stateVersion = "23.11"; }; }; diff --git a/modules/system/user/default.nix b/modules/system/user/default.nix index e4cba01..d8d815d 100644 --- a/modules/system/user/default.nix +++ b/modules/system/user/default.nix @@ -1,7 +1,7 @@ -{ - users.users.joy = { +{username, ...}: { + users.users.${username} = { isNormalUser = true; - description = "joy"; + description = username; extraGroups = ["wheel" "networkmanager"]; }; } diff --git a/modules/wm/default.nix b/modules/wm/default.nix index ef3915e..0cdf93d 100644 --- a/modules/wm/default.nix +++ b/modules/wm/default.nix @@ -1,16 +1,25 @@ -{inputs, ...}: { +{ + inputs, + username, + domain, + ... +}: { imports = [ - ./hyprland - ./theme - ./gnome - ./polkit - ./syncthing ./gdm + ./gnome + ./hyprland + ./polkit + ./stylix + ./syncthing ]; home-manager = { - extraSpecialArgs = {inherit inputs;}; + extraSpecialArgs = { + inherit inputs; + inherit username; + inherit domain; + }; users = { - "joy" = import ./home; + "${username}" = import ./home; }; }; } diff --git a/modules/wm/gdm/default.nix b/modules/wm/gdm/default.nix index 5db7232..0f4366c 100644 --- a/modules/wm/gdm/default.nix +++ b/modules/wm/gdm/default.nix @@ -1,9 +1,9 @@ -{ +{username, ...}: { services.xserver.enable = true; services.xserver.displayManager.gdm.enable = true; services.displayManager.autoLogin.enable = true; - services.displayManager.autoLogin.user = "joy"; + services.displayManager.autoLogin.user = username; systemd.services."getty@tty1".enable = false; systemd.services."autovt@tty1".enable = false; diff --git a/modules/wm/home/default.nix b/modules/wm/home/default.nix index 8d6d892..ae4dc7b 100644 --- a/modules/wm/home/default.nix +++ b/modules/wm/home/default.nix @@ -11,5 +11,7 @@ ./hypridle ./dunst ./misc + ./qt + ./gtk ]; } diff --git a/modules/wm/home/firefox/default.nix b/modules/wm/home/firefox/default.nix index 3c5f3d7..7be743f 100644 --- a/modules/wm/home/firefox/default.nix +++ b/modules/wm/home/firefox/default.nix @@ -1,9 +1,14 @@ -{inputs, ...}: let +{ + inputs, + username, + domain, + ... +}: let userChrome = builtins.readFile (./. + "/userChrome"); in { programs.firefox = { enable = true; - profiles.joy = { + profiles.${username} = { userChrome = userChrome; extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ ublock-origin @@ -19,7 +24,7 @@ in { "4get" = { urls = [ { - template = "https://4get.joygnu.org/web"; + template = "https://4get.${domain}/web"; params = [ { name = "s"; @@ -57,19 +62,23 @@ in { } { name = "Git"; - url = "https://git.joygnu.org/"; + url = "https://git.${domain}/"; } { name = "Syncserver"; - url = "https://sync.joygnu.org/"; + url = "https://sync.${domain}/"; } { name = "Photos"; - url = "https://immich.joygnu.org/"; + url = "https://immich.${domain}/"; } { name = "Translate"; - url = "https://trans.joygnu.org/"; + url = "https://trans.${domain}/"; + } + { + name = "invidious"; + url = "https://yt.${domain}/"; } { name = "Server"; @@ -107,10 +116,6 @@ in { name = "Syncthing"; url = "http://localhost:8384/"; } - { - name = "invidious"; - url = "https://yt.joygnu.org/"; - } ]; } ]; diff --git a/modules/wm/theme/gtk/default.nix b/modules/wm/home/gtk/default.nix similarity index 77% rename from modules/wm/theme/gtk/default.nix rename to modules/wm/home/gtk/default.nix index 7403a1a..47a0b26 100644 --- a/modules/wm/theme/gtk/default.nix +++ b/modules/wm/home/gtk/default.nix @@ -1,11 +1,11 @@ {pkgs, ...}: let gruvboxPlus = import ./gruvbox-plus.nix {inherit pkgs;}; in { - home-manager.users.joy.home.file = { + home.file = { ".local/share/icons/GruvboxPlus".source = "${gruvboxPlus}"; }; - home-manager.users.joy.gtk = { + gtk = { enable = true; iconTheme.package = gruvboxPlus; iconTheme.name = "GruvboxPlus"; diff --git a/modules/wm/theme/gtk/gruvbox-plus.nix b/modules/wm/home/gtk/gruvbox-plus.nix similarity index 100% rename from modules/wm/theme/gtk/gruvbox-plus.nix rename to modules/wm/home/gtk/gruvbox-plus.nix diff --git a/modules/wm/theme/qt/default.nix b/modules/wm/home/qt/default.nix similarity index 82% rename from modules/wm/theme/qt/default.nix rename to modules/wm/home/qt/default.nix index c7fdc61..1504924 100644 --- a/modules/wm/theme/qt/default.nix +++ b/modules/wm/home/qt/default.nix @@ -1,5 +1,5 @@ {pkgs, ...}: { - home-manager.users.joy.qt = { + qt = { enable = true; style.name = "adwaita-dark"; style.package = pkgs.adwaita-qt; diff --git a/modules/wm/hyprland/default.nix b/modules/wm/hyprland/default.nix index 293c259..c32dee0 100644 --- a/modules/wm/hyprland/default.nix +++ b/modules/wm/hyprland/default.nix @@ -1,9 +1,13 @@ -{pkgs, ...}: { +{ + pkgs, + username, + ... +}: { programs.hyprland = { enable = true; }; - home-manager.users.joy = { + home-manager.users.${username} = { wayland.windowManager.hyprland = { enable = true; settings = { diff --git a/modules/wm/theme/stylix/default.nix b/modules/wm/stylix/default.nix similarity index 91% rename from modules/wm/theme/stylix/default.nix rename to modules/wm/stylix/default.nix index c06f842..3271db1 100644 --- a/modules/wm/theme/stylix/default.nix +++ b/modules/wm/stylix/default.nix @@ -1,6 +1,7 @@ { pkgs, inputs, + username, ... }: let backgroundUrl = "https://wallpapers.joygnu.org/wallpapers/anime/ghibli-japanese-walled-garden.png"; @@ -55,6 +56,8 @@ in { }; }; }; - home-manager.users.joy.stylix.targets.foot.enable = false; - home-manager.users.joy.stylix.targets.hyprland.enable = false; + home-manager.users.${username}.stylix.targets = { + foot.enable = false; + hyprland.enable = false; + }; } diff --git a/modules/wm/syncthing/default.nix b/modules/wm/syncthing/default.nix index 80a1d78..9487fa0 100644 --- a/modules/wm/syncthing/default.nix +++ b/modules/wm/syncthing/default.nix @@ -1,10 +1,10 @@ -{ +{username, ...}: { services.syncthing = { enable = true; - dataDir = "/home/joy"; + dataDir = "/home/${username}"; openDefaultPorts = true; - configDir = "/home/joy/.config/syncthing"; - user = "joy"; + configDir = "/home/${username}/.config/syncthing"; + user = username; group = "users"; }; } diff --git a/modules/wm/theme/default.nix b/modules/wm/theme/default.nix deleted file mode 100644 index a235b09..0000000 --- a/modules/wm/theme/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [ - ./stylix - ./gtk - ./qt - ]; -}