refactor: make modules independant and exposed in the flake for outside use
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-08-02 22:32:29 -04:00
parent bc753eb285
commit 24aa4b9842
217 changed files with 2213 additions and 1954 deletions

View file

@ -6,7 +6,7 @@ You might find it weird that most of my config is written in TypeScript.
That's because all my desktops run
[AGS](https://github.com/Aylur/ags)
for UI. Click on
[this](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/modules/ags)
[this](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules/ags)
to see my configuration.
I'm also a victim of Stockholm syndrome at this point and make my scripts
@ -17,10 +17,8 @@ in TypeScript because it's the scripting language I am most comfortable with.
### General
This repo is the complete configuration of machines I own,
running NixOS or Nix. I tend to mix Home-Manager and NixOS
a lot to make my custom modules by using my global vars system
explained
[here](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices)
running NixOS or Nix. Its structure is based on a flake's
[outputs](https://wiki.nixos.org/wiki/Flakes#Output_schema).
### Flake Location
@ -46,6 +44,9 @@ sudo ln -sf /home/matt/.nix /etc/nixos
| `nixOnDroidConfigurations.default` | [Nix-On-Droid](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices/android)'s configuration |
| `packages` | Some custom [packages](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/packages) not available in nixpkgs or modified from it |
| `legacyPackages` | Some custom [package scopes](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/legacyPackages) not available in nixpkgs or modified from it |
| `apps` | Scripts ran from the flake defined [here](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/apps) |
| `homeManagerModules` | [Modules](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/homeManagerModules) made for home-manager |
| `homeManagerModules` | [Modules](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules) made for NixOS systems |
| `formatter` | I format nix code with [alejandra](https://github.com/kamadorueda/alejandra) |
| `devShells.default` | A dev shell to build an ISO from the live-image nixosConfiguration |
| `devShells.ags` | A dev shell to have a NodeJS env when I enter my AGS's config directory |

View file

@ -8,16 +8,15 @@
pkgs,
self,
...
} @ inputs: {
}: {
imports = [
./vars
./modules
./packages.nix
self.nixosModules.borgbackup
home-manager.nixosModules.home-manager
../modules/borgbackup
];
boot.tmp.useTmpfs = true;

View file

@ -4,7 +4,7 @@
enable = true;
defaultFonts = {
emoji = ["Noto Color Emoji"];
monospace = ["Noto Nerd Font"];
monospace = ["JetBrainsMono Nerd Font"];
sansSerif = ["Noto Nerd Font"];
serif = ["Noto Nerd Font"];
};

View file

@ -1,5 +1,6 @@
{
config,
pkgs,
self,
...
}: let
@ -11,12 +12,11 @@ in {
imports = [
./hardware-configuration.nix
../../modules/kmscon.nix
../../modules/sshd.nix
./modules/desktop
self.nixosModules.kmscon
self.nixosModules.plymouth
self.nixosModules.server
];
# State Version: DO NOT CHANGE
@ -50,8 +50,16 @@ in {
# ------------------------------------------------
# `Self` Modules configuration
# ------------------------------------------------
roles.server = {
user = mainUser;
sshd.enable = true;
};
boot.plymouth = {
enable = true;
theme = "steamos";
themePackages = [pkgs.steamdeck-hw-theme];
};
services.kmscon.enable = true;
}

View file

@ -11,24 +11,18 @@ in {
imports = [
./hardware-configuration.nix
../../modules/ags
../../modules/audio.nix
../../modules/kmscon.nix
../../modules/printer.nix
../../modules/ratbag-mice.nix
../../modules/sshd.nix
../../modules/tailscale.nix
./modules/gpu-replay.nix
./modules/nix-gaming.nix
self.nixosModules.adb
self.nixosModules.desktop
self.nixosModules.kmscon
self.nixosModules.server
];
home-manager.users.${mainUser} = {
imports = [
../../home/firefox
self.homeManagerModules.firefox
];
# State Version: DO NOT CHANGE
@ -72,14 +66,23 @@ in {
roles.desktop = {
user = mainUser;
ags.enable = true;
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
displayManager.duplicateScreen = false;
fontSize = 12.5;
};
roles.server = {
user = mainUser;
tailscale.enable = true;
sshd.enable = true;
};
programs.adb = {
enable = true;
user = mainUser;
};
services.kmscon.enable = true;
}

View file

@ -1,4 +1,4 @@
deviceName: {config, ...}: let
deviceName: {config, self, ...}: let
inherit (config.vars) mainUser hostName;
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
@ -9,11 +9,10 @@ in {
imports = [
./hardware-configuration.nix
../../modules/kmscon.nix
../../modules/sshd.nix
../../modules/tailscale.nix
./modules/pcsd.nix
self.nixosModules.kmscon
self.nixosModules.server
];
# State Version: DO NOT CHANGE
@ -57,4 +56,15 @@ in {
};
time.timeZone = "America/Montreal";
# ------------------------------------------------
# `Self` Modules configuration
# ------------------------------------------------
roles.server = {
user = mainUser;
tailscale.enable = true;
sshd.enable = true;
};
services.kmscon.enable = true;
}

View file

@ -11,10 +11,6 @@ in {
imports = [
./hardware-configuration.nix
../../modules/kmscon.nix
../../modules/sshd.nix
../../modules/tailscale.nix
./modules/docker
./modules/jellyfin
./modules/mergerfs.nix
@ -23,6 +19,8 @@ in {
./modules/subtitles
self.nixosModules.docker
self.nixosModules.kmscon
self.nixosModules.server
];
# State Version: DO NOT CHANGE
@ -54,4 +52,15 @@ in {
};
time.timeZone = "America/Montreal";
# ------------------------------------------------
# `Self` Modules configuration
# ------------------------------------------------
roles.server = {
user = mainUser;
tailscale.enable = true;
sshd.enable = true;
};
services.kmscon.enable = true;
}

View file

@ -11,10 +11,6 @@ in {
imports = [
./hardware-configuration.nix
../../modules/kmscon.nix
../../modules/sshd.nix
../../modules/tailscale.nix
./modules/7-days-to-die.nix
./modules/binary-cache.nix
./modules/minecraft.nix
@ -22,6 +18,8 @@ in {
./modules/pr-tracker.nix
self.nixosModules.docker
self.nixosModules.kmscon
self.nixosModules.server
];
# State Version: DO NOT CHANGE
@ -70,5 +68,11 @@ in {
# ------------------------------------------------
# `Self` Modules configuration
# ------------------------------------------------
# ...
roles.server = {
user = mainUser;
tailscale.enable = true;
sshd.enable = true;
};
services.kmscon.enable = true;
}

View file

@ -1,6 +1,7 @@
{
config,
self,
pkgs,
...
}: let
inherit (config.vars) mainUser hostName;
@ -11,22 +12,18 @@ in {
imports = [
./hardware-configuration.nix
../../modules/ags
../../modules/audio.nix
../../modules/kmscon.nix
../../modules/printer.nix
../../modules/tailscale.nix
./modules/security.nix
self.nixosModules.adb
self.nixosModules.desktop
self.nixosModules.kmscon
self.nixosModules.plymouth
self.nixosModules.server
];
home-manager.users.${mainUser} = {
imports = [
../../home/firefox
self.homeManagerModules.firefox
];
# State Version: DO NOT CHANGE
@ -73,6 +70,7 @@ in {
roles.desktop = {
user = mainUser;
ags.enable = true;
mainMonitor = "eDP-1";
isLaptop = true;
isTouchscreen = true;
@ -80,6 +78,11 @@ in {
fontSize = 12.5;
};
roles.server = {
user = mainUser;
tailscale.enable = true;
};
programs.adb = {
enable = true;
user = mainUser;
@ -88,5 +91,10 @@ in {
boot.plymouth = {
enable = true;
theme = "dracula";
themePackages = [
self.legacyPackages.${pkgs.system}.dracula.plymouth
];
};
services.kmscon.enable = true;
}

View file

@ -55,13 +55,9 @@
nixpkgs.lib.genAttrs supportedSystems (system:
attrs (mkPkgs system nixpkgs));
in {
nixosModules = {
adb = import ./modules/adb.nix;
desktop = import ./modules/desktop;
docker = import ./modules/docker;
nvidia = import ./modules/nvidia.nix;
plymouth = import ./modules/plymouth.nix;
};
nixosModules = import ./nixosModules self;
homeManagerModules = import ./homeManagerModules self;
nixosConfigurations = {
# Desktops

View file

@ -1,219 +0,0 @@
{
config,
firefox-gx-src,
pkgs,
self,
...
}: let
inherit (config.vars) hostName;
inherit (self.legacyPackages.${pkgs.system}) firefoxAddons;
firefox-gx = pkgs.callPackage ./gx-theme.nix {
inherit firefox-gx-src;
};
in {
home.file = {
".mozilla/firefox/matt/chrome/userContent.css".source = "${firefox-gx}/chrome/userContent.css";
".mozilla/firefox/matt/chrome/components".source = "${firefox-gx}/chrome/components";
".mozilla/firefox/matt/chrome/images".source = "${firefox-gx}/chrome/images";
".mozilla/firefox/matt/chrome/icons".source = "${firefox-gx}/chrome/icons";
};
programs.firefox = {
enable = true;
profiles.matt = {
isDefault = true;
id = 0;
userChrome = ''
@import url("file://${firefox-gx}/chrome/userChrome.css");
${import ./custom-css.nix hostName}
'';
settings = {
# Theme
"firefoxgx.tab-shapes" = true;
"firefoxgx.left-sidebar" = true;
"userChrome.tab.bottom_rounded_corner" = true;
"userChrome.tab.bottom_rounded_corner.wave" = false;
"userChrome.tab.bottom_rounded_corner.australis" = true;
"widget.use-xdg-desktop-portal.file-picker" = 1;
# Firefox-gx user.js
/*
Default rules
*/
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"svg.context-properties.content.enabled" = true;
"layout.css.color-mix.enabled" = true;
"browser.tabs.delayHidingAudioPlayingIconMS" = 0;
"layout.css.backdrop-filter.enabled" = true;
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" = false;
"browser.newtabpage.activity-stream.newtabWallpapers.enabled" = true;
/*
To active container tabs without any extension
*/
"privacy.userContext.enabled" = true;
"privacy.userContext.ui.enabled" = true;
"privacy.userContext.longPressBehavior" = 2;
# Open previous windows and tabs
"browser.startup.page" = 3;
# Prefs
"layout.css.devPixelsPerPx" = 1.12;
"browser.search.widget.inNavBar" = true;
"browser.toolbars.bookmarks.visibility" = "always";
"browser.toolbars.bookmarks.showInPrivateBrowsing" = true;
"ui.key.menuAccessKey" = 0;
# remove telemetry
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"datareporting.healthreport.infoURL" = "";
"dom.security.https_only_mode" = true;
# remove first run and warning stuff
"datareporting.policy.firstRunURL" = "";
"browser.aboutwelcome.enabled" = false;
"browser.aboutConfig.showWarning" = false;
# Disable firefox autofill
"signon.rememberSignons" = false;
"extensions.formautofill.addresses.enabled" = false;
"extensions.formautofill.creditCards.enabled" = false;
# remove new tab stuff
"extensions.pocket.enabled" = false;
"services.sync.prefs.sync.browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.feeds.system.topstories" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.feeds.topsites" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
};
search = {
default = "DuckDuckGo";
force = true;
engines = {
"Nixpkgs" = {
urls = [
{
template = "https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20{searchTerms}&type=code";
}
];
iconUpdateURL = "https://github.githubassets.com/favicons/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@pkgs"];
};
"NixOS Wiki" = {
urls = [
{
template = "https://nixos.wiki/index.php?search={searchTerms}";
}
];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@nw"];
};
"MyNixos" = {
urls = [
{
template = "https://mynixos.com/search?q={searchTerms}";
}
];
iconUpdateURL = "https://mynixos.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@mn"];
};
"Noogle" = {
urls = [
{
template = "https://noogle.dev/q?term={searchTerms}";
}
];
iconUpdateURL = "https://noogle.dev/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@ng"];
};
"Firefox Add-ons" = {
urls = [
{
template = "https://addons.mozilla.org/en-US/firefox/search/?q={searchTerms}";
}
];
iconUpdateURL = "https://addons.mozilla.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@fa"];
};
"ProtonDB" = {
urls = [
{
template = "https://www.protondb.com/search?q={searchTerms}";
}
];
iconUpdateURL = "https://www.protondb.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@pdb"];
};
"YouTube" = {
urls = [
{
template = "https://www.youtube.com/results?search_query={searchTerms}";
}
];
iconUpdateURL = "https://www.youtube.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@yt" "@youtube"];
};
"Bing".metaData.hidden = true;
"Google".metaData.hidden = true;
"eBay".metaData.hidden = true;
};
order = [
"DuckDuckGo"
"MyNixos"
"NixOS Wiki"
"Nixpkgs"
"Noogle"
"Wikipedia (en)"
"YouTube"
"Firefox Add-ons"
"ProtonDB"
"Amazon.ca"
];
};
extensions = with firefoxAddons; [
auto-refresh-page
bitwarden
checkmarks-web-ext
darkreader
floccus
google-container
image-search-options
istilldontcareaboutcookies
opera-gx-witchcraft-purple
return-youtube-dislikes
seventv
sponsorblock
sound-volume
stylus
ttv-lol-pro
ublock-origin
undoclosetabbutton
];
};
};
}

View file

@ -0,0 +1,3 @@
self: {
firefox = import ./firefox self;
}

View file

@ -0,0 +1,222 @@
self: {
osConfig,
pkgs,
...
}: let
inherit (osConfig.networking) hostName;
inherit (self.legacyPackages.${pkgs.system}) firefoxAddons;
firefox-gx = pkgs.callPackage ./gx-theme.nix {
inherit (self.inputs) firefox-gx-src;
};
in {
config = {
home.file = {
".mozilla/firefox/matt/chrome/userContent.css".source = "${firefox-gx}/chrome/userContent.css";
".mozilla/firefox/matt/chrome/components".source = "${firefox-gx}/chrome/components";
".mozilla/firefox/matt/chrome/images".source = "${firefox-gx}/chrome/images";
".mozilla/firefox/matt/chrome/icons".source = "${firefox-gx}/chrome/icons";
};
programs.firefox = {
enable = true;
profiles.matt = {
isDefault = true;
id = 0;
userChrome = ''
@import url("file://${firefox-gx}/chrome/userChrome.css");
${import ./custom-css.nix hostName}
'';
settings = {
# Theme
"firefoxgx.tab-shapes" = true;
"firefoxgx.left-sidebar" = true;
"userChrome.tab.bottom_rounded_corner" = true;
"userChrome.tab.bottom_rounded_corner.wave" = false;
"userChrome.tab.bottom_rounded_corner.australis" = true;
"widget.use-xdg-desktop-portal.file-picker" = 1;
# Firefox-gx user.js
/*
Default rules
*/
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"svg.context-properties.content.enabled" = true;
"layout.css.color-mix.enabled" = true;
"browser.tabs.delayHidingAudioPlayingIconMS" = 0;
"layout.css.backdrop-filter.enabled" = true;
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" = false;
"browser.newtabpage.activity-stream.newtabWallpapers.enabled" = true;
/*
To active container tabs without any extension
*/
"privacy.userContext.enabled" = true;
"privacy.userContext.ui.enabled" = true;
"privacy.userContext.longPressBehavior" = 2;
# Open previous windows and tabs
"browser.startup.page" = 3;
# Prefs
"layout.css.devPixelsPerPx" = 1.12;
"browser.search.widget.inNavBar" = true;
"browser.toolbars.bookmarks.visibility" = "always";
"browser.toolbars.bookmarks.showInPrivateBrowsing" = true;
"ui.key.menuAccessKey" = 0;
# remove telemetry
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"datareporting.healthreport.infoURL" = "";
"dom.security.https_only_mode" = true;
# remove first run and warning stuff
"datareporting.policy.firstRunURL" = "";
"browser.aboutwelcome.enabled" = false;
"browser.aboutConfig.showWarning" = false;
# Disable firefox autofill
"signon.rememberSignons" = false;
"extensions.formautofill.addresses.enabled" = false;
"extensions.formautofill.creditCards.enabled" = false;
# remove new tab stuff
"extensions.pocket.enabled" = false;
"services.sync.prefs.sync.browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.feeds.system.topstories" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.feeds.topsites" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
};
search = {
default = "DuckDuckGo";
force = true;
engines = {
"Nixpkgs" = {
urls = [
{
template = "https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20{searchTerms}&type=code";
}
];
iconUpdateURL = "https://github.githubassets.com/favicons/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@pkgs"];
};
"NixOS Wiki" = {
urls = [
{
template = "https://nixos.wiki/index.php?search={searchTerms}";
}
];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@nw"];
};
"MyNixos" = {
urls = [
{
template = "https://mynixos.com/search?q={searchTerms}";
}
];
iconUpdateURL = "https://mynixos.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@mn"];
};
"Noogle" = {
urls = [
{
template = "https://noogle.dev/q?term={searchTerms}";
}
];
iconUpdateURL = "https://noogle.dev/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@ng"];
};
"Firefox Add-ons" = {
urls = [
{
template = "https://addons.mozilla.org/en-US/firefox/search/?q={searchTerms}";
}
];
iconUpdateURL = "https://addons.mozilla.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@fa"];
};
"ProtonDB" = {
urls = [
{
template = "https://www.protondb.com/search?q={searchTerms}";
}
];
iconUpdateURL = "https://www.protondb.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@pdb"];
};
"YouTube" = {
urls = [
{
template = "https://www.youtube.com/results?search_query={searchTerms}";
}
];
iconUpdateURL = "https://www.youtube.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@yt" "@youtube"];
};
"Bing".metaData.hidden = true;
"Google".metaData.hidden = true;
"eBay".metaData.hidden = true;
};
order = [
"DuckDuckGo"
"MyNixos"
"NixOS Wiki"
"Nixpkgs"
"Noogle"
"Wikipedia (en)"
"YouTube"
"Firefox Add-ons"
"ProtonDB"
"Amazon.ca"
];
};
extensions = with firefoxAddons; [
auto-refresh-page
bitwarden
checkmarks-web-ext
darkreader
floccus
google-container
image-search-options
istilldontcareaboutcookies
opera-gx-witchcraft-purple
return-youtube-dislikes
seventv
sponsorblock
sound-volume
stylus
ttv-lol-pro
ublock-origin
undoclosetabbutton
];
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -1,174 +0,0 @@
{
ags,
astal-tray,
config,
gtk-session-lock,
lib,
pkgs,
self,
ts-for-gir-src,
...
}: let
inherit (lib) boolToString toLower;
# Configs
inherit (config.vars) mainUser hostName;
cfgDesktop = config.roles.desktop;
flakeDir = config.environment.variables.FLAKE;
isTouchscreen = config.hardware.sensor.iio.enable;
# Packages
astalTray = astal-tray.packages.${pkgs.system}.tray;
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
in {
# Enable pam for ags
security.pam.services.ags = {};
services.upower.enable = true;
home-manager.users.${mainUser}.imports = [
ags.homeManagerModules.default
({
config,
lib,
...
}: let
inherit (config.lib.file) mkOutOfStoreSymlink;
inherit (lib) hasPrefix optionals removePrefix;
configJs =
# javascript
''
Utils.execAsync('hyprpaper');
import { transpileTypeScript } from './js/utils.js';
export default (await transpileTypeScript('${hostName}')).default;
'';
agsPkg = config.programs.ags.finalPackage;
agsConfigDir = "${removePrefix "/home/${mainUser}/" flakeDir}/modules/ags";
in {
assertions = [
{
assertion = hasPrefix "/home/${mainUser}/" flakeDir;
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the AGS module.
'';
}
];
programs.ags = {
enable = true;
extraPackages = [
astalTray
gtkSessionLock
];
};
home = {
file = let
mkType = package: girName: {
"${agsConfigDir}/config/types/@girs/${toLower girName}".source =
pkgs.callPackage
./mk-types {
inherit ts-for-gir-src package girName;
};
};
in (
{
# Generated types
"${agsConfigDir}/config/types" = {
source = "${agsPkg}/share/com.github.Aylur.ags/types";
recursive = true; # To add other types inside the folder
};
}
// (mkType gtkSessionLock "GtkSessionLock-0.1")
// (mkType astalTray "AstalTray-0.1")
// {
# Out of store symlinks
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/modules/ags/config";
# Generated JavaScript files
"${agsConfigDir}/config/config.js".text = configJs;
"${agsConfigDir}/config/ts/lockscreen/vars.ts".text =
# javascript
''
export default {
mainMonitor: '${cfgDesktop.mainMonitor}',
dupeLockscreen: ${boolToString cfgDesktop.displayManager.duplicateScreen},
hasFprintd: ${boolToString (hostName == "wim")},
};
'';
}
// (import ./icons.nix {inherit pkgs agsConfigDir;})
);
packages =
[
# TODO: replace with matugen
self.packages.${pkgs.system}.coloryou
]
++ (with pkgs; [
# ags
dart-sass
bun
playerctl
(callPackage ./clipboard {})
## gui
pavucontrol # TODO: replace with ags widget
])
++ (optionals isTouchscreen (with pkgs; [
lisgd
ydotool
]));
};
wayland.windowManager.hyprland = {
settings = {
animations = {
bezier = [
"easeInOutBack, 0.68, -0.6, 0.32, 1.6"
];
animation = [
"fadeLayersIn, 0"
"fadeLayersOut, 1, 3000, default"
"layers, 1, 8, easeInOutBack, slide left"
];
};
layerrule = [
"noanim, ^(?!win-).*"
# Lockscreen blur
"blur, ^(blur-bg.*)"
"ignorealpha 0.19, ^(blur-bg.*)"
];
exec-once = [
"ags"
"sleep 3; ags -r 'App.openWindow(\"win-applauncher\")'"
];
bind = [
"$mainMod SHIFT, E , exec, ags -t win-powermenu"
"$mainMod , D , exec, ags -t win-applauncher"
"$mainMod , V , exec, ags -t win-clipboard"
" , Print, exec, ags -t win-screenshot"
];
binde = [
## Brightness control
", XF86MonBrightnessUp , exec, ags -r 'Brightness.screen += 0.05'"
", XF86MonBrightnessDown, exec, ags -r 'Brightness.screen -= 0.05'"
];
bindn = [" , Escape , exec, ags -r 'closeAll()'"];
bindr = ["CAPS, Caps_Lock, exec, ags -r 'Brightness.fetchCapsState()'"];
};
};
})
];
}

View file

@ -1,13 +0,0 @@
{nix-gaming, ...}: {
imports = [nix-gaming.nixosModules.pipewireLowLatency];
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
jack.enable = true;
pulse.enable = true;
lowLatency.enable = true;
};
}

View file

@ -1,26 +0,0 @@
{config, ...}: let
cfg = config.roles.desktop;
in {
programs.dconf.enable = true;
home-manager.users.${cfg.user} = {
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
"apps/seahorse/listing" = {
keyrings-selected = ["gnupg://"];
};
"org/gtk/settings/file-chooser" = {
show-hidden = true;
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
};
}

View file

@ -1,223 +0,0 @@
{
config,
hyprland,
lib,
pkgs,
...
}: let
inherit (lib) concatStringsSep optionals;
cfg = config.roles.desktop;
hyprCfg =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland;
in {
# SYSTEM CONFIG
imports = [
./dconf.nix
./packages.nix
./security.nix
];
services = {
dbus.enable = true;
gvfs.enable = true;
libinput.enable = true;
xserver.wacom.enable = cfg.isTouchscreen;
};
programs.hyprland = {
enable = true;
package = hyprCfg.finalPackage;
portalPackage =
hyprland
.packages
.${pkgs.system}
.xdg-desktop-portal-hyprland;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-kde
];
config.hyprland = {
default = [
"hyprland"
"gtk"
];
"org.freedesktop.impl.portal.FileChooser" = [
"kde"
];
};
};
# HOME-MANAGER CONFIG
home-manager.users.${cfg.user} = {
imports = [
./home/dev.nix
# Plugins
./home/hyprgrass.nix
./home/hyprexpo.nix
# ./home/Hyprspace.nix
./home/inputs.nix
./home/style.nix
];
wayland.windowManager.hyprland = {
enable = true;
package =
hyprland
.packages
.${pkgs.system}
.default;
systemd.variables = ["-all"];
settings = {
envd = let
mkGSchemas = pkg: "${pkg}/share/gsettings-schemas/${pkg.name}";
in
[
"GTK_USE_PORTAL, 1"
"NIXOS_OZONE_WL, 1"
"ELECTRON_OZONE_PLATFORM_HINT, auto"
"XDG_DATA_DIRS, ${concatStringsSep ":" [
(mkGSchemas pkgs.gsettings-desktop-schemas)
(mkGSchemas pkgs.gtk3)
"$XDG_DATA_DIRS"
]}"
]
++ (optionals config.nvidia.enable [
"LIBVA_DRIVER_NAME, nvidia"
"NVD_BACKEND, direct"
"XDG_SESSION_TYPE, wayland"
"GBM_BACKEND, nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME, nvidia"
]);
xwayland.force_zero_scaling = true;
monitor = [
(concatStringsSep "," [
"desc:Acer Technologies Acer K212HQL T3EAA0014201"
"1920x1080@60"
"840x450, 1, transform, 3"
])
(concatStringsSep "," [
"desc:BOE 0x0964"
"1920x1200@60"
"0x2920, 1"
])
(concatStringsSep "," [
"desc:Samsung Electric Company C27JG5x HTOM100586"
"2560x1440@120"
"1920x120, 1"
])
(concatStringsSep "," [
"desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D"
"2560x1440@120"
"1920x1560, 1"
])
];
"$mainMod" = "SUPER";
bind = [
# Defaults
"$mainMod, F, fullscreen"
"$mainMod, C, killactive"
"$mainMod SHIFT, SPACE, togglefloating"
"$mainMod, J, layoutmsg, togglesplit"
## Move focus with arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
## Move to specific workspaces
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
# Move active window to a workspace
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod SHIFT, 5, movetoworkspace, 5"
"$mainMod SHIFT, 6, movetoworkspace, 6"
"$mainMod SHIFT, 7, movetoworkspace, 7"
"$mainMod SHIFT, 8, movetoworkspace, 8"
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
",XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle"
];
binde = [
",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ & ags -r 'popup_osd(\"speaker\")' &"
",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags -r 'popup_osd(\"speaker\")' &"
];
# Mouse Binds
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
vfr = true;
};
dwindle = {
smart_split = true;
special_scale_factor = 0.8;
};
};
};
# libs
home.packages = with pkgs; [
# tools
bluez-tools
brightnessctl
pulseaudio
alsa-utils
qt5.qtwayland
qt6.qtwayland
libayatana-appindicator
xdg-utils
evtest
glib
xorg.xrandr
libinput
xclip
libnotify
];
};
}

View file

@ -1,51 +0,0 @@
{
config,
pkgs,
...
}: let
inherit (config.vars) mainUser;
in {
environment.systemPackages = with pkgs; [
plasma5Packages.kio-admin
];
# To make it work with firefox
# https://www.reddit.com/r/NixOS/comments/xtoubc/comment/koxxr3e/?utm_source=share&utm_medium=web2x&context=3
systemd.user.services.plasma-dolphin = {
unitConfig = {
Description = "Dolphin file manager";
PartOf = ["graphical-session.target"];
};
path = ["/run/current-system/sw"];
environment.QT_QPA_PLATFORM = "wayland";
serviceConfig = {
Type = "dbus";
BusName = "org.freedesktop.FileManager1";
ExecStart = "${pkgs.dolphin}/bin/dolphin";
};
};
home-manager.users.${mainUser}.home.packages = with pkgs;
[
gnome-calculator
]
++ (with kdePackages; [
kde-cli-tools
])
++ (with plasma5Packages; [
ark
kcharselect
kdenlive
okular
# Dolphin & co
dolphin
dolphin-plugins
kdegraphics-thumbnailers
ffmpegthumbs
kio
kio-admin # needs to be both here and in system pkgs
kio-extras
kmime
]);
}

View file

@ -1,15 +0,0 @@
{
Hyprspace,
pkgs,
...
}: {
wayland.windowManager.hyprland = {
plugins = [Hyprspace.packages.${pkgs.system}.Hyprspace];
settings = {
bind = [
"ALT, tab, overview:toggle"
];
};
};
}

View file

@ -1,18 +0,0 @@
{pkgs, ...}: {
programs.bash.shellAliases = {
# https://wiki.hyprland.org/Contributing-and-Debugging/#lsp-and-formatting
"mkCMakeFiles" = "cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON";
};
home.packages = [
(pkgs.writeShellScriptBin "testChanges" ''
rm -r /home/matt/git/$1/$2/{.cache,build}
nix flake update "$1"
nh os switch
(
cd "/home/matt/git/$1/$2"
nix develop /home/matt/git/$1 -c cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
)
'')
];
}

View file

@ -1,88 +0,0 @@
{
lib,
osConfig,
...
}: let
cfg = osConfig.roles.desktop;
in {
programs = {
# https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory
bash.bashrcExtra =
# bash
''
osc7_cwd() {
local strlen=''${#PWD}
local encoded=""
local pos c o
for (( pos=0; pos<strlen; pos++ )); do
c=''${PWD:$pos:1}
case "$c" in
[-/:_.!\'\(\)~[:alnum:]] ) o="$c" ;;
* ) printf -v o '%%%02X' "'$c" ;;
esac
encoded+="''${o}"
done
printf '\e]7;file://%s%s\e\\' "''${HOSTNAME}" "''${encoded}"
}
PROMPT_COMMAND=''${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc7_cwd
'';
foot = {
enable = true;
settings = {
main = {
term = "xterm-256color";
font = "JetBrainsMono Nerd Font:size=${
lib.strings.floatToString cfg.fontSize
}";
pad = "0x10";
};
key-bindings = {
spawn-terminal = "Control+Shift+Return";
};
bell = {
urgent = false;
notify = false;
visual = false;
command = null;
command-focused = false;
};
colors = {
# BG transparency
alpha = 0.8;
background = "282a36";
foreground = "f8f8f2";
regular0 = "21222c"; # black
regular1 = "ff5555"; # red
regular2 = "50fa7b"; # green
regular3 = "f1fa8c"; # yellow
regular4 = "bd93f9"; # blue
regular5 = "ff79c6"; # magenta
regular6 = "8be9fd"; # cyan
regular7 = "f8f8f2"; # white
bright0 = "6272a4"; # bright black
bright1 = "ff6e6e"; # bright red
bright2 = "69ff94"; # bright green
bright3 = "ffffa5"; # bright yellow
bright4 = "d6acff"; # bright blue
bright5 = "ff92df"; # bright magenta
bright6 = "a4ffff"; # bright cyan
bright7 = "ffffff"; # bright white
selection-foreground = "ffffff";
selection-background = "44475a";
urls = "8be9fd";
};
};
};
};
}

View file

@ -1,29 +0,0 @@
{
hyprland-plugins,
pkgs,
...
}: {
wayland.windowManager.hyprland = {
plugins = [hyprland-plugins.packages.${pkgs.system}.hyprexpo];
settings = {
plugin = {
hyprexpo = {
columns = 3;
gap_size = 5;
bg_col = "rgb(111111)";
workspace_method = "center current"; # [center/first] [workspace] e.g. first 1 or center m+1
enable_gesture = true; # laptop touchpad
gesture_fingers = 3;
gesture_distance = 300; # how far is the "max"
gesture_positive = true; # positive = swipe down. Negative = swipe up.
};
};
bind = [
"ALT, tab, hyprexpo:expo, toggle" # can be: toggle, off/disable or on/enable
];
};
};
}

View file

@ -1,57 +0,0 @@
{osConfig, ...}: let
inherit (osConfig.services.xserver) xkb;
inherit (osConfig.roles.desktop) mainMonitor;
miceNames = [
"logitech-g502-x"
"logitech-g502-hero-gaming-mouse"
];
mkConf = name: {
inherit name;
sensitivity = 0;
accel_profile = "flat";
};
in {
wayland.windowManager.hyprland = {
settings = {
device = map (d: (mkConf d)) miceNames;
cursor = {
no_hardware_cursors = osConfig.nvidia.enable;
hide_on_touch = true;
};
exec-once =
if mainMonitor != null
then ["hyprctl dispatch focusmonitor ${mainMonitor}"]
else [];
input = {
# Keyboard
kb_layout = xkb.layout;
kb_variant = xkb.variant;
numlock_by_default = true;
repeat_rate = 25;
# Mouse
follow_mouse = true;
# Touchpad
touchpad = {
natural_scroll = true;
disable_while_typing = false;
drag_lock = true;
tap-and-drag = true;
};
};
bind = [
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioStop, exec, playerctl stop"
",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous"
];
};
};
}

View file

@ -1,62 +0,0 @@
{
pkgs,
self,
...
}: let
inherit (self.legacyPackages.${pkgs.system}) mpvScripts;
in {
# For kdialog-open-files
home.packages = with pkgs; [
kdialog
];
programs.mpv = {
enable = true;
# https://github.com/mpv-player/mpv/wiki/User-Scripts
scripts = with mpvScripts; [
modernx
# Dep of touch-gestures
pointer-event
touch-gestures
# Ctrl + o
kdialog-open-files
persist-properties
undo-redo
];
scriptOpts = {
persist_properties = {
properties = "volume,sub-scale";
};
# Touch gestures default
pointer-event = {
margin_left = 0;
margin_right = 80;
margin_top = 50;
margin_bottom = 130;
ignore_left_single_long_while_window_dragging = true;
left_single = "cycle pause";
left_double = "script-message-to touch_gestures double";
left_long = "script-binding uosc/menu-blurred";
left_drag_start = "script-message-to touch_gestures drag_start";
left_drag_end = "script-message-to touch_gestures drag_end";
left_drag = "script-message-to touch_gestures drag";
};
touch-gestures = {
# valid options are:
# 'playlist' for changing the playlist item by swiping
# 'seek' for seeking by dragging
horizontal_drag = "seek";
# scale seeking based on the duration of the video
proportional_seek = true;
# scale factor for seeking
seek_scale = 1;
};
};
};
}

View file

@ -1,17 +0,0 @@
{
nixpkgs-wayland,
pkgs,
...
}: let
waypkgs = nixpkgs-wayland.packages.${pkgs.system};
in {
programs = {
obs-studio = {
enable = true;
plugins = [
waypkgs.obs-wlrobs
pkgs.obs-studio-plugins.droidcam-obs
];
};
};
}

View file

@ -1,53 +0,0 @@
{
config,
lib,
pkgs,
self,
...
}: let
inherit (lib) mkIf;
cursorTheme = self.legacyPackages.${pkgs.system}.dracula.hyprcursor;
cursorThemeName = "Dracula-cursors";
hyprcursorThemeName = "Dracula-hyprcursor";
cursorSize = "24";
in {
imports = [
../../home/theme
../../home/hyprpaper.nix
];
home.file.".local/share/icons/${hyprcursorThemeName}".source = cursorTheme;
wayland.windowManager.hyprland = {
settings =
{
envd = [
"XCURSOR_THEME, ${cursorThemeName}"
"XCURSOR_SIZE, ${cursorSize}"
];
exec-once = [
"hyprctl setcursor ${hyprcursorThemeName} ${cursorSize}"
];
windowrule = [
"size 1231 950,title:^(Open Folder)$"
"float,title:^(Open Folder)$"
"size 1231 950,title:^(Open File)$"
"float,title:^(Open File)$"
];
layerrule = [
"noanim, selection"
];
}
// (
mkIf (config.home.username != "greeter") {
# This file should only be used for theming
source = ["${config.vars.configDir}/hypr/main.conf"];
}
);
};
}

View file

@ -1,257 +0,0 @@
{
config,
jellyfin-flake,
lib,
pkgs,
self,
...
}: let
inherit (lib) getExe makeLibraryPath mkIf optionals optionalString;
inherit (pkgs.writers) writeTOML;
flakeDir = config.environment.variables.FLAKE;
cfg = config.roles.desktop;
nvidiaEnable = config.nvidia.enable;
restartTailscale = pkgs.writeShellScriptBin "restartTailscale" ''
sudo ${pkgs.systemd}/bin/systemctl restart tailscaled.service
'';
in {
imports = [./dolphin.nix];
programs.kdeconnect.enable = true;
security.sudo.extraRules = [
{
users = [cfg.user];
groups = [100];
commands = [
{
command = "${pkgs.systemd}/bin/systemctl restart tailscaled.service";
options = ["SETENV" "NOPASSWD"];
}
];
}
];
home-manager.users.${cfg.user} = {
imports = [
./home/foot.nix
./home/mpv.nix
./home/obs.nix
({config, ...}: let
symlink = config.lib.file.mkOutOfStoreSymlink;
configDir = "${flakeDir}/modules/desktop/desktop-environment/config";
in {
xdg = {
configFile = {
"dolphinrc".source = symlink "${configDir}/dolphinrc";
"kdeglobals".source = symlink "${configDir}/kdeglobals";
"kiorc".source = symlink "${configDir}/kiorc";
"mimeapps.list".source = symlink "${configDir}/mimeapps.list";
"satty/config.toml".source = writeTOML "satty.toml" {
general = {
early-exit = true;
copy-command = "wl-copy";
initial-tool = "crop";
output-filename = "${config.home.homeDirectory}/Pictures/Screenshots/screen-%d-%m-%Y_%H:%M:%S.png";
};
font = {
family = "Ubuntu Mono";
};
};
};
desktopEntries =
(mkIf nvidiaEnable {
"com.github.iwalton3.jellyfin-media-player" = {
name = "Jellyfin Media Player";
comment = "Desktop client for Jellyfin";
exec = "jellyfinmediaplayer --platform xcb";
icon = "com.github.iwalton3.jellyfin-media-player";
terminal = false;
type = "Application";
categories = ["AudioVideo" "Video" "Player" "TV"];
settings = {
Version = "1.0";
StartupWMClass = "jellyfin-media-player";
};
actions = {
"DesktopF" = {
name = "Desktop [Fullscreen]";
exec = "jellyfinmediaplayer --fullscreen --desktop --platform xcb";
};
"DesktopW" = {
name = "Desktop [Windowed]";
exec = "jellyfinmediaplayer --windowed --desktop --platform xcb";
};
"TVF" = {
name = "TV [Fullscreen]";
exec = "jellyfinmediaplayer --fullscreen --tv --platform xcb";
};
"TVW" = {
name = "TV [Windowed]";
exec = "jellyfinmediaplayer --windowed --tv --platform xcb";
};
};
};
})
// {
gparted = {
name = "GParted";
genericName = "Partition Editor";
comment = "Create, reorganize, and delete partitions";
exec = "Gparted";
icon = "gparted";
terminal = false;
type = "Application";
categories = ["GNOME" "System" "Filesystem"];
startupNotify = true;
settings = {
Keywords = "Partition";
X-GNOME-FullName = "GParted Partition Editor";
};
};
};
};
})
];
programs.sioyek = {
enable = true;
config = {
startup_commands = "toggle_custom_color";
ui_font = "JetBrainsMono Nerd Font Mono Regular";
font_size = "24";
source = toString self.legacyPackages.${pkgs.system}.dracula.sioyek;
};
};
home.packages =
(with pkgs; [
# School
xournalpp
virt-manager
libreoffice-fresh # TODO: declarative conf?
hunspell
hunspellDicts.en_CA
# Apps
protonmail-desktop
spotifywm
photoqt
nextcloud-client
prismlauncher
(writeShellScriptBin "Gparted" ''
(
sleep 1.5
while killall -r -0 ksshaskpass > /dev/null 2>&1
do
sleep 0.1
if [[ $(hyprctl activewindow | grep Ksshaskpass) == "" ]]; then
killall -r ksshaskpass
fi
done
) &
exec env SUDO_ASKPASS=${plasma5Packages.ksshaskpass}/bin/${plasma5Packages.ksshaskpass.pname} sudo -k -EA "${gparted}/bin/${gparted.pname}" "$@"
'')
# tools
wl-color-picker
wl-clipboard
cliphist
grim-hyprland
slurp
satty
])
++ [
jellyfin-flake.packages.${pkgs.system}.jellyfin-media-player
/*
Discord themes for Vencord
https://markchan0225.github.io/RoundedDiscord/RoundedDiscord.theme.css
https://raw.githubusercontent.com/dracula/BetterDiscord/master/Dracula_Official.theme.css
*/
(pkgs.symlinkJoin {
name = "discord";
paths = [
(pkgs.discord.override {
withOpenASAR = true;
withVencord = true;
})
];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/Discord ${optionalString config.nvidia.enable
''--prefix LD_LIBRARY_PATH : "${makeLibraryPath [
pkgs.addOpenGLRunpath.driverLink
pkgs.libglvnd
]}"''} \
--add-flags "--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --ozone-platform=wayland"
'';
})
(pkgs.symlinkJoin {
name = "rstudio";
paths = [
(pkgs.rstudioWrapper.override {packages = with pkgs.rPackages; [ggplot2 dplyr xts];})
];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/rstudio --prefix LD_LIBRARY_PATH : "${makeLibraryPath [
pkgs.addOpenGLRunpath.driverLink
pkgs.libglvnd
]}"
'';
})
];
wayland.windowManager.hyprland = {
settings = {
exec-once =
[
"${config.programs.kdeconnect.package}/libexec/kdeconnectd"
"kdeconnect-indicator"
"wl-paste --watch cliphist store"
"sleep 3; nextcloud --background"
"[workspace special:protonmail silent] proton-mail"
"[workspace special:spot silent] spotify"
]
++ optionals config.services.tailscale.enable [
"sleep 3; ${getExe restartTailscale}"
];
windowrule = [
"tile,^(libreoffice)$"
"float,^(org.gnome.Calculator)$"
"float,^(com.gabm.satty)$"
"size 1000 700,^(com.gabm.satty)$"
"float,^(com.nextcloud.desktopclient.nextcloud)$"
"move cursor -15 -10,^(com.nextcloud.desktopclient.nextcloud)$"
"size 400 581,^(com.nextcloud.desktopclient.nextcloud)$"
"workspace special:protonmail silent,^(Proton Mail)$"
"workspace special:spot silent,^(Spotify)$"
];
bind = [
"$mainMod, Q, exec, foot"
"$mainMod SHIFT, C, exec, wl-color-picker"
"$mainMod, P, togglespecialworkspace, protonmail"
"$mainMod, S, togglespecialworkspace, spot"
];
};
};
};
}

View file

@ -1,108 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) getExe mkIf;
cfg = config.roles.desktop;
hmCfg = config.home-manager.users.${cfg.user};
agsPkg = hmCfg.programs.ags.finalPackage;
hyprPkg = hmCfg.wayland.windowManager.hyprland.finalPackage;
runInDesktop = pkgs.writeShellApplication {
name = "runInDesktop";
runtimeInputs = [
pkgs.sudo
agsPkg
hyprPkg
];
text = ''
params=( "$@" )
user="$(id -u ${cfg.user})"
readarray -t SIGS <<< "$(ls "/run/user/$user/hypr/")"
run() {
export HYPRLAND_INSTANCE_SIGNATURE="$1"
sudo -Eu ${cfg.user} hyprctl dispatch exec "''${params[@]}"
}
i=0
# FIXME: not sure if sudo passes the exit status to this
while ! run "''${SIGS[$i]}"; do
((i+=1))
done
'';
};
lockPkg = pkgs.writeShellApplication {
name = "lock";
runtimeInputs = [
agsPkg
];
text = ''
ags -r 'Tablet.setLaptopMode()'
ags -b lockscreen -c /home/${cfg.user}/.config/ags/lockscreen.js
'';
};
in {
services.acpid = mkIf cfg.isLaptop {
enable = true;
lidEventCommands =
# bash
''
LID="/proc/acpi/button/lid/LID/state"
state=$(${pkgs.gawk}/bin/awk '{print $2}' "$LID")
case "$state" in
*open*)
${getExe runInDesktop} "ags -b lockscreen -r 'authFinger()'"
;;
*close*)
${getExe runInDesktop} ${getExe lockPkg}
;;
*)
logger -t lid-handler "Failed to detect lid state ($state)"
;;
esac
'';
};
home-manager.users.${cfg.user} = {
home.packages = [
pkgs.seahorse
lockPkg
];
wayland.windowManager.hyprland = {
settings = {
exec-once = [
"gnome-keyring-daemon --start --components=secrets"
"${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
];
windowrule = [
"float,^(org.kde.polkit-kde-authentication-agent-1)$"
"size 741 288,^(org.kde.polkit-kde-authentication-agent-1)$"
"center,^(org.kde.polkit-kde-authentication-agent-1)$"
# For GParted auth
"size 741 288,^(org.kde.ksshaskpass)$"
"move cursor -370 -144,^(org.kde.ksshaskpass)$"
];
bind = [
"$mainMod, L, exec, ${getExe lockPkg}"
];
};
};
};
}

View file

@ -1,67 +0,0 @@
{
ags,
config,
lib,
pkgs,
...
}: let
cfg = config.roles.desktop;
hyprland =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland
.finalPackage;
in {
# Add home folder for home-manager to work
users.users.greeter = {
home = "/var/lib/greeter";
createHome = true;
};
home-manager.users.greeter = {
imports = [ags.homeManagerModules.default];
programs.ags.enable = true;
home.packages = [
hyprland
pkgs.gtk3
pkgs.glib
];
xdg.configFile = {
"ags".source = pkgs.stdenv.mkDerivation {
name = "ags-greeter";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./scss
./greeter.ts
./ts
./tsconfig.json
];
};
buildInputs = with pkgs; [
bun
dart-sass
];
buildPhase = ''
sass ./scss/greeter.scss style.css
bun build ./greeter.ts --external resource:///* --external gi://* --external cairo > config.js
'';
installPhase = ''
mkdir $out
mv style.css config.js $out/
'';
};
};
};
}

View file

@ -1,50 +0,0 @@
{
config,
pkgs,
...
}: let
cfg = config.roles.desktop;
hyprland =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland
.finalPackage;
cmd = toString (pkgs.writeShellScript "hyprland-wrapper" ''
trap 'systemctl --user stop hyprland-session.target; sleep 1' EXIT
exec Hyprland >/dev/null
'');
in {
imports = [
./ags
./hyprland.nix
];
services = {
displayManager.sessionPackages = [hyprland];
greetd = {
enable = true;
settings = {
default_session = {
command = cmd;
user = "greeter";
};
initial_session = {
command = cmd;
user = cfg.user;
};
};
};
};
# unlock GPG keyring on login
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
}

View file

@ -1,60 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) filterAttrs hasPrefix optionals;
inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors;
cfg = config.roles.desktop;
# Nix stuff
cfgHypr =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland;
devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings;
in {
home-manager.users.greeter = {
imports = [../desktop-environment/home/style.nix];
wayland.windowManager.hyprland = {
enable = true;
package = cfgHypr.finalPackage;
systemd.enable = false;
settings =
{
inherit (cfgHypr.settings) cursor input misc monitor;
envd = optionals (config.nvidia.enable) [
"LIBVA_DRIVER_NAME, nvidia"
"NVD_BACKEND, direct"
"XDG_SESSION_TYPE, wayland"
"GBM_BACKEND, nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME, nvidia"
];
general.border_size = 0;
decoration = {
blur.enabled = false;
drop_shadow = false;
};
exec-once = [
setupMonitors
"ags -b greeter &> /tmp/ags-greetd.log; hyprctl dispatch exit"
];
}
// devices;
};
};
}

View file

@ -1,25 +0,0 @@
{
lib,
pkgs,
self,
...
}: let
wallpaper = toString self.legacyPackages.${pkgs.system}.dracula.wallpaper;
in {
home.packages = with pkgs; [hyprpaper];
xdg.configFile."hypr/hyprpaper.conf" = {
text = lib.hm.generators.toHyprconf {
attrs = {
ipc = "on";
splash = false;
preload = [wallpaper];
wallpaper = [
",${wallpaper}"
];
};
};
};
}

View file

@ -1,47 +0,0 @@
{
pkgs,
self,
...
}: let
inherit (self.legacyPackages.${pkgs.system}) dracula;
in {
imports = [
./gtk.nix
./qt.nix
];
home.pointerCursor = {
name = "Dracula-cursors";
package = dracula.gtk;
size = 24;
gtk.enable = true;
x11 = {
enable = true;
defaultCursor = "Dracula-cursors";
};
};
xresources.extraConfig = ''
! Dracula Xresources palette
*.foreground: #F8F8F2
*.background: #282A36
*.color0: #000000
*.color8: #4D4D4D
*.color1: #FF5555
*.color9: #FF6E67
*.color2: #50FA7B
*.color10: #5AF78E
*.color3: #F1FA8C
*.color11: #F4F99D
*.color4: #BD93F9
*.color12: #CAA9FA
*.color5: #FF79C6
*.color13: #FF92D0
*.color6: #8BE9FD
*.color14: #9AEDFE
*.color7: #BFBFBF
*.color15: #E6E6E6
'';
}

View file

@ -1,64 +0,0 @@
{
pkgs,
lib,
osConfig,
...
}: let
inherit (import ./gradience.nix {inherit pkgs lib;}) gradience;
cfg = osConfig.roles.desktop;
in {
home.packages = with pkgs; [
gnomeExtensions.user-themes
];
# Gtk settings
gtk = {
enable = true;
theme = {
name = "adw-gtk3";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Flat-Remix-Violet-Dark";
package = pkgs.flat-remix-icon-theme;
};
font = {
name = "Sans Serif";
size = cfg.fontSize;
};
gtk3 = {
extraConfig = {
"gtk-application-prefer-dark-theme" = 1;
};
extraCss = "@import url(\"file://${gradience.build}/gtk-3.0/gtk.css\");";
};
gtk4 = {
extraConfig = {
"gtk-application-prefer-dark-theme" = 1;
};
extraCss = "@import url(\"file://${gradience.build}/gtk-4.0/gtk.css\");";
};
};
dconf.settings = {
"org/gnome/shell/extensions/user-theme" = {
name = gradience.shellTheme;
};
"org/gnome/shell" = {
enabled-extensions = [pkgs.gnomeExtensions.user-themes.extensionUuid];
};
};
xdg.dataFile.shellTheme = {
enable = true;
recursive = true;
source = "${gradience.build}/gradience-shell";
target = "themes/${gradience.shellTheme}";
};
}

View file

@ -1,43 +0,0 @@
{
lib,
osConfig,
pkgs,
self,
...
}: let
inherit (self.legacyPackages.${pkgs.system}) dracula;
cfg = osConfig.roles.desktop;
in {
home.packages = with pkgs; [
libsForQt5.qtstyleplugin-kvantum
qt6Packages.qtstyleplugin-kvantum
];
qt = {
enable = true;
platformTheme.name = "qtct";
};
xdg.configFile = let
floatFont = lib.strings.floatToString cfg.fontSize;
qtconf =
# ini
''
[Fonts]
fixed="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
general="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
[Appearance]
icon_theme=Flat-Remix-Violet-Dark
style='';
# The newline before this must be there
in {
"Kvantum/Dracula/Dracula.kvconfig".source = "${dracula.gtk}/share/Kvantum/Dracula-purple-solid/Dracula-purple-solid.kvconfig";
"Kvantum/Dracula/Dracula.svg".source = "${dracula.gtk}/share/Kvantum/Dracula-purple-solid/Dracula-purple-solid.svg";
"Kvantum/kvantum.kvconfig".text = "[General]\ntheme=Dracula";
"qt5ct/qt5ct.conf".text = qtconf + "kvantum";
"qt6ct/qt6ct.conf".text = qtconf + "kvantum";
};
}

View file

@ -1,14 +0,0 @@
{...}: {
services.kmscon = {
enable = true;
useXkbConfig = true;
hwRender = false;
# FIXME: https://github.com/Aetf/kmscon/issues/18 // Icons not rendering properly
extraOptions = builtins.concatStringsSep " " [
"--font-size 12.5"
"--font-dpi 170"
"--font-name 'JetBrainsMono Nerd Font'"
];
};
}

View file

@ -1,11 +0,0 @@
{pkgs, ...}: {
services = {
# Enable CUPS to print documents.
printing = {
enable = true;
drivers = with pkgs; [
hplip
];
};
};
}

View file

@ -1,30 +0,0 @@
{
libratbag-src,
pkgs,
piper-src,
...
}: let
inherit (import ../flake/lib.nix {}) mkVersion;
in {
services.ratbagd = {
enable = true;
package = pkgs.libratbag.overrideAttrs {
pname = "libratbag";
version = mkVersion libratbag-src;
src = libratbag-src;
};
};
environment.systemPackages = [
(pkgs.piper.overrideAttrs {
pname = "piper";
version = mkVersion piper-src;
src = piper-src;
mesonFlags = [
"-Druntime-dependency-checks=false"
];
})
];
}

View file

@ -1,21 +0,0 @@
{config, ...}: let
inherit (config.vars) mainUser;
in {
services = {
openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
};
users.users.${mainUser} = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE39uk52+NIDLdHeoSHIEsOUUFRzj06AGn09z4TUOYm matt@OP9"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICr2+CpqXNMLsjgbrYyIwTKhlVSiIYol1ghBPzLmUpKl matt@binto"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim"
];
};
}

View file

@ -1,37 +0,0 @@
{config, ...}: let
inherit (config.vars) hostName mainUser;
in {
services = {
tailscale = {
enable = true;
# TODO: add authKeyFile to get extraUpFlags to work
# https://github.com/juanfont/headscale/issues/1550
# https://github.com/juanfont/headscale/blob/main/docs/running-headscale-linux-manual.md#register-machine-using-a-pre-authenticated-key
# https://www.reddit.com/r/NixOS/comments/18kz1nb/tailscale_extraupflags_not_working/
extraUpFlags = [
"--login-server https://headscale.nelim.org"
"--operator=matt"
];
};
};
home-manager.users.${mainUser} = {
programs.bash.shellAliases = {
# Connect to headscale
tup = "tailscale up --login-server https://headscale.nelim.org";
# Desktop
pc = "ssh -t matt@binto 'tmux -2u new -At ${hostName}'";
# NAS
nos = "ssh -t matt@nos 'tmux -2u new -At ${hostName}'";
# Experimenting server
servivi = "ssh -t matt@servivi 'tmux -2u new -At ${hostName}'";
# Cluster nodes
thingone = "ssh -t matt@thingone 'tmux -2u new -At ${hostName}'";
thingtwo = "ssh -t matt@thingtwo 'tmux -2u new -At ${hostName}'";
};
};
}

View file

@ -21,4 +21,7 @@ in {
config = mkIf cfg.enable {
users.users.${cfg.user}.extraGroups = ["adbusers"];
};
# For accurate stack trace
_file = ./default.nix;
}

Some files were not shown because too many files have changed in this diff Show more