diff options
author | Karel Kočí <cynerd@email.cz> | 2023-01-08 11:25:01 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2023-01-08 11:25:01 +0100 |
commit | d5dc7479c489d17e6dcacf081c0f1b5242d99bd9 (patch) | |
tree | c12d18231cacb81ff5b69a2073894d228e3c81e7 | |
parent | c7a226a92d65cedd384fa29083efdbb07a6084b0 (diff) | |
download | nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.gz nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.bz2 nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.zip |
Format using Alejandra
54 files changed, 1274 insertions, 963 deletions
diff --git a/devShells/c.nix b/devShells/c.nix index d015cb4..7aba33f 100644 --- a/devShells/c.nix +++ b/devShells/c.nix @@ -1,37 +1,52 @@ -{ system, nixpkgs -, default -}: -let +{ + system, + nixpkgs, + default, +}: let pkgs = nixpkgs.legacyPackages.${system}; +in + pkgs.mkShell { + packages = with pkgs; [ + clang-tools_14 + ctags + gcc + gdb + pkg-config -in pkgs.mkShell { - packages = (with pkgs; [ + gnumake + bear + meson + ninja + cmake - clang-tools_14 ctags - gcc gdb pkg-config + valgrind + lcov + massif-visualizer + cppcheck + flawfinder - gnumake bear - meson ninja - cmake + check + curl + ncurses + flex + bison + gperf + gobject-introspection + gtk3 + gtk4 - valgrind - lcov massif-visualizer - cppcheck flawfinder + # Various libraries + openssl.dev + zlib.dev + curl.dev + libconfig + czmq + libevent.dev - check - curl - ncurses - flex bison gperf - gobject-introspection - gtk3 gtk4 - - # Various libraries - openssl.dev zlib.dev curl.dev libconfig - czmq libevent.dev - - # LVGL - SDL2 libffi.dev - ]); - inputsFrom = with pkgs; [ default ]; - meta.platforms = nixpkgs.lib.platforms.linux; -} + # LVGL + SDL2 + libffi.dev + ]; + inputsFrom = with pkgs; [default]; + meta.platforms = nixpkgs.lib.platforms.linux; + } diff --git a/devShells/default.nix b/devShells/default.nix index 1e8dee3..88d3638 100644 --- a/devShells/default.nix +++ b/devShells/default.nix @@ -1,22 +1,28 @@ -{ nixpkgs, shellrc, system }: -let - +{ + nixpkgs, + shellrc, + system, +}: let callDevelop = nixpkgs.lib.callPackageWith ({ inherit system; inherit nixpkgs; - } // shells); + } + // shells); shells = { default = nixpkgs.legacyPackages.${system}.mkShell { - inputsFrom = [ shellrc.packages.${system}.default ]; + inputsFrom = [shellrc.packages.${system}.default]; }; - armv6 = callDevelop ./nuttx.nix { arch = "armv6s-m"; }; - armv7e = callDevelop ./nuttx.nix { arch = "armv7e-m"; fpu = "vfpv3-d16"; }; - espc = callDevelop ./nuttx.nix { arch = "rv32imc"; }; - c = callDevelop ./c.nix { }; - qt = callDevelop ./qt.nix { }; + armv6 = callDevelop ./nuttx.nix {arch = "armv6s-m";}; + armv7e = callDevelop ./nuttx.nix { + arch = "armv7e-m"; + fpu = "vfpv3-d16"; + }; + espc = callDevelop ./nuttx.nix {arch = "rv32imc";}; + c = callDevelop ./c.nix {}; + qt = callDevelop ./qt.nix {}; #riscv = callDevelop ./riscv.nix { }; }; - -in shells +in + shells diff --git a/devShells/nuttx.nix b/devShells/nuttx.nix index 2d3e271..14367c6 100644 --- a/devShells/nuttx.nix +++ b/devShells/nuttx.nix @@ -1,31 +1,42 @@ -{ system, nixpkgs -, default, c -, arch, fpu ? null +{ + system, + nixpkgs, + default, + c, + arch, + fpu ? null, }: with builtins; -with nixpkgs.lib; -let +with nixpkgs.lib; let pkgs = import nixpkgs.outPath { localSystem = system; crossSystem = { - config = if (hasPrefix "armv" arch) then - "arm-none-eabi" + (optionalString (fpu != null) "hf") + config = + if (hasPrefix "armv" arch) + then "arm-none-eabi" + (optionalString (fpu != null) "hf") else "riscv32-none-elf"; libc = "newlib-nano"; - gcc = { - arch = arch; - } // (optionalAttrs (fpu != null) { fpu = fpu; }); + gcc = + { + arch = arch; + } + // (optionalAttrs (fpu != null) {fpu = fpu;}); }; }; - -in pkgs.buildPackages.mkShell { - packages = with pkgs.buildPackages; [ - kconfig-frontends genromfs xxd - openocd - gcc gdb - ] ++ (optionals (hasPrefix "rv32" arch) [ - esptool - ]); - inputsFrom = [ default c ]; - meta.platforms = nixpkgs.lib.platforms.linux; -} +in + pkgs.buildPackages.mkShell { + packages = with pkgs.buildPackages; + [ + kconfig-frontends + genromfs + xxd + openocd + gcc + gdb + ] + ++ (optionals (hasPrefix "rv32" arch) [ + esptool + ]); + inputsFrom = [default c]; + meta.platforms = nixpkgs.lib.platforms.linux; + } diff --git a/devShells/qt.nix b/devShells/qt.nix index caf9b99..b6450eb 100644 --- a/devShells/qt.nix +++ b/devShells/qt.nix @@ -1,27 +1,30 @@ -{ system, nixpkgs -, default, c -}: -let +{ + system, + nixpkgs, + default, + c, +}: let pkgs = nixpkgs.legacyPackages.${system}; +in + pkgs.mkShell { + packages = with pkgs; + with libsForQt5; [ + qtbase + qtserialport + qtwebsockets + doctest -in pkgs.mkShell { - packages = (with pkgs; with libsForQt5; [ - qtbase - qtserialport - qtwebsockets - doctest - - (qcoro.overrideAttrs (oldAttrs: { - version = "0.6.1"; - src = fetchFromGitHub { - owner = "danvratil"; - repo = "qcoro"; - rev = "261663560f59a162c0c82158a6cde41089668871"; - sha256 = "OAYJpoW3b0boSYBfuzLrFvlYSmP3SON8O6HsDQoi+I8="; - }; - buildInputs = oldAttrs.buildInputs ++ [qt5.qtbase]; - })) - ]); - inputsFrom = with pkgs; [ default c ]; - meta.platforms = ["x86_64-linux"]; -} + (qcoro.overrideAttrs (oldAttrs: { + version = "0.6.1"; + src = fetchFromGitHub { + owner = "danvratil"; + repo = "qcoro"; + rev = "261663560f59a162c0c82158a6cde41089668871"; + sha256 = "OAYJpoW3b0boSYBfuzLrFvlYSmP3SON8O6HsDQoi+I8="; + }; + buildInputs = oldAttrs.buildInputs ++ [qt5.qtbase]; + })) + ]; + inputsFrom = with pkgs; [default c]; + meta.platforms = ["x86_64-linux"]; + } diff --git a/devShells/riscv.nix b/devShells/riscv.nix index 99a0259..b3bbcea 100644 --- a/devShells/riscv.nix +++ b/devShells/riscv.nix @@ -1,7 +1,9 @@ -{ system, nixpkgs -, default, c -}: -let +{ + system, + nixpkgs, + default, + c, +}: let pkgs = import nixpkgs.outPath { localSystem = system; crossSystem = { @@ -12,12 +14,13 @@ let }; }; }; - -in pkgs.buildPackages.mkShell { - packages = with pkgs.buildPackages; [ - qtrvsim - gcc pkg-config - ]; - inputsFrom = [ default c ]; - meta.platforms = nixpkgs.lib.platforms.linux; -} +in + pkgs.buildPackages.mkShell { + packages = with pkgs.buildPackages; [ + qtrvsim + gcc + pkg-config + ]; + inputsFrom = [default c]; + meta.platforms = nixpkgs.lib.platforms.linux; + } @@ -17,18 +17,39 @@ usbkey.url = "git+https://git.cynerd.cz/usbkey?ref=modules"; }; - outputs = { self, nixpkgs, nix, nixos-hardware, flake-utils, shellrc, ... }: + outputs = { + self, + nixpkgs, + nix, + nixos-hardware, + flake-utils, + shellrc, + ... + }: with flake-utils.lib; - { - overlays.default = final: prev: import ./pkgs { inherit self; nixpkgs = prev; }; - nixosModules = import ./nixos self; - nixosConfigurations = import ./nixos/configurations.nix self; - } // eachDefaultSystem (system: { - packages = filterPackages system (flattenTree ( - import ./pkgs { inherit self; nixpkgs = nixpkgs.legacyPackages."${system}"; } - )); - devShells = filterPackages system - (import ./devShells { inherit nixpkgs; inherit shellrc; inherit system; }); - }); - + { + overlays.default = final: prev: + import ./pkgs { + inherit self; + nixpkgs = prev; + }; + nixosModules = import ./nixos self; + nixosConfigurations = import ./nixos/configurations.nix self; + } + // eachDefaultSystem (system: { + packages = filterPackages system (flattenTree ( + import ./pkgs { + inherit self; + nixpkgs = nixpkgs.legacyPackages."${system}"; + } + )); + devShells = + filterPackages system + (import ./devShells { + inherit nixpkgs; + inherit shellrc; + inherit system; + }); + formatter = nixpkgs.legacyPackages.${system}.alejandra; + }); } diff --git a/nixos/configurations.nix b/nixos/configurations.nix index 9754d28..24256b3 100644 --- a/nixos/configurations.nix +++ b/nixos/configurations.nix @@ -1,35 +1,38 @@ self: with self.inputs; -let - - modules = hostname: [ - self.nixosModules.default - self.nixosModules."machine-${hostname}" - shellrc.nixosModules.default - usbkey.nixosModules.default - nixbigclown.nixosModules.default - (personal-secret.lib.personalSecrets hostname) - { - networking.hostName = hostname; - nixpkgs.overlays = [ - self.overlays.default - sterm.overlay - ]; - } - ]; +with builtins; +with nixpkgs.lib; let + modules = hostname: + [ + self.nixosModules.default + shellrc.nixosModules.default + usbkey.nixosModules.default + nixbigclown.nixosModules.default + (personal-secret.lib.personalSecrets hostname) + { + networking.hostName = hostname; + nixpkgs.overlays = [ + self.overlays.default + sterm.overlay + ]; + } + ] + ++ (optional (hasAttr "machine-${hostname}" self.nixosModules) self.nixosModules."machine-${hostname}"); - genericSystem = {system ? "x86_64-linux", extra_modules ? []}: - hostname: { - ${hostname} = nixpkgs.lib.nixosSystem { - system = system; - modules = (modules hostname) ++ extra_modules; - }; + genericSystem = { + system ? "x86_64-linux", + extra_modules ? [], + }: hostname: { + ${hostname} = nixpkgs.lib.nixosSystem { + system = system; + modules = (modules hostname) ++ extra_modules; }; - amd64System = genericSystem { }; + }; + amd64System = genericSystem {}; vpsSystem = genericSystem { extra_modules = [ vpsadminos.nixosConfigurations.container - { boot.loader.systemd-boot.enable = false; } + {boot.loader.systemd-boot.enable = false;} ]; }; raspi2System = genericSystem { @@ -54,7 +57,8 @@ let boot.loader.grub.enable = false; boot.loader.systemd-boot.enable = false; boot.loader.raspberryPi = { - enable = true; version = 3; + enable = true; + version = 3; }; }) ]; @@ -72,6 +76,21 @@ let ]; }; + vmSystem = system: hostSystem: + genericSystem { + system = system; + extra_modules = [ + nixturris.nixosModules.turris-crossbuild + { + boot.loader.systemd-boot.enable = false; + virtualisation.qemu.package = self.nixosConfigurations."${hostSystem}".pkgs.qemu; + } + ]; + }; + amd64vmSystem = vmSystem "x86_64-linux"; + armv7lvmSystem = vmSystem "armv7l-linux"; + aarch64vmSystem = vmSystem "aarch64-linux"; + turrisSystem = board: hostname: { ${hostname} = nixturris.lib.nixturrisSystem { nixpkgs = nixpkgs; @@ -81,21 +100,20 @@ let }; turrisMoxSystem = turrisSystem "mox"; turrisOmniaSystem = turrisSystem "omnia"; - in - amd64System "albert" // - amd64System "binky" // - amd64System "errol" // - amd64System "ridcully" // - amd64System "susan" // - vpsSystem "lipwig" // - vpsSystem "mrpump" // - raspi2System "spt-mpd" // - raspi3System "adm-mpd" // - beagleboneSystem "gaspode" // - turrisMoxSystem "dean" // - turrisOmniaSystem "spt-omnia" // - turrisMoxSystem "spt-mox" // - turrisMoxSystem "spt-mox2" // - turrisOmniaSystem "adm-omnia" // - turrisOmniaSystem "adm-omnia2" + amd64System "albert" + // amd64System "binky" + // amd64System "errol" + // amd64System "ridcully" + // amd64System "susan" + // vpsSystem "lipwig" + // vpsSystem "mrpump" + // raspi2System "spt-mpd" + // raspi3System "adm-mpd" + // beagleboneSystem "gaspode" + // turrisMoxSystem "dean" + // turrisOmniaSystem "spt-omnia" + // turrisMoxSystem "spt-mox" + // turrisMoxSystem "spt-mox2" + // turrisOmniaSystem "adm-omnia" + // turrisOmniaSystem "adm-omnia2" diff --git a/nixos/default.nix b/nixos/default.nix index 790ea40..7569de0 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,8 +1,9 @@ self: let - modules = import ./modules; machines = import ./machine self; - -in modules // machines // { - default = { imports = builtins.attrValues modules; }; -} +in + modules + // machines + // { + default = {imports = builtins.attrValues modules;}; + } diff --git a/nixos/machine/adm-mpd.nix b/nixos/machine/adm-mpd.nix index 45855e1..a35c944 100644 --- a/nixos/machine/adm-mpd.nix +++ b/nixos/machine/adm-mpd.nix @@ -1,11 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { - fileSystems = { "/" = { device = "/dev/mmcblk0p2"; @@ -28,9 +28,9 @@ with lib; }; #services.pipewire = { - #enable = true; - #alsa.enable = true; - #pulse.enable = true; + #enable = true; + #alsa.enable = true; + #pulse.enable = true; #}; hardware.pulseaudio = { enable = true; @@ -52,7 +52,5 @@ with lib; initial_volume = 60; }; }; - }; - } diff --git a/nixos/machine/adm-omnia.nix b/nixos/machine/adm-omnia.nix index 71104e9..4a41d4a 100644 --- a/nixos/machine/adm-omnia.nix +++ b/nixos/machine/adm-omnia.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { #openvpn.oldpersonal = true; @@ -14,7 +15,11 @@ with lib; bridges = { brlan = { interfaces = [ - "lan0" "lan1" "lan2" "lan3" "lan4" + "lan0" + "lan1" + "lan2" + "lan3" + "lan4" ]; }; #brguest = { @@ -25,15 +30,17 @@ with lib; }; interfaces.brlan = { ipv4 = { - addresses = [{ - address = config.cynerd.hosts.adm.omnia; - prefixLength = 24; - }]; + addresses = [ + { + address = config.cynerd.hosts.adm.omnia; + prefixLength = 24; + } + ]; }; }; # TODO localhost - nameservers = [ "1.1.1.1" "8.8.8.8" ]; - dhcpcd.allowInterfaces = [ "eth2" ]; + nameservers = ["1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["eth2"]; }; networking.wirelessAP = { @@ -60,7 +67,5 @@ with lib; }; }; }; - }; - } diff --git a/nixos/machine/adm-omnia2.nix b/nixos/machine/adm-omnia2.nix index 0bdc3bc..ac4433d 100644 --- a/nixos/machine/adm-omnia2.nix +++ b/nixos/machine/adm-omnia2.nix @@ -1,15 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { networking = { bridges = { brlan = { interfaces = [ - "eth2" "lan0" "lan1" "lan2" "lan3" "lan4" + "eth2" + "lan0" + "lan1" + "lan2" + "lan3" + "lan4" ]; }; }; @@ -32,16 +38,17 @@ with lib; }; interfaces.lan = { ipv4 = { - addresses = [{ - address = config.cynerd.hosts.adm.omnia2; - prefixLength = 24; - }]; + addresses = [ + { + address = config.cynerd.hosts.adm.omnia2; + prefixLength = 24; + } + ]; }; }; defaultGateway = config.cynerd.hosts.adm.omnia; - nameservers = [ config.cynerd.hosts.adm.omnia "1.1.1.1" "8.8.8.8" ]; - dhcpcd.allowInterfaces = [ "lan" ]; + nameservers = [config.cynerd.hosts.adm.omnia "1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["lan"]; }; }; - } diff --git a/nixos/machine/albert.nix b/nixos/machine/albert.nix index bc35f96..68d55ba 100644 --- a/nixos/machine/albert.nix +++ b/nixos/machine/albert.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { desktop = { @@ -42,7 +43,5 @@ with lib; options = ["compress=lzo" "subvol=@home"]; }; }; - }; - } diff --git a/nixos/machine/binky.nix b/nixos/machine/binky.nix index 7be8017..a90d625 100644 --- a/nixos/machine/binky.nix +++ b/nixos/machine/binky.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { desktop = { @@ -61,7 +62,5 @@ with lib; dataDir = "/home/cynerd"; configDir = "/home/cynerd/.config/syncthing"; }; - }; - } diff --git a/nixos/machine/dean.nix b/nixos/machine/dean.nix index aef3c04..8fca4bf 100644 --- a/nixos/machine/dean.nix +++ b/nixos/machine/dean.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { openvpn = { @@ -15,23 +16,27 @@ with lib; bridges = { brlan = { interfaces = [ - "eth0" "lan1" "lan2" "lan3" "lan4" + "eth0" + "lan1" + "lan2" + "lan3" + "lan4" ]; }; }; - dhcpcd.allowInterfaces = [ "brlan" ]; + dhcpcd.allowInterfaces = ["brlan"]; }; - swapDevices = [{ - device = "/var/swap"; - priority = 1; - }]; + swapDevices = [ + { + device = "/var/swap"; + priority = 1; + } + ]; environment.systemPackages = with pkgs; [ #openocd sterm ]; - }; - } diff --git a/nixos/machine/errol.nix b/nixos/machine/errol.nix index 70bc8cf..4a696b1 100644 --- a/nixos/machine/errol.nix +++ b/nixos/machine/errol.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { desktop.enable = true; @@ -87,12 +88,11 @@ with lib; }; extraComponents = []; package = pkgs.home-assistant.override { - extraPackages = pkgs: with pkgs; [ - securetar - ]; + extraPackages = pkgs: + with pkgs; [ + securetar + ]; }; }; - }; - } diff --git a/nixos/machine/gaspode.nix b/nixos/machine/gaspode.nix index 82762f1..cbd08bb 100644 --- a/nixos/machine/gaspode.nix +++ b/nixos/machine/gaspode.nix @@ -1,11 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { - fileSystems = { "/" = { device = "/dev/mmcblk0p2"; @@ -19,7 +19,5 @@ with lib; device = "/dev/mmcblk0p1"; }; }; - }; - } diff --git a/nixos/machine/lipwig.nix b/nixos/machine/lipwig.nix index ef90385..0ebf894 100644 --- a/nixos/machine/lipwig.nix +++ b/nixos/machine/lipwig.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { syncthing = { @@ -38,7 +39,7 @@ with lib; enable = true; settings = { server = { - hosts = [ "0.0.0.0:5232" "[::]:5232" ]; + hosts = ["0.0.0.0:5232" "[::]:5232"]; ssl = true; certificate = "/run/secrets/radicale/radicale.crt"; key = "/run/secrets/radicale/radicale.key"; @@ -62,5 +63,4 @@ with lib; }; }; }; - } diff --git a/nixos/machine/mrpump.nix b/nixos/machine/mrpump.nix index 0b322dc..68de482 100644 --- a/nixos/machine/mrpump.nix +++ b/nixos/machine/mrpump.nix @@ -1,21 +1,21 @@ -self: { config, lib, pkgs, ... }: - +self: { + config, + lib, + pkgs, + ... +}: with builtins; -with lib; - -{ - +with lib; { config = let - localNix = import (self.inputs.nix.outPath + "/docker.nix") { pkgs = pkgs; name = "local/nix"; tag = "latest"; bundleNixpkgs = false; - extraPkgs = with pkgs; [ cachix ]; + extraPkgs = with pkgs; [cachix]; nixConf = { cores = "0"; - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = ["nix-command" "flakes"]; }; }; localNixDaemon = pkgs.dockerTools.buildLayeredImage { @@ -24,14 +24,13 @@ with lib; tag = "latest"; config = { Volumes = { - "/nix/store" = { }; - "/nix/var/nix/db" = { }; - "/nix/var/nix/daemon-socket" = { }; + "/nix/store" = {}; + "/nix/var/nix/db" = {}; + "/nix/var/nix/daemon-socket" = {}; }; }; maxLayers = 125; }; - in { # MrPump won't see Errol anyway cynerd.hosts.enable = false; @@ -45,7 +44,7 @@ with lib; dates = "daily"; }; }; - users.users.cynerd.extraGroups = [ "docker" ]; + users.users.cynerd.extraGroups = ["docker"]; # Common container for the Gitlab Nix runner virtualisation.oci-containers = { @@ -59,7 +58,7 @@ with lib; # Gitlab runner systemd.services.gitlab-runner.serviceConfig = let - config = (pkgs.formats.toml{}).generate "gitlab-runner.toml" { + config = (pkgs.formats.toml {}).generate "gitlab-runner.toml" { concurrent = 1; runners = [ { @@ -118,7 +117,5 @@ with lib; ExecReload = mkForce "!${configureScript}"; }; services.gitlab-runner.enable = true; - }; - } diff --git a/nixos/machine/ridcully.nix b/nixos/machine/ridcully.nix index ad31e82..01e8f07 100644 --- a/nixos/machine/ridcully.nix +++ b/nixos/machine/ridcully.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { desktop.enable = true; @@ -63,7 +64,5 @@ with lib; dataDir = "/home/cynerd"; configDir = "/home/cynerd/.config/syncthing"; }; - }; - } diff --git a/nixos/machine/spt-mox.nix b/nixos/machine/spt-mox.nix index 57573ef..3ada201 100644 --- a/nixos/machine/spt-mox.nix +++ b/nixos/machine/spt-mox.nix @@ -1,10 +1,11 @@ -{ config, lib, pkgs, ... }: - -with builtins; -with lib; - { - + config, + lib, + pkgs, + ... +}: +with builtins; +with lib; { config = { cynerd.home-assistant = true; @@ -41,7 +42,11 @@ with lib; bridges = { brlan = { interfaces = [ - "eth0" "lan1" "lan2" "lan3" "lan4" + "eth0" + "lan1" + "lan2" + "lan3" + "lan4" ]; }; brguest = { @@ -52,17 +57,17 @@ with lib; }; interfaces.brlan = { ipv4 = { - addresses = [{ - address = config.cynerd.hosts.spt.mox; - prefixLength = 24; - }]; + addresses = [ + { + address = config.cynerd.hosts.spt.mox; + prefixLength = 24; + } + ]; }; }; defaultGateway = config.cynerd.hosts.spt.omnia; - nameservers = [ config.cynerd.hosts.spt.omnia "1.1.1.1" "8.8.8.8" ]; - dhcpcd.allowInterfaces = [ "brlan" ]; + nameservers = [config.cynerd.hosts.spt.omnia "1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["brlan"]; }; - }; - } diff --git a/nixos/machine/spt-mox2.nix b/nixos/machine/spt-mox2.nix index 71b95ac..8ecf1ad 100644 --- a/nixos/machine/spt-mox2.nix +++ b/nixos/machine/spt-mox2.nix @@ -1,19 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { - boot.kernelParams = [ "pcie_aspm=off" # Fix for crashes due to SError Interrupt on ath10k load ]; - swapDevices = [{ - device = "/dev/disk/by-partlabel/NixTurrisSwap"; - priority = 1; - }]; + swapDevices = [ + { + device = "/dev/disk/by-partlabel/NixTurrisSwap"; + priority = 1; + } + ]; networking.wirelessAP = { enable = true; @@ -61,16 +63,17 @@ with lib; }; interfaces.brlan = { ipv4 = { - addresses = [{ - address = config.cynerd.hosts.spt.mox2; - prefixLength = 24; - }]; + addresses = [ + { + address = config.cynerd.hosts.spt.mox2; + prefixLength = 24; + } + ]; }; }; defaultGateway = config.cynerd.hosts.spt.omnia; - nameservers = [ config.cynerd.hosts.spt.omnia "1.1.1.1" "8.8.8.8" ]; - dhcpcd.allowInterfaces = [ "brlan" ]; + nameservers = [config.cynerd.hosts.spt.omnia "1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["brlan"]; }; }; - } diff --git a/nixos/machine/spt-mpd.nix b/nixos/machine/spt-mpd.nix index f32c1db..ab960b5 100644 --- a/nixos/machine/spt-mpd.nix +++ b/nixos/machine/spt-mpd.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { fileSystems = { "/" = { @@ -13,5 +14,4 @@ with lib; }; }; }; - } diff --git a/nixos/machine/spt-omnia.nix b/nixos/machine/spt-omnia.nix index d2c4a96..8251b0b 100644 --- a/nixos/machine/spt-omnia.nix +++ b/nixos/machine/spt-omnia.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd = { openvpn.oldpersonal = true; @@ -14,7 +15,11 @@ with lib; bridges = { brlan = { interfaces = [ - "lan0" "lan1" "lan2" "lan3" "lan4" + "lan0" + "lan1" + "lan2" + "lan3" + "lan4" ]; }; #brguest = { @@ -25,14 +30,16 @@ with lib; }; interfaces.brlan = { ipv4 = { - addresses = [{ - address = config.cynerd.hosts.spt.omnia; - prefixLength = 24; - }]; + addresses = [ + { + address = config.cynerd.hosts.spt.omnia; + prefixLength = 24; + } + ]; }; }; - nameservers = [ "127.0.0.1" "1.1.1.1" "8.8.8.8" ]; - dhcpcd.allowInterfaces = [ "eth2" ]; + nameservers = ["127.0.0.1" "1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["eth2"]; }; services.syncthing = { @@ -44,7 +51,5 @@ with lib; dataDir = "/data"; }; - }; - } diff --git a/nixos/machine/susan.nix b/nixos/machine/susan.nix index b452ed9..d05120f 100644 --- a/nixos/machine/susan.nix +++ b/nixos/machine/susan.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { config = { cynerd.desktop.enable = true; @@ -20,7 +21,5 @@ with lib; device = "/dev/disk/by-uuid/EB3E-3635"; }; }; - }; - } diff --git a/nixos/modules/autounlock.nix b/nixos/modules/autounlock.nix index 0458c7b..7f7c24e 100644 --- a/nixos/modules/autounlock.nix +++ b/nixos/modules/autounlock.nix @@ -1,13 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.autounlock; - in { - options = { cynerd.autounlock = mkOption { type = with types; attrsOf string; @@ -17,24 +16,23 @@ in { }; config = mkIf (cnf != {}) { - - environment.systemPackages = [ pkgs.luks-hw-password ]; + environment.systemPackages = [pkgs.luks-hw-password]; boot.initrd = { extraFiles."/luks-hw-password".source = pkgs.luks-hw-password; - luks.devices = mapAttrs (name: value: { + luks.devices = + mapAttrs (name: value: { device = value; keyFile = "/keys/${name}.key"; fallbackToPassword = true; preOpenCommands = '' mkdir -p /keys /luks-hw-password/bin/luks-hw-password > /keys/${name}.key - ''; + ''; postOpenCommands = '' rm -rf /keys - ''; - }) cnf; + ''; + }) + cnf; }; - }; - } diff --git a/nixos/modules/compile.nix b/nixos/modules/compile.nix index ffa339f..6a6b7b2 100644 --- a/nixos/modules/compile.nix +++ b/nixos/modules/compile.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { options = { cynerd.compile = mkOption { type = types.bool; @@ -21,33 +22,32 @@ with lib; aarch64-linux = { fixBinary = true; wrapInterpreterInShell = false; - interpreter = (lib.systems.elaborate { system = "aarch64-linux"; }).emulator pkgs; + interpreter = (lib.systems.elaborate {system = "aarch64-linux";}).emulator pkgs; magicOrExtension = "\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00"; mask = "\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xfe\\xff\\xff\\xff"; }; armv7l-linux = { fixBinary = true; wrapInterpreterInShell = false; - interpreter = (lib.systems.elaborate { system = "armv7l-linux"; }).emulator pkgs; + interpreter = (lib.systems.elaborate {system = "armv7l-linux";}).emulator pkgs; magicOrExtension = "\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00"; mask = "\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xfe\\xff\\xff\\xff"; }; }; nix.settings.extra-platforms = [ - "aarch64-linux" "armv7l-linux" + "aarch64-linux" + "armv7l-linux" ]; environment.systemPackages = with pkgs; [ # Tools - git bash + git + bash #uroot qemu # Python python3Packages.pip - ]; - }; - } diff --git a/nixos/modules/desktop.nix b/nixos/modules/desktop.nix index 27beb04..e7c6ecc 100644 --- a/nixos/modules/desktop.nix +++ b/nixos/modules/desktop.nix @@ -1,12 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.desktop; - in { - options = { cynerd.desktop = { enable = mkOption { @@ -25,106 +25,146 @@ in { config = mkIf cnf.enable { programs.sway.enable = true; programs.sway.wrapperFeatures.gtk = true; - programs.sway.extraPackages = with pkgs; [ - gnome.dconf-editor - glib gsettings-desktop-schemas - i3blocks sysstat - wofi rofimoji wev - swaybackground myswaylock - - alacritty - - kanshi wdisplays wayvnc wl-mirror - slurp grim - wf-recorder - wl-clipboard wl-color-picker - swayidle - dunst libnotify - - isync msmtp notmuch astroid - taskwarrior vdirsyncer khal khard - gnupg pinentry-gnome pinentry-curses - (pass.withExtensions (exts: [ - exts.pass-otp exts.pass-audit - ])) - - firefox chromium - ferdium signal-desktop - libreoffice - mupdf pdfgrep - - xdg-utils xdg-launch - mesa-demos vulkan-tools - - pulsemixer - mpd mpc-cli ncmpcpp - feh shotwell id3lib - vlc mpv youtube-dl - - nordic - delft-icon-theme gnome.adwaita-icon-theme - vanilla-dmz - sound-theme-freedesktop - gucharmap - - (sdcv.withDictionaries [ stardict-en-cz stardict-de-cz stardict-cz ]) - - samba cifs-utils - - tigervnc freerdp - plasma5Packages.kdeconnect-kde - - hdparm ethtool multipath-tools - usb-modeswitch - v4l-utils - - # Calculating - python3Packages.numpy python3Packages.sympy python3Packages.matplotlib - - # Creation - simple-scan - audacity - gimp inkscape - blender - kdenlive - - # GStreamer - gst_all_1.gst-libav - gst_all_1.gst-plugins-bad - gst_all_1.gst-plugins-base - gst_all_1.gst-plugins-good - gst_all_1.gst-plugins-ugly - gst_all_1.gst-plugins-viperfx - - # Latex - texlive.combined.scheme-full - - # Gnome utils - gnome-firmware - gaphor - - # CAD - freecad - kicad-with-packages3d - sweethome3d.application - qelectrotech - - ] ++ (optionals cnf.laptop [ - # Power management - powertop - acpi - ]); + programs.sway.extraPackages = with pkgs; + [ + gnome.dconf-editor + glib + gsettings-desktop-schemas + i3blocks + sysstat + wofi + rofimoji + wev + swaybackground + myswaylock + + alacritty + + kanshi + wdisplays + wayvnc + wl-mirror + slurp + grim + wf-recorder + wl-clipboard + wl-color-picker + swayidle + dunst + libnotify + + isync + msmtp + notmuch + astroid + taskwarrior + vdirsyncer + khal + khard + gnupg + pinentry-gnome + pinentry-curses + (pass.withExtensions (exts: [ + exts.pass-otp + exts.pass-audit + ])) + + firefox + chromium + ferdium + signal-desktop + libreoffice + mupdf + pdfgrep + + xdg-utils + xdg-launch + mesa-demos + vulkan-tools + + pulsemixer + mpd + mpc-cli + ncmpcpp + feh + shotwell + id3lib + vlc + mpv + youtube-dl + + nordic + delft-icon-theme + gnome.adwaita-icon-theme + vanilla-dmz + sound-theme-freedesktop + gucharmap + + (sdcv.withDictionaries [stardict-en-cz stardict-de-cz stardict-cz]) + + samba + cifs-utils + + tigervnc + freerdp + plasma5Packages.kdeconnect-kde + + hdparm + ethtool + multipath-tools + usb-modeswitch + v4l-utils + + # Calculating + python3Packages.numpy + python3Packages.sympy + python3Packages.matplotlib + + # Creation + simple-scan + audacity + gimp + inkscape + blender + kdenlive + + # GStreamer + gst_all_1.gst-libav + gst_all_1.gst-plugins-bad + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-good + gst_all_1.gst-plugins-ugly + gst_all_1.gst-plugins-viperfx + + # Latex + texlive.combined.scheme-full + + # Gnome utils + gnome-firmware + gaphor + + # CAD + freecad + kicad-with-packages3d + sweethome3d.application + qelectrotech + ] + ++ (optionals cnf.laptop [ + # Power management + powertop + acpi + ]); programs.vim.package = pkgs.vimHugeX; programs.shellrc.desktop = true; xdg.portal.enable = true; xdg.portal.wlr.enable = true; - xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; + xdg.portal.extraPortals = with pkgs; [xdg-desktop-portal-gtk]; xdg.mime.defaultApplications = { - "text/html" = [ "firefox.desktop" ]; - "application/pdf" = [ "mupdf.desktop" ]; - "image/jpeg" = [ "feh.desktop" ]; - "image/png" = [ "feh.desktop" ]; - "image/svg" = [ "feh.desktop" ]; + "text/html" = ["firefox.desktop"]; + "application/pdf" = ["mupdf.desktop"]; + "image/jpeg" = ["feh.desktop"]; + "image/png" = ["feh.desktop"]; + "image/svg" = ["feh.desktop"]; }; programs.usbkey = { @@ -137,7 +177,7 @@ in { enableSSHSupport = true; enableBrowserSocket = true; }; - services.dbus.packages = [ pkgs.gcr ]; + services.dbus.packages = [pkgs.gcr]; programs.kdeconnect.enable = true; @@ -148,7 +188,7 @@ in { pulse.enable = true; config.pipewire = { context.modules = [ - { name = "libpipewire-module-zeroconf-discover"; } + {name = "libpipewire-module-zeroconf-discover";} ]; }; }; @@ -157,7 +197,8 @@ in { services.printing = { enable = true; drivers = with pkgs; [ - gutenprint gutenprintBin + gutenprint + gutenprintBin cnijfilter2 ]; }; @@ -167,8 +208,8 @@ in { enable = true; discovery = true; }; - networking.firewall.allowedTCPPorts = [ 5357 ]; - networking.firewall.allowedUDPPorts = [ 3702 ]; + networking.firewall.allowedTCPPorts = [5357]; + networking.firewall.allowedUDPPorts = [3702]; fonts.fonts = with pkgs; [ arkpandora_ttf @@ -188,7 +229,7 @@ in { services.udev.extraRules = '' ACTION=="add|change", KERNEL=="sd*[!0-9]", ATTR{queue/scheduler}="bfq" - ''; + ''; hardware.opengl.driSupport = true; hardware.opengl.driSupport32Bit = true; @@ -224,7 +265,7 @@ in { # Autologin on the first TTY services.getty = { - extraArgs = [ "--skip-login" ]; + extraArgs = ["--skip-login"]; loginProgram = "${pkgs.bash}/bin/sh"; loginOptions = toString (pkgs.writeText "login-program.sh" '' if [[ "$(tty)" == '/dev/tty1' ]]; then @@ -238,8 +279,22 @@ in { # VTI settings console = { colors = [ - "2e3440" "3b4252" "434c5e" "4c566a" "d8dee9" "e5e9f0" "eceff4" "8fbcbb" - "88c0d0" "81a1c1" "5e81ac" "bf616a" "d08770" "ebcb8b" "a3be8c" "b48ead" + "2e3440" + "3b4252" + "434c5e" + "4c566a" + "d8dee9" + "e5e9f0" + "eceff4" + "8fbcbb" + "88c0d0" + "81a1c1" + "5e81ac" + "bf616a" + "d08770" + "ebcb8b" + "a3be8c" + "b48ead" ]; earlySetup = true; useXkbConfig = true; @@ -248,6 +303,5 @@ in { services.gpm.enable = true; services.locate.enable = true; - }; } diff --git a/nixos/modules/develop.nix b/nixos/modules/develop.nix index 2bf085f..c7ab1d2 100644 --- a/nixos/modules/develop.nix +++ b/nixos/modules/develop.nix @@ -1,11 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let in { - options = { cynerd.develop = mkOption { type = types.bool; @@ -19,7 +19,10 @@ in { environment.enableDebugInfo = true; environment.systemPackages = with pkgs; [ # Tools - tig gource hub github-cli # Git + tig + gource + hub + github-cli # Git wlc # Weblate cloc openssl @@ -28,7 +31,9 @@ in { # Nix dev - nix-prefetch-git nix-prefetch-github nix-prefetch-scripts + nix-prefetch-git + nix-prefetch-github + nix-prefetch-scripts nix-universal-prefetch rnix-lsp cachix @@ -36,50 +41,61 @@ in { # Shell dash # Posix shell bats - shellcheck shfmt - jq yq + shellcheck + shfmt + jq + yq # Python - (python3.withPackages (pypkgs: with pypkgs; [ - ipython - - pytest pytest-html pytest-tap - coverage - python-lsp-black - pylint pydocstyle - - mypy - - pygobject3 - pygraphviz matplotlib - - python-gitlab PyGithub - - schema - jinja2 - ruamel-yaml - msgpack - urllib3 influxdb-client - - psycopg - - humanize rich - lorem-text.pythonPackage - - pyserial pylibftdi - pylxd - selenium - - paho-mqtt - - ])) + (python3.withPackages (pypkgs: + with pypkgs; [ + ipython + + pytest + pytest-html + pytest-tap + coverage + python-lsp-black + pylint + pydocstyle + + mypy + + pygobject3 + pygraphviz + matplotlib + + python-gitlab + PyGithub + + schema + jinja2 + ruamel-yaml + msgpack + urllib3 + influxdb-client + + psycopg + + humanize + rich + lorem-text.pythonPackage + + pyserial + pylibftdi + pylxd + selenium + + paho-mqtt + ])) geckodriver chromedriver # Lua - (lua5_1.withPackages (luapkgs: with luapkgs; [ - luacheck - ])) + (lua5_1.withPackages (luapkgs: + with luapkgs; [ + luacheck + ])) # Ansible ansible @@ -93,7 +109,8 @@ in { tftp-hpa # Network - iperf2 iperf3 + iperf2 + iperf3 wireshark inetutils @@ -107,7 +124,9 @@ in { dfeet # Documentation - man-pages man-pages-posix linux-manual + man-pages + man-pages-posix + linux-manual # SHV shvspy @@ -134,11 +153,13 @@ in { virtualisation.lxc.enable = true; virtualisation.libvirtd.enable = true; - users.groups.develop = { }; + users.groups.develop = {}; users.users.cynerd.extraGroups = [ - "docker" "lxd" "develop" "libvirtd" "wireshark" + "docker" + "lxd" + "develop" + "libvirtd" + "wireshark" ]; - }; - } diff --git a/nixos/modules/gaming.nix b/nixos/modules/gaming.nix index f61f85e..82a7335 100644 --- a/nixos/modules/gaming.nix +++ b/nixos/modules/gaming.nix @@ -1,12 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.gaming; - in { - options = { cynerd.gaming = mkOption { type = types.bool; @@ -29,12 +29,11 @@ in { }; nixpkgs.config.packageOverrides = pkgs: { steam = pkgs.steam.override { - extraPkgs = pkgs: with pkgs; [ - ncurses - ]; + extraPkgs = pkgs: + with pkgs; [ + ncurses + ]; }; }; - - }; } diff --git a/nixos/modules/generic.nix b/nixos/modules/generic.nix index 121133f..25fcbde 100644 --- a/nixos/modules/generic.nix +++ b/nixos/modules/generic.nix @@ -1,13 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let isNative = config.nixpkgs.crossSystem == null; - in { - config = { system.stateVersion = "22.05"; @@ -23,7 +22,7 @@ in { "thefloweringash-armv7.cachix.org-1:v+5yzBD2odFKeXbmC+OPWVqx4WVoIVO6UXgnSAWFtso=" "arm.cachix.org-1:K3XjAeWPgWkFtSS9ge5LJSLw3xgnNqyOaG7MDecmTQ8=" ]; - trusted-users = [ "@wheel" ]; + trusted-users = ["@wheel"]; }; registry = { personal.to = { @@ -40,52 +39,70 @@ in { hardware.enableAllFirmware = true; services.fwupd.enable = mkIf (pkgs.system == "x86_64-linux") true; - nixpkgs.config.allowUnfree = true; - environment.systemPackages = with pkgs; [ - git # We need git for this repository to even work - # Administration tools - #coreutils moreutils binutils psmisc progress lshw file - coreutils binutils psmisc progress lshw file vde2 - ldns wget - gnumake - exfat exfatprogs ntfs3g - nix-index - usbutils pciutils smartmontools - - # NCurses tools - htop iotop #glances - mc - screen tmux - - # ls tools - tree - lsof - strace - #mlocate - - sourceHighlight # Colors for less - unrar p7zip zip unzip - - # Network - nmap netcat traceroute - iftop nethogs - # TODO add mdns - sshfs - wakeonlan - - lm_sensors - - ] ++ optionals (system == "x86_64-linux") [ - ltrace - ] ++ optionals (!isNative) [ - ncdu_1 - ] ++ optionals (isNative) [ - moreutils - glances - ncdu - mlocate - ]; + environment.systemPackages = with pkgs; + [ + git # We need git for this repository to even work + # Administration tools + coreutils + binutils + psmisc + progress + lshw + file + vde2 + ldns + wget + gnumake + exfat + exfatprogs + ntfs3g + nix-index + usbutils + pciutils + smartmontools + + # NCurses tools + htop + iotop + mc + screen + tmux + + # ls tools + tree + lsof + strace + + sourceHighlight # Colors for less + unrar + p7zip + zip + unzip + + # Network + nmap + netcat + traceroute + iftop + nethogs + sshfs + wakeonlan + + lm_sensors + ] + ++ optionals (system == "x86_64-linux") [ + ltrace + ] + ++ optionals (!isNative) [ + ncdu_1 + ] + ++ optionals isNative [ + moreutils + glances + ncdu + mlocate + ]; users.mutableUsers = false; users.groups.cynerd.gid = 1000; @@ -97,11 +114,24 @@ in { group = "cynerd"; extraGroups = ["users" "wheel" "dialout" "kvm" "uucp"]; uid = 1000; - subUidRanges = [{ count = 65534; startUid = 10000; }]; - subGidRanges = [{ count = 65534; startGid = 10000; }]; + subUidRanges = [ + { + count = 65534; + startUid = 10000; + } + ]; + subGidRanges = [ + { + count = 65534; + startGid = 10000; + } + ]; isNormalUser = true; createHome = true; - shell = if isNative then pkgs.zsh.out else pkgs.bash.out; + shell = + if isNative + then pkgs.zsh.out + else pkgs.bash.out; passwordFile = "/run/secrets/cynerd.pass"; openssh.authorizedKeys.keyFiles = [ (config.personal-secrets + "/unencrypted/git-private.pub") @@ -113,7 +143,10 @@ in { programs.vim.defaultEditor = mkDefault true; security.sudo.extraRules = [ - { groups = [ "wheel" ]; commands = [ "ALL" ]; } + { + groups = ["wheel"]; + commands = ["ALL"]; + } ]; networking.dhcpcd.extraConfig = "controlgroup wheel"; environment.etc."dhcpcd.conf".text = "controlgroup wheel"; @@ -123,7 +156,7 @@ in { time.timeZone = "Europe/Prague"; i18n.defaultLocale = "en_US.UTF-8"; - services.udev.packages = [ + services.udev.packages = [ (pkgs.writeTextFile rec { name = "bfq-drives.rules"; destination = "/etc/udev/rules.d/60-${name}"; @@ -140,7 +173,5 @@ in { ''; programs.fuse.userAllowOther = true; - }; - } diff --git a/nixos/modules/home-assistant.nix b/nixos/modules/home-assistant.nix index e4f2232..0f2df9e 100644 --- a/nixos/modules/home-assistant.nix +++ b/nixos/modules/home-assistant.nix @@ -1,18 +1,17 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.home-assistant; - in { options = { cynerd.home-assistant = mkEnableOption "Enable Home Assistant and Bigclown"; }; config = mkIf cnf { - services.mosquitto = { enable = true; listeners = [ @@ -134,27 +133,31 @@ in { }; services.telegraf.extraConfig = { - outputs.influxdb_v2 = [{ - urls = ["http://errol:8086"]; - token = "$INFLUX_TOKEN"; - organization = "personal"; - bucket = "bigclown"; - tagpass.source = ["bigclown"]; - }]; + outputs.influxdb_v2 = [ + { + urls = ["http://errol:8086"]; + token = "$INFLUX_TOKEN"; + organization = "personal"; + bucket = "bigclown"; + tagpass.source = ["bigclown"]; + } + ]; inputs.mqtt_consumer = let consumer = data_type: topics: { - tags = { source = "bigclown"; }; + tags = {source = "bigclown";}; servers = ["tcp://localhost:1883"]; topics = topics; username = "telegraf"; password = "$MQTT_PASSWORD"; data_format = "value"; data_type = data_type; - topic_parsing = [{ - topic = "bigclown/node/+/+/+/+"; - measurement = "_/_/_/_/_/measurement"; - tags = "_/_/device/field/_/_"; - }]; + topic_parsing = [ + { + topic = "bigclown/node/+/+/+/+"; + measurement = "_/_/_/_/_/measurement"; + tags = "_/_/device/field/_/_"; + } + ]; }; in [ (consumer "float" [ @@ -170,11 +173,13 @@ in { "bigclown/node/+/flood-detector/+/alarm" ]) ]; - processors.pivot = [{ - tag_key = "field"; - value_key = "value"; - tagpass.source = ["bigclown"]; - }]; + processors.pivot = [ + { + tag_key = "field"; + value_key = "value"; + tagpass.source = ["bigclown"]; + } + ]; }; services.home-assistant = { @@ -204,10 +209,11 @@ in { }; extraComponents = []; package = pkgs.home-assistant.override { - extraPackages = pkgs: with pkgs; [ - securetar - ]; - packageOverrides = (self: super: { + extraPackages = pkgs: + with pkgs; [ + securetar + ]; + packageOverrides = self: super: { scapy = super.scapy.override { withPlottingSupport = false; }; @@ -215,10 +221,8 @@ in { dontUsePytestCheck = true; dontUseSetuptoolsCheck = true; }); - }); + }; }; }; - }; - } diff --git a/nixos/modules/hosts.nix b/nixos/modules/hosts.nix index ca9daa1..8a53578 100644 --- a/nixos/modules/hosts.nix +++ b/nixos/modules/hosts.nix @@ -1,18 +1,17 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.hosts; staticZoneOption = mkOption { type = types.attrsOf types.str; readOnly = true; }; - in { - options = { cynerd.hosts = { enable = mkOption { @@ -62,7 +61,7 @@ in { "3dprint" = "10.8.3.80"; "mpd" = "192.168.0.51"; # Portable - "albert" ="10.8.3.61"; + "albert" = "10.8.3.61"; "susan" = "10.8.3.62"; "binky" = "10.8.3.63"; }; @@ -100,5 +99,4 @@ in { "${cnf.adm.mpd}" = ["mpd.adm"]; }; }; - } diff --git a/nixos/modules/monitoring.nix b/nixos/modules/monitoring.nix index abeba2d..86a37e4 100644 --- a/nixos/modules/monitoring.nix +++ b/nixos/modules/monitoring.nix @@ -1,13 +1,13 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - -cnf = config.cynerd.monitoring; -hostName = config.networking.hostName; -isHost = cnf.host == hostName; - +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cnf = config.cynerd.monitoring; + hostName = config.networking.hostName; + isHost = cnf.host == hostName; in { options.cynerd.monitoring = { enable = mkOption { @@ -29,7 +29,7 @@ in { }; config = mkMerge [ - { cynerd.monitoring.host = "errol"; } + {cynerd.monitoring.host = "errol";} (mkIf cnf.enable { # Telegraf configuration @@ -38,53 +38,75 @@ in { environmentFiles = ["/run/secrets/telegraf.env"]; extraConfig = { agent = {}; - outputs.influxdb_v2 = [{ - urls = ["http://errol:8086"]; - token = "$INFLUX_TOKEN"; - organization = "personal"; - bucket = "monitoring"; - tagdrop.source = ["bigclown"]; # See home-assistant.nix - }]; - inputs = { - cpu = [{ - percpu = true; - totalcpu = true; - }]; - mem = [{}]; - swap = [{}]; - disk = [{ - ignore_fs = [ - "tmpfs" "devtmpfs" "devfs" "iso9660" "overlay" "aufs" "squashfs" + outputs.influxdb_v2 = [ + { + urls = ["http://errol:8086"]; + token = "$INFLUX_TOKEN"; + organization = "personal"; + bucket = "monitoring"; + tagdrop.source = ["bigclown"]; # See home-assistant.nix + } + ]; + inputs = + { + cpu = [ + { + percpu = true; + totalcpu = true; + } ]; - }]; - diskio = [{}]; - net = [{}]; - system = [{}]; - processes = [{}]; - systemd_units = [{}]; - wireguard = [{}]; - } // (optionalAttrs cnf.hw { - sensors = [{}]; - smart = [{ - path_smartctl = "${pkgs.smartmontools}/bin/smartctl"; - use_sudo = true; - }]; - wireless = [{}]; - }); + mem = [{}]; + swap = [{}]; + disk = [ + { + ignore_fs = [ + "tmpfs" + "devtmpfs" + "devfs" + "iso9660" + "overlay" + "aufs" + "squashfs" + ]; + } + ]; + diskio = [{}]; + net = [{}]; + system = [{}]; + processes = [{}]; + systemd_units = [{}]; + wireguard = [{}]; + } + // (optionalAttrs cnf.hw { + sensors = [{}]; + smart = [ + { + path_smartctl = "${pkgs.smartmontools}/bin/smartctl"; + use_sudo = true; + } + ]; + wireless = [{}]; + }); }; }; - systemd.services.telegraf.path = with pkgs; [ - "/run/wrappers" - ] ++ (optionals cnf.hw [ - lm_sensors smartmontools nvme-cli - ]); + systemd.services.telegraf.path = with pkgs; + [ + "/run/wrappers" + ] + ++ (optionals cnf.hw [ + lm_sensors + smartmontools + nvme-cli + ]); security.sudo.extraRules = [ { users = ["telegraf"]; - commands = [{ - command = "${pkgs.smartmontools}/bin/smartctl"; - options = ["NOPASSWD"]; - }]; + commands = [ + { + command = "${pkgs.smartmontools}/bin/smartctl"; + options = ["NOPASSWD"]; + } + ]; } ]; }) @@ -112,6 +134,5 @@ in { }; networking.firewall.allowedTCPPorts = [8086 3000]; }) - ]; } diff --git a/nixos/modules/openvpn.nix b/nixos/modules/openvpn.nix index d070cb2..ee62582 100644 --- a/nixos/modules/openvpn.nix +++ b/nixos/modules/openvpn.nix @@ -1,13 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.openvpn; - in { - options = { cynerd.openvpn = { personal = mkOption { @@ -36,11 +35,10 @@ in { oldpersonal = mkIf cnf.oldpersonal { config = "config /run/secrets/old.ovpn"; }; - elektroline = mkIf cnf.elektroline { + elektroline = mkIf cnf.elektroline { autoStart = false; config = "config /run/secrets/elektroline.ovpn"; }; }; }; - } diff --git a/nixos/modules/router.nix b/nixos/modules/router.nix index e65ef10..00a3c03 100644 --- a/nixos/modules/router.nix +++ b/nixos/modules/router.nix @@ -1,12 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cnf = config.cynerd.router; - in { - options = { cynerd.router = { enable = mkOption { @@ -28,16 +28,14 @@ in { }; config = mkIf cnf { - # TODO firewall NAT networking = { - }; services.dhcpd4 = { enable = true; authoritative = true; - interfaces = [ "brlan" ]; + interfaces = ["brlan"]; extraConfig = '' ''; }; @@ -45,7 +43,7 @@ in { services.dhcpd6 = { enable = true; authoritative = true; - interfaces = [ "brlan" ]; + interfaces = ["brlan"]; extraConfig = '' ''; }; @@ -53,6 +51,5 @@ in { services.kresd = { enable = true; }; - }; } diff --git a/nixos/modules/syncthing.nix b/nixos/modules/syncthing.nix index 44c1ac1..db8b6a8 100644 --- a/nixos/modules/syncthing.nix +++ b/nixos/modules/syncthing.nix @@ -1,28 +1,38 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: with builtins; -with lib; - -let - +with lib; let cnf = config.cynerd.syncthing; hostName = config.networking.hostName; allDevices = [ - "albert" "binky" "errol" "lipwig" "ridcully" "susan" "spt-omnia" + "albert" + "binky" + "errol" + "lipwig" + "ridcully" + "susan" + "spt-omnia" ]; mediaDevices = [ - "lipwig" "binky" "errol" "ridcully" "spt-omnia" + "lipwig" + "binky" + "errol" + "ridcully" + "spt-omnia" ]; bigStorageDevices = [ - "errol" "ridcully" "spt-omnia" + "errol" + "ridcully" + "spt-omnia" ]; filterDevice = folders: filterAttrs (n: v: any (d: d == hostName) v.devices) folders; - in { - options = { cynerd.syncthing = { - enable = mkOption { type = types.bool; default = false; @@ -34,13 +44,12 @@ in { default = "/home/cynerd"; description = "Base directory for all folders being synced."; }; - }; }; config = mkIf cnf.enable { services.syncthing = { - enable = any (n: n == hostName) allDevices; + enable = any (n: n == hostName) allDevices; user = mkDefault "cynerd"; key = "/run/secrets/syncthing/key.pem"; cert = "/run/secrets/syncthing/cert.pem"; @@ -101,15 +110,15 @@ in { }; overrideDevices = true; - devices = recursiveUpdate - (genAttrs allDevices (name: { - id = config.secrets.syncthingIDs."${name}"; - })) - { - lipwig.addresses = ["tcp://cynerd.cz"]; - }; + devices = + recursiveUpdate + (genAttrs allDevices (name: { + id = config.secrets.syncthingIDs."${name}"; + })) + { + lipwig.addresses = ["tcp://cynerd.cz"]; + }; # TODO phone }; }; - } diff --git a/nixos/modules/wifi-client.nix b/nixos/modules/wifi-client.nix index af09155..fd0944a 100644 --- a/nixos/modules/wifi-client.nix +++ b/nixos/modules/wifi-client.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - + config, + lib, + pkgs, + ... +}: +with lib; { options = { cynerd.wifiClient = mkOption { type = types.bool; diff --git a/pkgs/bigclown-leds/default.nix b/pkgs/bigclown-leds/default.nix index 8ebac59..0d2f8a9 100644 --- a/pkgs/bigclown-leds/default.nix +++ b/pkgs/bigclown-leds/default.nix @@ -1,28 +1,29 @@ -{ lib, stdenvNoCC, fetchgit -, makeWrapper, python3 +{ + lib, + stdenvNoCC, + fetchgit, + makeWrapper, + python3, }: +with lib; let + python = python3.withPackages (pypkgs: + with pypkgs; [ + paho-mqtt + ]); +in + stdenvNoCC.mkDerivation rec { + name = "personal-devshells"; + src = fetchgit { + url = "https://git.cynerd.cz/bigclown-leds"; + rev = "1a2c69a2152c315a964c0eb9b2673c70e52051b4"; + hash = "sha256-alApXwHZeUnNFkO2S+yw0qG18Wr5fF3ErGc0QIgPFU8="; + }; -with lib; - -let - - python = python3.withPackages (pypkgs: with pypkgs; [ - paho-mqtt - ]); - -in stdenvNoCC.mkDerivation rec { - name = "personal-devshells"; - src = fetchgit { - url = "https://git.cynerd.cz/bigclown-leds"; - rev = "1a2c69a2152c315a964c0eb9b2673c70e52051b4"; - hash = "sha256-alApXwHZeUnNFkO2S+yw0qG18Wr5fF3ErGc0QIgPFU8="; - }; - - nativeBuildInputs = [ makeWrapper ]; - installPhase = '' - mkdir -p $out/bin - cp bigclown-leds $out/bin/ - wrapProgram $out/bin/bigclown-leds \ - --prefix PATH : ${lib.makeBinPath [ python ]} - ''; -} + nativeBuildInputs = [makeWrapper]; + installPhase = '' + mkdir -p $out/bin + cp bigclown-leds $out/bin/ + wrapProgram $out/bin/bigclown-leds \ + --prefix PATH : ${lib.makeBinPath [python]} + ''; + } diff --git a/pkgs/default.nix b/pkgs/default.nix index 9b7cf3b..bb3bd42 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,31 +1,31 @@ -{ self, nixpkgs }: - -let +{ + self, + nixpkgs, +}: let callPackage = nixpkgs.newScope personalpkgs; personalpkgs = rec { - - luks-hw-password = callPackage ./luks-hw-password { }; + luks-hw-password = callPackage ./luks-hw-password {}; dev = callPackage ./dev { devShells = self.devShells.${nixpkgs.system}; }; - delft-icon-theme = callPackage ./theme/delft-icon-theme.nix { }; - background-lnxpcs = callPackage ./theme/background-lnxpcs.nix { }; - swaybackground = callPackage ./theme/swaybackground.nix { }; - myswaylock = callPackage ./theme/myswaylock.nix { }; + delft-icon-theme = callPackage ./theme/delft-icon-theme.nix {}; + background-lnxpcs = callPackage ./theme/background-lnxpcs.nix {}; + swaybackground = callPackage ./theme/swaybackground.nix {}; + myswaylock = callPackage ./theme/myswaylock.nix {}; - stardict-unwrapped = callPackage ./stardict { }; - stardict = callPackage ./stardict/wrapper.nix { stardict = stardict-unwrapped; }; - stardict-en-cz = callPackage ./stardict/en-cz.nix { }; - stardict-de-cz = callPackage ./stardict/de-cz.nix { }; - stardict-cz = callPackage ./stardict/cz.nix { }; - sdcv-unwrapped = callPackage ./sdcv { }; - sdcv = callPackage ./stardict/wrapper.nix { stardict = sdcv-unwrapped; }; + stardict-unwrapped = callPackage ./stardict {}; + stardict = callPackage ./stardict/wrapper.nix {stardict = stardict-unwrapped;}; + stardict-en-cz = callPackage ./stardict/en-cz.nix {}; + stardict-de-cz = callPackage ./stardict/de-cz.nix {}; + stardict-cz = callPackage ./stardict/cz.nix {}; + sdcv-unwrapped = callPackage ./sdcv {}; + sdcv = callPackage ./stardict/wrapper.nix {stardict = sdcv-unwrapped;}; - lorem-text = callPackage ./lorem-text { }; + lorem-text = callPackage ./lorem-text {}; - bigclown-leds = callPackage ./bigclown-leds { }; + bigclown-leds = callPackage ./bigclown-leds {}; # Package to be installed to the user's profile cynerd-profile = nixpkgs.symlinkJoin { @@ -37,9 +37,9 @@ let }; # Elektroline packages - shvspy = callPackage ./shvspy { }; + shvspy = callPackage ./shvspy {}; qcoro_task_exception_handling = nixpkgs.libsForQt5.qcoro.overrideAttrs (oldAttrs: { - version = "0.6.0"; + version = "0.6.0"; src = nixpkgs.fetchFromGitHub { owner = "danvratil"; repo = "qcoro"; @@ -47,7 +47,6 @@ let sha256 = "OAYJpoW3b0boSYBfuzLrFvlYSmP3SON8O6HsDQoi+I8="; }; }); - }; - -in personalpkgs +in + personalpkgs diff --git a/pkgs/dev/default.nix b/pkgs/dev/default.nix index d9b7d52..dfc0cd7 100644 --- a/pkgs/dev/default.nix +++ b/pkgs/dev/default.nix @@ -1,24 +1,25 @@ -{ lib, stdenvNoCC -, makeShellWrapper, bash, nix -, devShells +{ + lib, + stdenvNoCC, + makeShellWrapper, + bash, + nix, + devShells, }: - -with lib; - -let - +with lib; let shells = concatStringsSep ":" (mapAttrsToList ( n: v: "${n}=${v.drvPath}=${v}" - ) devShells); - -in stdenvNoCC.mkDerivation rec { - name = "personal-devshells"; - src = ./.; + ) + devShells); +in + stdenvNoCC.mkDerivation rec { + name = "personal-devshells"; + src = ./.; - nativeBuildInputs = [ makeShellWrapper ]; - installPhase = '' - makeShellWrapper ${./dev.sh} $out/bin/dev \ - --prefix PATH : ${lib.makeBinPath [ bash nix ]} \ - --set DEV_SHELLS "${shells}" - ''; -} + nativeBuildInputs = [makeShellWrapper]; + installPhase = '' + makeShellWrapper ${./dev.sh} $out/bin/dev \ + --prefix PATH : ${lib.makeBinPath [bash nix]} \ + --set DEV_SHELLS "${shells}" + ''; + } diff --git a/pkgs/lorem-text/default.nix b/pkgs/lorem-text/default.nix index 7927346..07cb402 100644 --- a/pkgs/lorem-text/default.nix +++ b/pkgs/lorem-text/default.nix @@ -1,9 +1,7 @@ { python3Packages, fetchFromGitHub, -}: -let - +}: let pypkg = { buildPythonPackage, click, @@ -20,5 +18,5 @@ let propagatedBuildInputs = [click]; passthru.pythonPackage = pypkg; }; - -in python3Packages.callPackage pypkg { } +in + python3Packages.callPackage pypkg {} diff --git a/pkgs/luks-hw-password/default.nix b/pkgs/luks-hw-password/default.nix index 9797735..9ca3e35 100644 --- a/pkgs/luks-hw-password/default.nix +++ b/pkgs/luks-hw-password/default.nix @@ -1,7 +1,10 @@ -{ lib, stdenvNoCC, makeWrapper -, dmidecode, coreutils +{ + lib, + stdenvNoCC, + makeWrapper, + dmidecode, + coreutils, }: - stdenvNoCC.mkDerivation { pname = "luks-hw-password"; version = "1.0"; @@ -10,11 +13,11 @@ stdenvNoCC.mkDerivation { platforms = platforms.linux; }; - nativeBuildInputs = [ makeWrapper ]; - phases = [ "installPhase" ]; + nativeBuildInputs = [makeWrapper]; + phases = ["installPhase"]; installPhase = '' mkdir -p $out/bin makeWrapper ${./luks-hw-password.sh} $out/bin/luks-hw-password \ - --prefix PATH : ${lib.makeBinPath [ dmidecode coreutils ]} + --prefix PATH : ${lib.makeBinPath [dmidecode coreutils]} ''; } diff --git a/pkgs/sdcv/default.nix b/pkgs/sdcv/default.nix index 7e9527f..6a9147d 100644 --- a/pkgs/sdcv/default.nix +++ b/pkgs/sdcv/default.nix @@ -1,8 +1,15 @@ -{ lib, stdenv, fetchFromGitHub -, cmake, pkg-config, gettext -, zlib, glib, pcre, readline +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + gettext, + zlib, + glib, + pcre, + readline, }: - stdenv.mkDerivation rec { pname = "sdcv"; version = "0.5.3"; @@ -14,8 +21,8 @@ stdenv.mkDerivation rec { hash = "sha256-mJ9LrQ/l0SRmueg+IfGnS0NcNheGdOZ2Gl7KMFiK6is="; }; - nativeBuildInputs = [ cmake pkg-config gettext ]; - buildInputs = [ zlib glib pcre readline ]; + nativeBuildInputs = [cmake pkg-config gettext]; + buildInputs = [zlib glib pcre readline]; makeFlags = "sdcv lang"; meta = with lib; { diff --git a/pkgs/shvspy/default.nix b/pkgs/shvspy/default.nix index edc0bd4..7f5e31d 100644 --- a/pkgs/shvspy/default.nix +++ b/pkgs/shvspy/default.nix @@ -1,39 +1,52 @@ -{ lib, stdenv, fetchFromGitHub -, cmake, doctest, libsForQt5, qcoro_task_exception_handling -, makeDesktopItem, copyDesktopItems +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + doctest, + libsForQt5, + qcoro_task_exception_handling, + makeDesktopItem, + copyDesktopItems, }: -with libsForQt5; +with libsForQt5; + stdenv.mkDerivation rec { + name = "shvspy"; -stdenv.mkDerivation rec { - name = "shvspy"; + src = fetchFromGitHub { + owner = "silicon-heaven"; + repo = "shvspy"; + rev = "a922e963bf7884164fe2b124a7a4366f7fc802a3"; + sha256 = "ExA+sFlkxFKXk69DKoGzKm80ypiNFwN281MwZkMgaVY="; + fetchSubmodules = true; + }; - src = fetchFromGitHub { - owner = "silicon-heaven"; - repo = "shvspy"; - rev = "a922e963bf7884164fe2b124a7a4366f7fc802a3"; - sha256 = "ExA+sFlkxFKXk69DKoGzKm80ypiNFwN281MwZkMgaVY="; - fetchSubmodules = true; - }; + nativeBuildInputs = [ + cmake + doctest + wrapQtAppsHook + copyDesktopItems + ]; + buildInputs = [ + qtbase + qtserialport + qtwebsockets + doctest + qcoro_task_exception_handling + ]; - nativeBuildInputs = [ - cmake doctest wrapQtAppsHook copyDesktopItems - ]; - buildInputs = [ - qtbase qtserialport qtwebsockets doctest qcoro_task_exception_handling - ]; + desktopItems = [ + (makeDesktopItem { + name = "shvspy"; + exec = "shvspy"; + desktopName = "SHVSpy"; + categories = ["Network" "RemoteAccess"]; + }) + ]; - desktopItems = [ - (makeDesktopItem { - name = "shvspy"; - exec = "shvspy"; - desktopName = "SHVSpy"; - categories = [ "Network" "RemoteAccess" ]; - }) - ]; - - meta = with lib; { - description = "Console version of Stardict program"; - homepage = "https://dushistov.github.io/sdcv/"; - license = licenses.gpl2; - }; -} + meta = with lib; { + description = "Console version of Stardict program"; + homepage = "https://dushistov.github.io/sdcv/"; + license = licenses.gpl2; + }; + } diff --git a/pkgs/stardict/cz.nix b/pkgs/stardict/cz.nix index 7b4eeb0..0ce4100 100644 --- a/pkgs/stardict/cz.nix +++ b/pkgs/stardict/cz.nix @@ -1,5 +1,8 @@ -{ lib, stdenvNoCC, fetchurl }: - +{ + lib, + stdenvNoCC, + fetchurl, +}: stdenvNoCC.mkDerivation rec { pname = "stardict-cz"; version = "20171101"; diff --git a/pkgs/stardict/de-cz.nix b/pkgs/stardict/de-cz.nix index 8ef3923..93f0744 100644 --- a/pkgs/stardict/de-cz.nix +++ b/pkgs/stardict/de-cz.nix @@ -1,5 +1,8 @@ -{ lib, stdenvNoCC, fetchurl }: - +{ + lib, + stdenvNoCC, + fetchurl, +}: stdenvNoCC.mkDerivation rec { pname = "stardict-de-cz"; version = "20200501"; diff --git a/pkgs/stardict/default.nix b/pkgs/stardict/default.nix index 9669c3d..cca761a 100644 --- a/pkgs/stardict/default.nix +++ b/pkgs/stardict/default.nix @@ -1,55 +1,81 @@ -{ lib, stdenv, fetchurl -, autoreconfHook, wrapGAppsHook -, pkg-config, automake, autoconf, libtool, intltool, gnome-doc-utils, libxslt -, gnome2, gtk2, libxml2, enchant , mariadb-connector-c, pcre -, speech-tools, speech-toolsDisable ? false -, espeak, espeakDisable ? false +{ + lib, + stdenv, + fetchurl, + autoreconfHook, + wrapGAppsHook, + pkg-config, + automake, + autoconf, + libtool, + intltool, + gnome-doc-utils, + libxslt, + gnome2, + gtk2, + libxml2, + enchant, + mariadb-connector-c, + pcre, + speech-tools, + speech-toolsDisable ? false, + espeak, + espeakDisable ? false, }: - with lib; + stdenv.mkDerivation rec { + pname = "stardict"; + version = "3.0.6"; -stdenv.mkDerivation rec { - pname = "stardict"; - version = "3.0.6"; - - src = fetchurl { - url = "https://downloads.sourceforge.net/project/stardict-4/${version}/stardict-${version}.tar.bz2"; - sha256 = "1rw2dg1d489gjjx9957j2jdmjlvylv31pnx3142lwq3pi5d6j2ka"; - }; - patches = [ - ./enchant2.patch - ./gcc46.patch - ./gconf.patch - ./glib2.patch - ./makefile.patch - ./mariadb.patch - ]; + src = fetchurl { + url = "https://downloads.sourceforge.net/project/stardict-4/${version}/stardict-${version}.tar.bz2"; + sha256 = "1rw2dg1d489gjjx9957j2jdmjlvylv31pnx3142lwq3pi5d6j2ka"; + }; + patches = [ + ./enchant2.patch + ./gcc46.patch + ./gconf.patch + ./glib2.patch + ./makefile.patch + ./mariadb.patch + ]; - nativeBuildInputs = [ - autoreconfHook wrapGAppsHook - pkg-config intltool gnome-doc-utils libxslt - ]; - buildInputs = [ - gnome2.gnome-common gnome2.GConf - gtk2 libxml2 enchant mariadb-connector-c pcre - ] - ++ optional (!speech-toolsDisable) speech-tools - ++ optional (!espeakDisable) espeak; - configureFlags = [ - "--disable-gnome-support" - "--disable-gucharmap" - "--disable-scrollkeeper" - "--disable-festival" - "--disable-gpe-support" - "--disable-schemas-install" - ] - ++ optional speech-toolsDisable "--disable-speech-tools" - ++ optional espeakDisable "--disable-espeak"; + nativeBuildInputs = [ + autoreconfHook + wrapGAppsHook + pkg-config + intltool + gnome-doc-utils + libxslt + ]; + buildInputs = + [ + gnome2.gnome-common + gnome2.GConf + gtk2 + libxml2 + enchant + mariadb-connector-c + pcre + ] + ++ optional (!speech-toolsDisable) speech-tools + ++ optional (!espeakDisable) espeak; + configureFlags = + [ + "--disable-gnome-support" + "--disable-gucharmap" + "--disable-scrollkeeper" + "--disable-festival" + "--disable-gpe-support" + "--disable-schemas-install" + ] + ++ optional speech-toolsDisable "--disable-speech-tools" + ++ optional espeakDisable "--disable-espeak"; - meta = with lib; { - description = "Cross-platform and international dictionary software"; - homepage = "http://stardict-4.sourceforge.net/"; - platforms = platforms.linux; - license = licenses.gpl3; - }; -} + meta = with lib; { + description = "Cross-platform and international dictionary software"; + homepage = "http://stardict-4.sourceforge.net/"; + platforms = platforms.linux; + license = licenses.gpl3; + }; + } diff --git a/pkgs/stardict/en-cz.nix b/pkgs/stardict/en-cz.nix index 353334c..ead1a31 100644 --- a/pkgs/stardict/en-cz.nix +++ b/pkgs/stardict/en-cz.nix @@ -1,5 +1,8 @@ -{ lib, stdenvNoCC, fetchurl }: - +{ + lib, + stdenvNoCC, + fetchurl, +}: stdenvNoCC.mkDerivation rec { pname = "stardict-en-cz"; version = "20210401"; diff --git a/pkgs/stardict/wrapper.nix b/pkgs/stardict/wrapper.nix index 6547728..e99fa01 100644 --- a/pkgs/stardict/wrapper.nix +++ b/pkgs/stardict/wrapper.nix @@ -1,20 +1,23 @@ -{ lib, stdenv, makeBinaryWrapper -, stardict +{ + lib, + stdenv, + makeBinaryWrapper, + stardict, }: - -with stardict; - -let - - drv = stdenv.mkDerivation rec { +with stardict; let + drv = stdenv.mkDerivation rec { inherit pname; inherit version; inherit meta; - nativeBuildInputs = [ stardict makeBinaryWrapper ]; - dictionaries = [ /* empty and expecting override */ ]; + nativeBuildInputs = [stardict makeBinaryWrapper]; + dictionaries = [ + /* + empty and expecting override + */ + ]; - phases = [ "installPhase" ]; + phases = ["installPhase"]; installPhase = '' mkdir -p $out/bin $out/usr/share/stardict/dic for dic in $dictionaries; do @@ -32,9 +35,10 @@ let done ''; - passthru.withDictionaries = dicts: drv.overrideAttrs (oldAttrs: { - dictionaries = dicts; - }); + passthru.withDictionaries = dicts: + drv.overrideAttrs (oldAttrs: { + dictionaries = dicts; + }); }; - -in drv +in + drv diff --git a/pkgs/theme/background-lnxpcs.nix b/pkgs/theme/background-lnxpcs.nix index a3983af..c6e61db 100644 --- a/pkgs/theme/background-lnxpcs.nix +++ b/pkgs/theme/background-lnxpcs.nix @@ -1,5 +1,9 @@ -{ lib, stdenvNoCC, fetchFromGitHub, imagemagick }: - +{ + lib, + stdenvNoCC, + fetchFromGitHub, + imagemagick, +}: stdenvNoCC.mkDerivation rec { pname = "background-lnxpcs"; version = "20190411"; @@ -11,7 +15,7 @@ stdenvNoCC.mkDerivation rec { sha256 = "vtyyG0EHRmgWlxHmHgeckwtOv7t3C+hsuTt/vBdrRQM="; }; - nativeBuildInputs = [ imagemagick ]; + nativeBuildInputs = [imagemagick]; wallpapers = "bash cron gcc gnu gnu-linux iptables kernel kill python root su sudo vim"; buildPhase = '' diff --git a/pkgs/theme/delft-icon-theme.nix b/pkgs/theme/delft-icon-theme.nix index 08ed773..1dcd904 100644 --- a/pkgs/theme/delft-icon-theme.nix +++ b/pkgs/theme/delft-icon-theme.nix @@ -1,5 +1,12 @@ -{ lib, stdenv, stdenvNoCC, fetchFromGitHub, gtk3, gnome-icon-theme, hicolor-icon-theme }: - +{ + lib, + stdenv, + stdenvNoCC, + fetchFromGitHub, + gtk3, + gnome-icon-theme, + hicolor-icon-theme, +}: stdenv.mkDerivation rec { pname = "delft-icon-theme"; version = "1.15"; @@ -11,9 +18,9 @@ stdenv.mkDerivation rec { sha256 = "fluSh2TR1CdIW54wkUp1QRB0m9akFKnSn4d+0z6gkLA="; }; - nativeBuildInputs = [ gtk3 ]; + nativeBuildInputs = [gtk3]; - propagatedBuildInputs = [ gnome-icon-theme hicolor-icon-theme ]; + propagatedBuildInputs = [gnome-icon-theme hicolor-icon-theme]; dontDropIconThemeCache = true; diff --git a/pkgs/theme/myswaylock.nix b/pkgs/theme/myswaylock.nix index 64f55f2..44d7bda 100644 --- a/pkgs/theme/myswaylock.nix +++ b/pkgs/theme/myswaylock.nix @@ -1,8 +1,13 @@ -{ lib, stdenvNoCC, makeWrapper -, bash, jq, sway, swaylock -, background-lnxpcs +{ + lib, + stdenvNoCC, + makeWrapper, + bash, + jq, + sway, + swaylock, + background-lnxpcs, }: - stdenvNoCC.mkDerivation { pname = "myswaylock"; version = "1.0"; @@ -11,13 +16,13 @@ stdenvNoCC.mkDerivation { platforms = platforms.linux; }; - nativeBuildInputs = [ makeWrapper ]; - phases = [ "installPhase" ]; + nativeBuildInputs = [makeWrapper]; + phases = ["installPhase"]; installPhase = '' mkdir -p $out/bin cp ${./myswaylock.sh} $out/bin/myswaylock wrapProgram $out/bin/myswaylock \ - --prefix PATH : ${lib.makeBinPath [ bash jq sway swaylock ]} \ - --prefix BACKGROUND_LNXPCS : ${ background-lnxpcs } + --prefix PATH : ${lib.makeBinPath [bash jq sway swaylock]} \ + --prefix BACKGROUND_LNXPCS : ${background-lnxpcs} ''; } diff --git a/pkgs/theme/swaybackground.nix b/pkgs/theme/swaybackground.nix index 6675d24..8b4be5a 100644 --- a/pkgs/theme/swaybackground.nix +++ b/pkgs/theme/swaybackground.nix @@ -1,8 +1,12 @@ -{ lib, stdenvNoCC, makeWrapper -, bash, jq, sway -, background-lnxpcs +{ + lib, + stdenvNoCC, + makeWrapper, + bash, + jq, + sway, + background-lnxpcs, }: - stdenvNoCC.mkDerivation { pname = "swaybackground"; version = "1.0"; @@ -11,13 +15,13 @@ stdenvNoCC.mkDerivation { platforms = platforms.linux; }; - nativeBuildInputs = [ makeWrapper ]; - phases = [ "installPhase" ]; + nativeBuildInputs = [makeWrapper]; + phases = ["installPhase"]; installPhase = '' mkdir -p $out/bin cp ${./swaybackground.sh} $out/bin/swaybackground wrapProgram $out/bin/swaybackground \ - --prefix PATH : ${lib.makeBinPath [ bash jq sway ]} \ - --prefix BACKGROUND_LNXPCS : ${ background-lnxpcs } + --prefix PATH : ${lib.makeBinPath [bash jq sway]} \ + --prefix BACKGROUND_LNXPCS : ${background-lnxpcs} ''; } diff --git a/tools/common.sh b/tools/common.sh index d3ddbc3..a6b41fc 100644 --- a/tools/common.sh +++ b/tools/common.sh @@ -34,6 +34,8 @@ warning() { sshdest() { if [ "$1" = "lipwig" ]; then echo "newlipwig" + elif [ "$1" = "binky" ]; then + echo "binky.vpn" else awk -F- 'NF > 1 { print $2"."$1; exit } { print $1 }' <<<"$1" fi |