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;
in {
config = with cfg; lib.mkIf (enable && cloudSync.enable) (let
in
{
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'';
sync_server = "https://${config.grimmShared.cloudSync.server}";
in {
in
{
environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
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;
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);
in "${cloud_cmd} /${remote_clean} ${local} ${sync_server}" ) paths);
in { # user-specific sync jobs
in
"${cloud_cmd} /${remote_clean} ${local} ${sync_server}")
paths);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud";
after = [ "network-online.target" ];
@ -30,11 +42,16 @@ in {
wantedBy = [ "multi-user.target" ];
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;
in { # user-specific sync jobs
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes";
timerConfig.OnBootSec = "5min";
@ -42,6 +59,8 @@ in {
wantedBy = [ "multi-user.target" "timers.target" ];
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;
in {
in
{
config = with cfg; lib.mkIf (enable && firefox.enable) {
environment.systemPackages = [ ]
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
@ -16,11 +18,15 @@ in {
(lib.mkIf cfg.firefox.disableUserPlugins {
"*".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";
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" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,8 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
in
{
config = with cfg; lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
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;
in {
in
{
config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true;
hardware.pulseaudio.enable = false;

View file

@ -1,7 +1,10 @@
{ pkgs, config, lib, ... }: let
{ pkgs, config, lib, ... }:
let
cfg = config.grimmShared;
in {
config = let
in
{
config =
let
waybar_full = pkgs.writeShellScriptBin "waybar-full" (
"${config.programs.waybar.package}/bin/waybar"
+ (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_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = map (item: "exec " + item);
build_mode_lines = lib.mapAttrsToList (name: value: ''
mode "${name}" {
${lib.strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in ([]
in
([ ]
++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds)
++ (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;
in with cfg; lib.mkIf (enable && sway.enable) {
in
with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."sway.conf" = {
source = sway_conf;
};

View file

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

View file

@ -5,7 +5,8 @@
{ config, fetchpatch, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
[
# Include the results of the hardware scan.
./modules/fonts.nix
./modules/tabletdriver.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";
in {
in
{
nixosConfigurations = {
grimmauld-nixos = nixpkgs.lib.nixosSystem {
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 = {
enable = mkEnableOption "grimm-shared-common";

View file

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

View file

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

View file

@ -1,6 +1,7 @@
let
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 ];
"nextcloud_pass.age".publicKeys = [ laptop_pub ];
}

View file

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

View file

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

View file

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