From 48387d08e3b396d01a15233ca46e6d369ec0975b Mon Sep 17 00:00:00 2001 From: MFlossmann Date: Wed, 3 Jul 2024 00:38:20 +0200 Subject: [PATCH] formatting --- hosts/default/configuration.nix | 27 +++++++------ hosts/default/home.nix | 9 +++-- hosts/remus/configuration.nix | 38 ++++++++++-------- hosts/remus/hardware-configuration.nix | 42 +++++++++++--------- hosts/remus/home.nix | 10 +++-- modules/home/bundles/core.nix | 6 +-- modules/home/bundles/desktop.nix | 2 +- modules/home/bundles/graphicDesign.nix | 2 + modules/home/default.nix | 15 ++++--- modules/nixOS/bundles/core/sops.nix | 3 +- modules/nixOS/bundles/users.nix | 8 ++-- modules/nixOS/default.nix | 38 +++++++++--------- modules/nixOS/features/defaultLocale.nix | 7 +++- modules/nixOS/services/syncthing/default.nix | 33 ++++++++------- 14 files changed, 129 insertions(+), 111 deletions(-) diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index cb86d6d..8b0ab23 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -1,17 +1,19 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, inputs, ... }: - { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ]; + config, + pkgs, + inputs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; # Bootloader. boot.loader.systemd-boot.enable = true; @@ -87,15 +89,15 @@ users.users.prunebutt = { isNormalUser = true; description = "prunebutt"; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = ["networkmanager" "wheel"]; packages = with pkgs; [ firefox - # thunderbird + # thunderbird ]; }; home-manager = { - extraSpecialArgs = { inherit inputs; }; + extraSpecialArgs = {inherit inputs;}; users = { "prunebutt" = import ./home.nix; }; @@ -138,5 +140,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 88b1d45..29ef1dd 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -1,6 +1,8 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "prunebutt"; @@ -38,11 +40,10 @@ ]; programs.zsh.enable = true; - + programs.neovim.enable = true; programs.neovim.defaultEditor = true; - # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. home.file = { diff --git a/hosts/remus/configuration.nix b/hosts/remus/configuration.nix index 32124af..ee6daac 100644 --- a/hosts/remus/configuration.nix +++ b/hosts/remus/configuration.nix @@ -1,11 +1,20 @@ -{ config, pkgs, lib, inputs, outputs, system, helperLib, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - outputs.nixosModules.default - ]; +{ + config, + pkgs, + lib, + inputs, + outputs, + system, + helperLib, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + outputs.nixosModules.default + ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; # Bootloader. boot.loader = { @@ -24,7 +33,6 @@ services.displayManager.defaultSession = "plasma"; programs.ssh.askPassword = lib.mkForce "${pkgs.kdePackages.ksshaskpass.out}/bin/ksshaskpass"; - myNixOS = { bundles.general-desktop.enable = true; @@ -67,13 +75,12 @@ services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { - # Modesetting is required. modesetting.enable = true; # Nvidia power management. Experimental, and can cause sleep/suspend to fail. # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead # of just the bare essentials. powerManagement.enable = true; @@ -83,15 +90,15 @@ # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus # Only available from driver 515.43.04+ # Currently alpha-quality/buggy, so false is currently the recommended setting. open = false; # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. + # accessible via `nvidia-settings`. nvidiaSettings = true; # Optionally, you may need to select the appropriate driver version for your specific GPU. @@ -104,7 +111,7 @@ }; programs.gamemode.enable = true; - environment.systemPackages = with pkgs; [ protonup ]; + environment.systemPackages = with pkgs; [protonup]; environment.sessionVariables = { STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/prunebutt/.steam/root/compatibilitytools.d"; }; @@ -122,5 +129,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/remus/hardware-configuration.nix b/hosts/remus/hardware-configuration.nix index b66036d..abf0330 100644 --- a/hosts/remus/hardware-configuration.nix +++ b/hosts/remus/hardware-configuration.nix @@ -1,32 +1,36 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/c849b1d0-f6b0-414b-a2f8-15add0b2b637"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/c849b1d0-f6b0-414b-a2f8-15add0b2b637"; + fsType = "btrfs"; + options = ["subvol=@"]; + }; boot.initrd.luks.devices."luks-2875a668-8d20-46b1-9c37-843c250be560".device = "/dev/disk/by-uuid/2875a668-8d20-46b1-9c37-843c250be560"; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/4D76-7705"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4D76-7705"; + fsType = "vfat"; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/remus/home.nix b/hosts/remus/home.nix index e68fd99..3624319 100644 --- a/hosts/remus/home.nix +++ b/hosts/remus/home.nix @@ -1,9 +1,11 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { # home.username = "prunebutt"; # home.homeDirectory = "/home/prunebutt"; - home = let + home = let user = "prunebutt"; in { username = "${user}"; @@ -43,7 +45,7 @@ }; programs.zsh.enable = true; - + # Let Home Manager install and manage itself. # programs.home-manager.enable = true; } diff --git a/modules/home/bundles/core.nix b/modules/home/bundles/core.nix index ef6752c..e69fc43 100644 --- a/modules/home/bundles/core.nix +++ b/modules/home/bundles/core.nix @@ -6,7 +6,6 @@ ... }: { imports = [ - inputs.nixvim.homeManagerModules.nixvim ]; nixpkgs.config = { @@ -51,7 +50,6 @@ EDITOR = "nvim"; }; - # programs.neovim.enable = true; - # programs.neovim.defaultEditor = true; - programs.nixvim.enable = true; + programs.neovim.enable = true; + programs.neovim.defaultEditor = true; } diff --git a/modules/home/bundles/desktop.nix b/modules/home/bundles/desktop.nix index 12e6e4a..a1e63b4 100644 --- a/modules/home/bundles/desktop.nix +++ b/modules/home/bundles/desktop.nix @@ -14,7 +14,7 @@ ]; programs.firefox = { - enable = true; + enable = true; }; # TODO: fill this out (and move it in a service, probably) diff --git a/modules/home/bundles/graphicDesign.nix b/modules/home/bundles/graphicDesign.nix index 837515f..4ff77c9 100644 --- a/modules/home/bundles/graphicDesign.nix +++ b/modules/home/bundles/graphicDesign.nix @@ -11,5 +11,7 @@ inkscape-with-extensions gimp krita + + xournalpp ]; } diff --git a/modules/home/default.nix b/modules/home/default.nix index 52aac48..c0fbcf9 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,5 +1,5 @@ -{ - pkgs, +{ + pkgs, system, inputs, config, @@ -31,13 +31,12 @@ configExtension = config: (lib.mkIf cfg.bundles.${name}.enable config); }) (helperLib.filesIn ./bundles); - in { - imports = [ - ] - # ++ features - ++ bundles - ; + imports = + [ + ] + # ++ features + ++ bundles; config = { myHomeManager = { diff --git a/modules/nixOS/bundles/core/sops.nix b/modules/nixOS/bundles/core/sops.nix index cce8696..23a89fc 100644 --- a/modules/nixOS/bundles/core/sops.nix +++ b/modules/nixOS/bundles/core/sops.nix @@ -18,7 +18,7 @@ in { age = { # automatically import host SSH keys as age keys - sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; # this will use an age key that is expected to already be in the filesystem keyFile = "/var/lib/sops-nix/key.txt"; # generate a new key if the key specified above does not exist @@ -34,4 +34,3 @@ in { sops ]; } - diff --git a/modules/nixOS/bundles/users.nix b/modules/nixOS/bundles/users.nix index a9f63e7..63f83ce 100644 --- a/modules/nixOS/bundles/users.nix +++ b/modules/nixOS/bundles/users.nix @@ -1,7 +1,7 @@ { lib, config, - inputs, + inputs, outputs, helperLib, pkgs, @@ -10,7 +10,7 @@ cfg = config.myNixOS; in { options.myNixOS.home-users = lib.mkOption { - type = lib.types.attrsOf ( lib.types.submodule { + type = lib.types.attrsOf (lib.types.submodule { options = { userConfig = lib.mkOption { example = "home.nix"; @@ -37,13 +37,13 @@ in { outputs = inputs.self.outputs; }; - users = + users = builtins.mapAttrs (name: user: {...}: { imports = [ (import user.userConfig) outputs.homeManagerModules.default ]; - }) + }) (config.myNixOS.home-users); }; diff --git a/modules/nixOS/default.nix b/modules/nixOS/default.nix index 1deccfc..fabed4e 100644 --- a/modules/nixOS/default.nix +++ b/modules/nixOS/default.nix @@ -1,19 +1,19 @@ -{ - pkgs, +{ + pkgs, config, - lib, - inputs, - outputs, + lib, + inputs, + outputs, helperLib, ... }: let cfg = config.myNixOS; # Taking all modules in ./features and adding enables to them - features = + features = helperLib.extendModules - (name: { - extraOptions = { + (name: { + extraOptions = { myNixOS.${name}.enable = lib.mkEnableOption "enable my ${name} configuration"; }; @@ -22,7 +22,7 @@ (helperLib.filesIn ./features); # taking all module bundles in ./bundles and adding bundle.enables to them - bundles = + bundles = helperLib.extendModules (name: { extraOptions = { @@ -34,7 +34,7 @@ (helperLib.filesIn ./bundles); # taking all module services in ./services and adding service.enables to them - services = + services = helperLib.extendModules (name: { extraOptions = { @@ -45,14 +45,13 @@ }) (helperLib.filesIn ./services); in { - imports = - [ - inputs.home-manager.nixosModules.home-manager - ] - ++ features - ++ bundles - ++ services - ; + imports = + [ + inputs.home-manager.nixosModules.home-manager + ] + ++ features + ++ bundles + ++ services; options.myNixOS = { sharedSettings = { @@ -68,7 +67,6 @@ in { }; }; - config = { nix.settings.experimental-features = ["nix-command" "flakes"]; programs.nix-ld.enable = true; @@ -81,7 +79,6 @@ in { defaultLocale.enable = lib.mkDefault true; }; }; - } # imports = [ # ./neo.nix @@ -95,3 +92,4 @@ in { # pipewire.enable = lib.mkDefault true; # pipewire.useJack = lib.mkDefault false; # } + diff --git a/modules/nixOS/features/defaultLocale.nix b/modules/nixOS/features/defaultLocale.nix index a0ac99e..488398d 100644 --- a/modules/nixOS/features/defaultLocale.nix +++ b/modules/nixOS/features/defaultLocale.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ...}: { +{ + pkgs, + lib, + config, + ... +}: { config = { time.timeZone = lib.mkDefault "Europe/Berlin"; diff --git a/modules/nixOS/services/syncthing/default.nix b/modules/nixOS/services/syncthing/default.nix index bbaeaca..af60d91 100644 --- a/modules/nixOS/services/syncthing/default.nix +++ b/modules/nixOS/services/syncthing/default.nix @@ -4,13 +4,13 @@ lib, inputs, ... - }: let - webGuiPort = [ 8384 ]; - cfg = config; - secretsFile = "../../../secrets/secrets.json"; - secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile}); - devices = builtins.attrNames secretsSet.syncthing.devices; - in { +}: let + webGuiPort = [8384]; + cfg = config; + secretsFile = "../../../secrets/secrets.json"; + secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile}); + devices = builtins.attrNames secretsSet.syncthing.devices; +in { options = { rootDir = lib.mkOption { type = lib.types.path; @@ -29,11 +29,11 @@ overrideFolders = true; settings = { devices = { - "saintAlphonso" = { id ="LHASNUO-CXALARH-XI3TU4U-OCULV72-HS3HQ35-P4FECIT-UZ5VMSZ-PMCEPQH"; }; - "littleUmbrella" = { id ="BH3OHYP-TGGOSZO-EM6MXRY-YHSBOUO-CQHE7DL-N2LOUFY-TF3LEJ7-FHTGTQI"; }; - "pixelRoot" = { id ="PO7U5SE-DYKTOM2-TFDS3BM-A25VK7V-MQ3VPFM-EFX3J4D-B3UDCX4-3XQAIAC"; }; - "pixelDefault" = { id ="HC3CKC7-OUZBLU3-JIKTRYG-DPJE6EC-7POCWNS-6VNOPDU-L7OWYWO-PL332AY"; }; - "pixelGooglor" = { id ="OWDM4I2-O6STMIS-H3EXF65-FSM26K3-5FLQXRN-VOK7JGC-T6H76IR-QAVO3QK"; }; + "saintAlphonso" = {id = "LHASNUO-CXALARH-XI3TU4U-OCULV72-HS3HQ35-P4FECIT-UZ5VMSZ-PMCEPQH";}; + "littleUmbrella" = {id = "BH3OHYP-TGGOSZO-EM6MXRY-YHSBOUO-CQHE7DL-N2LOUFY-TF3LEJ7-FHTGTQI";}; + "pixelRoot" = {id = "PO7U5SE-DYKTOM2-TFDS3BM-A25VK7V-MQ3VPFM-EFX3J4D-B3UDCX4-3XQAIAC";}; + "pixelDefault" = {id = "HC3CKC7-OUZBLU3-JIKTRYG-DPJE6EC-7POCWNS-6VNOPDU-L7OWYWO-PL332AY";}; + "pixelGooglor" = {id = "OWDM4I2-O6STMIS-H3EXF65-FSM26K3-5FLQXRN-VOK7JGC-T6H76IR-QAVO3QK";}; }; folders = { @@ -41,7 +41,10 @@ label = "KeepassXC"; id = "xd4de-mjfcq"; devices = ["littleUmbrella" "pixelRoot" "pixelDefault" "pixelGooglor" "saintAlphonso"]; - versioning = { type = "simple"; params.keep = "5"; }; + versioning = { + type = "simple"; + params.keep = "5"; + }; }; }; }; @@ -51,6 +54,6 @@ # 22000 TCP and/or UDP for sync traffic # 21027/UDP for discovery # source: https://docs.syncthing.net/users/firewall.html - networking.firewall.allowedTCPPorts = [ 8384 22000 ]; - networking.firewall.allowedUDPPorts = [ 22000 21027 ]; + networking.firewall.allowedTCPPorts = [8384 22000]; + networking.firewall.allowedUDPPorts = [22000 21027]; }