nixpkgs-fmt

This commit is contained in:
LordGrimmauld 2024-04-10 16:51:28 +02:00
parent e8abbd0c1f
commit 36252de722
28 changed files with 502 additions and 438 deletions

View file

@ -1,21 +1,33 @@
{pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
config = with cfg; lib.mkIf (enable && cloudSync.enable) (let {
config = with cfg; lib.mkIf (enable && cloudSync.enable) (
let
cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${config.grimmShared.cloudSync.username} -p "$(cat ${config.grimmShared.cloudSync.passwordFile})" -h -n --path''; cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${config.grimmShared.cloudSync.username} -p "$(cat ${config.grimmShared.cloudSync.passwordFile})" -h -n --path'';
sync_server = "https://${config.grimmShared.cloudSync.server}"; sync_server = "https://${config.grimmShared.cloudSync.server}";
in { in
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server)) (writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client nextcloud-client
]; ];
systemd.services = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let systemd.services = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths; paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (map ({local, remote}: let sync_script = lib.strings.concatLines (map
({ local, remote }:
let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote); remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in "${cloud_cmd} /${remote_clean} ${local} ${sync_server}" ) paths); in
in { # user-specific sync jobs "${cloud_cmd} /${remote_clean} ${local} ${sync_server}")
paths);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) { "nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud"; description = "Auto sync Nextcloud";
after = [ "network-online.target" ]; after = [ "network-online.target" ];
@ -30,11 +42,16 @@ in {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
enable = true; enable = true;
}; };
}) config.users.users ); })
config.users.users);
systemd.timers = lib.mkMerge (lib.mapAttrsToList (local_user: user_conf: let systemd.timers = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
let
paths = user_conf.syncPaths; paths = user_conf.syncPaths;
in { # user-specific sync jobs in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) { "nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes"; description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes";
timerConfig.OnBootSec = "5min"; timerConfig.OnBootSec = "5min";
@ -42,6 +59,8 @@ in {
wantedBy = [ "multi-user.target" "timers.target" ]; wantedBy = [ "multi-user.target" "timers.target" ];
enable = true; enable = true;
}; };
}) config.users.users ); })
}); config.users.users);
}
);
} }

View file

@ -1,6 +1,8 @@
{ inputs, pkgs, config, lib, ... }: let { inputs, pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && firefox.enable) { config = with cfg; lib.mkIf (enable && firefox.enable) {
environment.systemPackages = [ ] environment.systemPackages = [ ]
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ]; ++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
@ -16,11 +18,15 @@ in {
(lib.mkIf cfg.firefox.disableUserPlugins { (lib.mkIf cfg.firefox.disableUserPlugins {
"*".installation_mode = "blocked"; "*".installation_mode = "blocked";
}) })
(lib.mapAttrs (guid: shortId: { # explicit plugins by config (lib.mapAttrs
(guid: shortId: {
# explicit plugins by config
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
} ) cfg.firefox.plugins ) })
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) { # password-store support cfg.firefox.plugins)
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) {
# password-store support
"passff@invicem.pro" = { "passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && gaming) { config = with cfg; lib.mkIf (enable && gaming) {
programs.steam = { programs.steam = {
enable = true; enable = true;

View file

@ -1,6 +1,8 @@
{ config, lib, ... }: let { config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && locale) { config = with cfg; lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = lib.mkMerge [ config = lib.mkMerge [
(with cfg; lib.mkIf (enable && network) { (with cfg; lib.mkIf (enable && network) {
networking.networkmanager.enable = true; networking.networkmanager.enable = true;

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && graphical) { config = with cfg; lib.mkIf (enable && graphical) {
# Enable OpenGL # Enable OpenGL
hardware.opengl = { hardware.opengl = {

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) { config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) {
security.polkit.enable = true; security.polkit.enable = true;

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && portals) { config = with cfg; lib.mkIf (enable && portals) {
xdg.portal = { xdg.portal = {
enable = true; enable = true;

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && printing) { config = with cfg; lib.mkIf (enable && printing) {
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;

View file

@ -1,6 +1,8 @@
{ grimm-shared-inputs, pkgs, config, lib, ... }: let { grimm-shared-inputs, pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && sound) { config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;

View file

@ -1,7 +1,10 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
config = let {
config =
let
waybar_full = pkgs.writeShellScriptBin "waybar-full" ( waybar_full = pkgs.writeShellScriptBin "waybar-full" (
"${config.programs.waybar.package}/bin/waybar" "${config.programs.waybar.package}/bin/waybar"
+ (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}") + (if isNull cfg.sway.bar.config then "" else " -c ${cfg.sway.bar.config}")
@ -14,14 +17,16 @@ bar {
} }
''; '';
build_conf = sway_conf : let build_conf = sway_conf:
let
build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}"); build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}"); build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = map (item: "exec " + item); build_exec_lines = map (item: "exec " + item);
build_mode_lines = lib.mapAttrsToList (name: value: '' build_mode_lines = lib.mapAttrsToList (name: value: ''
mode "${name}" { mode "${name}" {
${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}''); ${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in ([] in
([ ]
++ (build_definition_lines sway_conf.definitions) ++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds) ++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines sway_conf.autolaunch) ++ (build_exec_lines sway_conf.autolaunch)
@ -35,7 +40,8 @@ ${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
); );
sway_conf = pkgs.writeText "sway.conf" text; sway_conf = pkgs.writeText "sway.conf" text;
in with cfg; lib.mkIf (enable && sway.enable) { in
with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = { environment.etc."sway.conf" = {
source = sway_conf; source = sway_conf;
}; };

View file

@ -1,11 +1,14 @@
{ pkgs, config, lib, ... }: let { pkgs, config, lib, ... }:
let
cfg = config.grimmShared; cfg = config.grimmShared;
in { in
{
config = with cfg; lib.mkIf (enable && tooling.enable) { config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@") (writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@") (writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@") (writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
nixpkgs-fmt
gcc gcc
jdk17 jdk17
python3 python3

View file

@ -5,7 +5,8 @@
{ config, fetchpatch, pkgs, ... }: { config, fetchpatch, pkgs, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [
# Include the results of the hardware scan.
./modules/fonts.nix ./modules/fonts.nix
./modules/tabletdriver.nix ./modules/tabletdriver.nix
./sway/sway-conf.nix ./sway/sway-conf.nix

View file

@ -19,9 +19,11 @@
}; };
}; };
outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }: let outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, chaotic, ... }:
let
system = "x86_64-linux"; system = "x86_64-linux";
in { in
{
nixosConfigurations = { nixosConfigurations = {
grimmauld-nixos = nixpkgs.lib.nixosSystem { grimmauld-nixos = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
@ -44,7 +46,5 @@
]; ];
}; };
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
}; };
} }

View file

@ -50,7 +50,8 @@ let
}; };
}; };
}); });
in { in
{
options.grimmShared = { options.grimmShared = {
enable = mkEnableOption "grimm-shared-common"; enable = mkEnableOption "grimm-shared-common";

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: let { pkgs, ... }:
let
loadvfio = pkgs.writeShellScriptBin "loadvfio" '' loadvfio = pkgs.writeShellScriptBin "loadvfio" ''
udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1" udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1"
sleep 2 sleep 2
@ -48,7 +49,8 @@
fi fi
''; '';
in { in
{
environment.systemPackages = [ loadnvidia loadvfio ]; environment.systemPackages = [ loadnvidia loadvfio ];
security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio"; security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio";
virtualisation.libvirtd = { virtualisation.libvirtd = {

View file

@ -1,8 +1,11 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
spotifyd_cache_dir = "/tmp/spotifyd"; spotifyd_cache_dir = "/tmp/spotifyd";
in { in
nixpkgs.overlays = [ (final: prev: { spotifyd = prev.spotifyd.overrideAttrs (old: { {
nixpkgs.overlays = [
(final: prev: {
spotifyd = prev.spotifyd.overrideAttrs (old: {
postInstall = '' postInstall = ''
mkdir -p $out/share/dbus-1/system.d/ mkdir -p $out/share/dbus-1/system.d/
tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END
@ -24,7 +27,8 @@ tee $out/share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf <<END
</busconfig> </busconfig>
END END
''; '';
});}) });
})
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -1,6 +1,7 @@
let let
laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos"; laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos";
in { in
{
"spotify_pass.age".publicKeys = [ laptop_pub ]; "spotify_pass.age".publicKeys = [ laptop_pub ];
"nextcloud_pass.age".publicKeys = [ laptop_pub ]; "nextcloud_pass.age".publicKeys = [ laptop_pub ];
} }

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ # Include the results of the hardware scan. imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./screenshare-select.nix ./screenshare-select.nix
]; ];

View file

@ -5,7 +5,8 @@
{ {
imports = imports =
[ (modulesPath + "/installer/scan/not-detected.nix") [
(modulesPath + "/installer/scan/not-detected.nix")
# ./modules/nvidia.nix # ./modules/nvidia.nix
]; ];
@ -15,12 +16,14 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac"; {
device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D20D-B5B0"; {
device = "/dev/disk/by-uuid/D20D-B5B0";
fsType = "vfat"; fsType = "vfat";
}; };

View file

@ -138,7 +138,8 @@
XF86MonBrightnessUp = "exec brightnessctl s 10+%"; XF86MonBrightnessUp = "exec brightnessctl s 10+%";
XF86MonBrightnessDown = "exec brightnessctl s 10-%"; XF86MonBrightnessDown = "exec brightnessctl s 10-%";
}; };
autolaunch = [ # fixme: absolute paths autolaunch = [
# fixme: absolute paths
"blueman-applet" "blueman-applet"
"lxqt-policykit-agent" "lxqt-policykit-agent"
"otd-daemon" "otd-daemon"