diff options
35 files changed, 354 insertions, 337 deletions
diff --git a/devShells/apo.nix b/devShells/apo.nix index b4ab8fd..a800557 100644 --- a/devShells/apo.nix +++ b/devShells/apo.nix @@ -1,8 +1,4 @@ -{ - pkgs, - default, - c, -}: let +pkgs: c: let riscvPkgs = import pkgs.path { localSystem = pkgs.buildPlatform.system; crossSystem = { @@ -18,6 +14,6 @@ in glibc.static riscvPkgs.buildPackages.gcc ]; - inputsFrom = [default c]; + inputsFrom = [c]; meta.platforms = pkgs.lib.platforms.linux; } diff --git a/devShells/c.nix b/devShells/c.nix index e20fcc8..c28eafb 100644 --- a/devShells/c.nix +++ b/devShells/c.nix @@ -1,7 +1,4 @@ -{ - pkgs, - default, -}: +pkgs: pkgs.mkShell { packages = with pkgs; [ clang-tools_14 @@ -44,6 +41,5 @@ pkgs.mkShell { SDL2 libffi.dev ]; - inputsFrom = with pkgs; [default]; meta.platforms = pkgs.lib.platforms.linux; } diff --git a/devShells/default.nix b/devShells/default.nix index 998a39b..1e46ad0 100644 --- a/devShells/default.nix +++ b/devShells/default.nix @@ -1,21 +1,11 @@ -pkgs: let - callDevelop = pkgs.lib.callPackageWith (shells // {inherit pkgs;}); - - shells = { - default = pkgs.mkShell { - packages = []; - }; - - 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 {}; - python = callDevelop ./python.nix {}; - apo = callDevelop ./apo.nix {}; +pkgs: rec { + armv7e = import ./nuttx.nix pkgs c { + arch = "armv7e-m"; + fpu = "vfpv3-d16"; }; -in - shells + espc = import ./nuttx.nix pkgs c {arch = "rv32imc";}; + c = import ./c.nix pkgs; + qt = import ./qt.nix pkgs c; + python = import ./python.nix pkgs; + apo = import ./apo.nix pkgs c; +} diff --git a/devShells/nuttx.nix b/devShells/nuttx.nix index 506ea12..97675e9 100644 --- a/devShells/nuttx.nix +++ b/devShells/nuttx.nix @@ -1,7 +1,4 @@ -{ - pkgs, - default, - c, +pkgs: c: { arch, fpu ? null, }: @@ -36,6 +33,6 @@ in ++ (optionals (hasPrefix "rv32" arch) [ esptool ]); - inputsFrom = [default c]; + inputsFrom = [c]; meta.platforms = pkgsCross.lib.platforms.linux; } diff --git a/devShells/python.nix b/devShells/python.nix index 492644e..1bd1dad 100644 --- a/devShells/python.nix +++ b/devShells/python.nix @@ -1,7 +1,4 @@ -{ - pkgs, - default, -}: +pkgs: pkgs.mkShell { packages = with pkgs; [ (python3.withPackages (pypkgs: @@ -50,6 +47,5 @@ pkgs.mkShell { gtk3 gtk4 ]; - inputsFrom = with pkgs; [default]; meta.platforms = pkgs.lib.platforms.linux; } diff --git a/devShells/qt.nix b/devShells/qt.nix index 2070009..35558c2 100644 --- a/devShells/qt.nix +++ b/devShells/qt.nix @@ -1,8 +1,4 @@ -{ - pkgs, - default, - c, -}: +pkgs: c: pkgs.mkShell { packages = with pkgs; with libsForQt5; [ @@ -14,6 +10,6 @@ pkgs.mkShell { qtcharts qtwayland ]; - inputsFrom = with pkgs; [default c]; + inputsFrom = [c]; meta.platforms = pkgs.lib.platforms.linux; } @@ -48,11 +48,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -144,11 +144,11 @@ "systems": "systems_5" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -161,11 +161,11 @@ "systems": "systems_6" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -182,7 +182,7 @@ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -213,11 +213,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1704734040, - "narHash": "sha256-A8ZPW28fLUh0lEhLLMyjUYSa9JZzLi9MNAnkynuVDs4=", + "lastModified": 1705325727, + "narHash": "sha256-1/MgywK8kH2h9GFbGbIH/rxWN+EtXF8CV75rorGJehU=", "ref": "refs/heads/master", - "rev": "7279a1c6a10cfaf0b21a15b3a7fdb7ad1f6cc067", - "revCount": 3441, + "rev": "155db0a014aa4687664fa17afb2a7d0fb2d409a4", + "revCount": 3448, "submodules": true, "type": "git", "url": "https://gitlab.elektroline.cz/elektroline/flatlineng.git" @@ -255,11 +255,11 @@ "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1699351752, - "narHash": "sha256-p/XhG++G/v38RS4d7ijlX+uy/6WqPG/JQf+PQSzZj/o=", + "lastModified": 1704892530, + "narHash": "sha256-sUs/yddB+UXjxAvMiXVgoy4UidLHqPOiUlbeg0cr+Ao=", "ref": "refs/heads/master", - "rev": "b43bd2ad41c35fcfb0d5e45a3a282c6abcf1771e", - "revCount": 2316, + "rev": "fc7d59911023c4cdc7d6af7e39047367e8e2b883", + "revCount": 2395, "submodules": true, "type": "git", "url": "https://github.com/silicon-heaven/libshv.git" @@ -291,11 +291,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1704786394, - "narHash": "sha256-aJM0ln9fMGWw1+tjyl5JZWZ3ahxAA2gw2ZpZY/hkEMs=", + "lastModified": 1705312285, + "narHash": "sha256-rd+dY+v61Y8w3u9bukO/hB55Xl4wXv4/yC8rCGVnK5U=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "b34a6075e9e298c4124e35c3ccaf2210c1f3a43b", + "rev": "bee2202bec57e521e3bd8acd526884b9767d7fa0", "type": "github" }, "original": { @@ -377,11 +377,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1704835834, - "narHash": "sha256-2XSWpm+0GBPHnCZmm/ell+yuPx3aP7zbitFFkFq7zlg=", + "lastModified": 1705341963, + "narHash": "sha256-B+hleatY+0EhKayVpjRDjX2lZM8Ywds2p+Cl9fV1Pzg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7bb62b90ef7f7e76603bcd52d7e10ddb6d589f15", + "rev": "857390998c1975a34509fccd9f635acde935e1d0", "type": "github" }, "original": { @@ -420,11 +420,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1700538105, - "narHash": "sha256-uZhOCmwv8VupEmPZm3erbr9XXmyg7K67Ul3+Rx2XMe0=", + "lastModified": 1705242415, + "narHash": "sha256-a8DRYrNrzTudvO7XHUPNJD89Wbf1ZZT0VbwCsPnHWaE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "51a01a7e5515b469886c120e38db325c96694c2f", + "rev": "ea780f3de2d169f982564128804841500e85e373", "type": "github" }, "original": { @@ -448,11 +448,11 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1699245149, - "narHash": "sha256-QGK3RwlopxpuRSknp2/T3rGJewvg48+m05OQL9eNLFY=", + "lastModified": 1705242415, + "narHash": "sha256-a8DRYrNrzTudvO7XHUPNJD89Wbf1ZZT0VbwCsPnHWaE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4cf9f0f864a05407c78a85027c12b22e484411a6", + "rev": "ea780f3de2d169f982564128804841500e85e373", "type": "github" }, "original": { @@ -466,27 +466,26 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1704876311, - "narHash": "sha256-NnCcbyosqTy/U3X17pUscKmjT3O+8LQyuXimHhQOX8M=", + "lastModified": 1704961316, + "narHash": "sha256-u3yw1WX2ylbvWhcnfWPaDnJbfOJK+hQJIzN4EGE1mpg=", "owner": "cynerd", "repo": "nixturris", - "rev": "b6867c82270a45afd4fb71275410532e0b7234d5", + "rev": "b574e22723c7c067f8108f9203844879aa7f3358", "type": "gitlab" }, "original": { "owner": "cynerd", - "ref": "new-ci", "repo": "nixturris", "type": "gitlab" } }, "personal-secret": { "locked": { - "lastModified": 1700135597, - "narHash": "sha256-LqT/uwyas9aqBiJ+ezMCxo8n/2fA7sAXiX7xiCNb6oI=", + "lastModified": 1705173603, + "narHash": "sha256-tiLrqR3MwF0JkbRpNz40whaIDUY8Yh53aWu9o3atRMw=", "ref": "refs/heads/master", - "rev": "92dce4538bba4b1a8fc41eb67bf56bea0a41a49e", - "revCount": 79, + "rev": "99c21ea7ead2203ead5b9d625a39efaf09affda4", + "revCount": 82, "type": "git", "url": "ssh://git@cynerd.cz/nixos-personal-secret" }, @@ -502,17 +501,18 @@ "nixpkgs": "nixpkgs_9" }, "locked": { - "lastModified": 1699625542, - "narHash": "sha256-jNTFdR1zFSWBbPljAjv5E05u1ZLVKXo9lyK6lmMLdOc=", - "owner": "silicon-heaven", + "lastModified": 1705325629, + "narHash": "sha256-WipDjHJlxFZCZQVu+b3tLiP7PFzYvNo2+FGl/p8yMF0=", + "owner": "elektroline-predator", "repo": "pyshv", - "rev": "55379a94ae4c6bd911bb15293181486bf3c1ebed", - "type": "github" + "rev": "2f3d513d8633ee82639911b97e18389643994229", + "type": "gitlab" }, "original": { - "owner": "silicon-heaven", + "owner": "elektroline-predator", + "ref": "multiple-tweaks", "repo": "pyshv", - "type": "github" + "type": "gitlab" } }, "root": { @@ -558,15 +558,16 @@ "pyshv": "pyshv" }, "locked": { - "lastModified": 1702330302, - "narHash": "sha256-mbPZ1ogTiLnMu6OVUXc8SIaNgZ2YgPNAp3MruG+CRgg=", + "lastModified": 1705325793, + "narHash": "sha256-5x1ygdoN+h5aR/wxD+lwF3k/fHQJ5wYMSF/O6Qekjgk=", "owner": "silicon-heaven", "repo": "shvcli", - "rev": "3a41dbe21787b7fe81dfbe4c1124e940e9b74fb1", + "rev": "f67bd6bc8d5b42b03f67c3bc76033577ac675593", "type": "github" }, "original": { "owner": "silicon-heaven", + "ref": "indent-cpon", "repo": "shvcli", "type": "github" } @@ -748,11 +749,11 @@ }, "vpsadminos": { "locked": { - "lastModified": 1704805549, - "narHash": "sha256-qsTfv50DiW6ii4zDmxvg67eBzGNanBqz//z8K2+kiGQ=", + "lastModified": 1705262735, + "narHash": "sha256-Sfb+/odQov3In5ZtTnaXgQesOIigeoTs7deKjjAFxDs=", "owner": "vpsfreecz", "repo": "vpsadminos", - "rev": "4e77ea7ff7da2f294b56914b0ad0c14f0a51794c", + "rev": "915fbcedfdb6eb19ab370344e5d72ba78a82bfef", "type": "github" }, "original": { @@ -9,9 +9,9 @@ agenix.url = "github:ryantm/agenix"; shvspy.url = "git+https://github.com/silicon-heaven/shvspy.git?submodules=1"; flatline.url = "git+https://gitlab.elektroline.cz/elektroline/flatlineng.git?submodules=1"; - shvcli.url = "github:silicon-heaven/shvcli"; + shvcli.url = "github:silicon-heaven/shvcli/indent-cpon"; - nixturris.url = "gitlab:cynerd/nixturris/new-ci"; + nixturris.url = "gitlab:cynerd/nixturris"; nixbigclown.url = "github:cynerd/nixbigclown"; vpsadminos.url = "github:vpsfreecz/vpsadminos"; @@ -35,7 +35,7 @@ { lib = import ./lib nixpkgs.lib; overlays = { - noInherit = final: prev: import ./pkgs prev; + noInherit = final: prev: import ./pkgs final prev; default = nixpkgs.lib.composeManyExtensions [ agenix.overlays.default shvspy.overlays.default @@ -52,8 +52,14 @@ // eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages."${system}".extend self.overlays.default; in { - packages = filterPackages system (flattenTree (import ./pkgs pkgs)); - legacyPackages = pkgs.extend self.overlays.default; + packages = with nixpkgs.lib; + mapAttrs' (n: v: + nameValuePair + "tarball-${n}" + v.buildPlatform.${system}.config.system.build.tarball) (filterAttrs + (n: v: v.config.system.build ? tarball) + self.nixosConfigurations); + legacyPackages = pkgs; devShells = filterPackages system (import ./devShells pkgs); formatter = pkgs.alejandra; }); diff --git a/nixos/configurations.nix b/nixos/configurations.nix index be8beb7..2fa2261 100644 --- a/nixos/configurations.nix +++ b/nixos/configurations.nix @@ -108,7 +108,6 @@ in // amd64System "binky" // amd64System "errol" // amd64System "ridcully" - // amd64System "susan" // vpsSystem "lipwig" // raspi2System "spt-mpd" // raspi3System "adm-mpd" diff --git a/nixos/default.nix b/nixos/default.nix index 974c73d..90d6b3a 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,7 +1,6 @@ -self: -with builtins; let +self: let machines = import ./machine self; - modules = import ./modules; + modules = import ./modules self; routers = import ./routers; in modules @@ -14,7 +13,7 @@ in usbkey.nixosModules.default nixbigclown.nixosModules.default ] - ++ attrValues modules; + ++ builtins.attrValues modules; }; - defaultRouters = {imports = attrValues routers;}; + defaultRouters = {imports = builtins.attrValues routers;}; } diff --git a/nixos/machine/albert.nix b/nixos/machine/albert.nix index 68d55ba..85bc943 100644 --- a/nixos/machine/albert.nix +++ b/nixos/machine/albert.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -with lib; { +}: { config = { cynerd = { desktop = { diff --git a/nixos/machine/binky.nix b/nixos/machine/binky.nix index a90d625..3b3d35f 100644 --- a/nixos/machine/binky.nix +++ b/nixos/machine/binky.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkDefault; +in { config = { cynerd = { desktop = { @@ -20,8 +21,10 @@ with lib; { }; }; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"]; - boot.kernelModules = ["kvm-amd"]; + boot = { + initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"]; + kernelModules = ["kvm-amd"]; + }; hardware.cpu.amd.updateMicrocode = true; diff --git a/nixos/machine/default.nix b/nixos/machine/default.nix index aba8b6e..4aa05ba 100644 --- a/nixos/machine/default.nix +++ b/nixos/machine/default.nix @@ -1,21 +1,9 @@ -self: { - machine-albert = import ./albert.nix; - machine-binky = import ./binky.nix; - machine-dean = import ./dean.nix; - machine-errol = import ./errol.nix; - machine-ridcully = import ./ridcully.nix; - machine-susan = import ./susan.nix; - - machine-lipwig = import ./lipwig.nix; - - machine-gaspode = import ./gaspode.nix; - - machine-spt-omnia = import ./spt-omnia.nix; - machine-spt-mox = import ./spt-mox.nix; - machine-spt-mox2 = import ./spt-mox2.nix; - machine-spt-mpd = import ./spt-mpd.nix; - - machine-adm-omnia = import ./adm-omnia.nix; - machine-adm-omnia2 = import ./adm-omnia2.nix; - machine-adm-mpd = import ./adm-mpd.nix; -} +self: let + inherit (builtins) readDir; + inherit (self.inputs.nixpkgs.lib) filterAttrs nameValuePair mapAttrs' hasSuffix removeSuffix; +in + mapAttrs' + (n: v: nameValuePair "machine-${removeSuffix ".nix" n}" (import (./. + "/${n}"))) + (filterAttrs + (n: v: v == "regular" && hasSuffix ".nix" n && n != "default.nix") + (readDir ./.)) diff --git a/nixos/machine/errol.nix b/nixos/machine/errol.nix index 922ff57..f0d0aa2 100644 --- a/nixos/machine/errol.nix +++ b/nixos/machine/errol.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkDefault; +in { config = { cynerd = { desktop.enable = true; diff --git a/nixos/machine/lipwig.nix b/nixos/machine/lipwig.nix index 042ee27..fe101f4 100644 --- a/nixos/machine/lipwig.nix +++ b/nixos/machine/lipwig.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -with lib; { +}: { config = { cynerd = { syncthing = { @@ -55,6 +54,10 @@ with lib; { fastcgi_param HTTP_HOST $server_name; ''; }; + "cloud.cynerd.cz" = { + forceSSL = true; + useACMEHost = "cynerd.cz"; + }; "grafana.cynerd.cz" = { forceSSL = true; useACMEHost = "cynerd.cz"; @@ -75,6 +78,7 @@ with lib; { defaults.email = "cynerd+acme@email.cz"; certs."cynerd.cz".extraDomainNames = [ "git.cynerd.cz" + "cloud.cynerd.cz" "grafana.cynerd.cz" ]; }; @@ -157,6 +161,48 @@ with lib; { }; }; + # Nextcloud ################################################################ + services.nextcloud = { + enable = true; + package = pkgs.nextcloud28; + https = true; + hostName = "cloud.cynerd.cz"; + datadir = "/nas/nextcloud"; + config = { + adminuser = "cynerd"; + adminpassFile = "/run/secrets/nextcloud.admin.pass"; + }; + extraOptions = { + #log_type = "systemd"; + default_phone_region = "CZ"; + }; + phpOptions = { + "opcache.interned_strings_buffer" = "16"; + }; + maxUploadSize = "1G"; + appstoreEnable = false; + extraApps = { + inherit + (config.services.nextcloud.package.packages.apps) + calendar + contacts + cookbook + deck + groupfolders + notes + phonetrack + tasks + twofactor_nextcloud_notification + twofactor_webauthn + ; + passwords = pkgs.fetchNextcloudApp { + url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2023.12.2/passwords.tar.gz"; + sha256 = "17qkkkmc3gai6pryl3lb4y074pzbjk26swnpgvy6qfvkp64n8bw1"; + license = "agpl3"; + }; + }; + }; + # Old Syncthing ############################################################ services.syncthing = { enable = true; diff --git a/nixos/machine/ridcully.nix b/nixos/machine/ridcully.nix index 5814c0f..8d45959 100644 --- a/nixos/machine/ridcully.nix +++ b/nixos/machine/ridcully.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkDefault; +in { config = { cynerd = { desktop.enable = true; diff --git a/nixos/machine/spt-mox.nix b/nixos/machine/spt-mox.nix index 7dc74fa..accd963 100644 --- a/nixos/machine/spt-mox.nix +++ b/nixos/machine/spt-mox.nix @@ -10,7 +10,7 @@ with lib; { cynerd = { home-assistant = true; wifiAP.spt = { - enable = false; + enable = true; qca988x = { interface = "wls1"; channel = 7; diff --git a/nixos/machine/susan.nix b/nixos/machine/susan.nix deleted file mode 100644 index d05120f..0000000 --- a/nixos/machine/susan.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; { - config = { - cynerd.desktop.enable = true; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/e092a3ad-fb32-44fa-bc1f-14c2733da033"; - options = ["compress=lzo" "subvol=@nix"]; - }; - "/home" = { - device = "/dev/disk/by-uuid/e092a3ad-fb32-44fa-bc1f-14c2733da033"; - options = ["compress=lzo" "subvol=@home"]; - }; - "/boot" = { - device = "/dev/disk/by-uuid/EB3E-3635"; - }; - }; - }; -} diff --git a/nixos/modules/autounlock.nix b/nixos/modules/autounlock.nix index 244dcb4..d7d6a7c 100644 --- a/nixos/modules/autounlock.nix +++ b/nixos/modules/autounlock.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mapAttrs mkOption mkIf types; cnf = config.cynerd.autounlock; in { options = { diff --git a/nixos/modules/compile.nix b/nixos/modules/compile.nix index 929b373..3c90345 100644 --- a/nixos/modules/compile.nix +++ b/nixos/modules/compile.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkOption mkIf mkDefault types; +in { options = { cynerd.compile = mkOption { type = types.bool; diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 72221d8..9d707e9 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -1,14 +1,9 @@ -{ - cynerd-autounlock = import ./autounlock.nix; - cynerd-compile = import ./compile.nix; - cynerd-desktop = import ./desktop.nix; - cynerd-develop = import ./develop.nix; - cynerd-gaming = import ./gaming.nix; - cynerd-generic = import ./generic.nix; - cynerd-home-assistant = import ./home-assistant.nix; - cynerd-hosts = import ./hosts.nix; - cynerd-monitoring = import ./monitoring.nix; - cynerd-openvpn = import ./openvpn.nix; - cynerd-syncthing = import ./syncthing.nix; - cynerd-wifi-client = import ./wifi-client.nix; -} +self: let + inherit (builtins) readDir; + inherit (self.inputs.nixpkgs.lib) filterAttrs nameValuePair mapAttrs' hasSuffix removeSuffix; +in + mapAttrs' + (n: v: nameValuePair "cynerd-${removeSuffix ".nix" n}" (import (./. + "/${n}"))) + (filterAttrs + (n: v: v == "regular" && hasSuffix ".nix" n && n != "default.nix") + (readDir ./.)) diff --git a/nixos/modules/desktop.nix b/nixos/modules/desktop.nix index 38758c7..7d110ae 100644 --- a/nixos/modules/desktop.nix +++ b/nixos/modules/desktop.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption mkIf types optionals; cnf = config.cynerd.desktop; in { options = { @@ -60,9 +60,9 @@ in { notmuch astroid taskwarrior - vdirsyncer - khal - khard + #vdirsyncer + #khal + #khard gnupg pinentry-gnome pinentry-curses @@ -70,6 +70,7 @@ in { exts.pass-otp exts.pass-audit ])) + nextcloud-client chromium ferdium @@ -149,7 +150,7 @@ in { # Gnome utils gnome-firmware - gaphor + #gaphor # CAD freecad diff --git a/nixos/modules/develop.nix b/nixos/modules/develop.nix index 84358ab..1826e36 100644 --- a/nixos/modules/develop.nix +++ b/nixos/modules/develop.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkOption mkIf types; +in { options = { cynerd.develop = mkOption { type = types.bool; @@ -109,7 +110,7 @@ with lib; { stdmanpages # SHV - #shvspy + shvspy flatline shvcli diff --git a/nixos/modules/gaming.nix b/nixos/modules/gaming.nix index 182fc36..cbf2d10 100644 --- a/nixos/modules/gaming.nix +++ b/nixos/modules/gaming.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption mkIf types; cnf = config.cynerd.gaming; in { options = { diff --git a/nixos/modules/generic.nix b/nixos/modules/generic.nix index 9b64aa8..f2a0d3b 100644 --- a/nixos/modules/generic.nix +++ b/nixos/modules/generic.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOverride mkDefault mkIf optionals; isNative = config.nixpkgs.hostPlatform == config.nixpkgs.buildPlatform; in { config = { diff --git a/nixos/modules/home-assistant.nix b/nixos/modules/home-assistant.nix index 0567785..e55533e 100644 --- a/nixos/modules/home-assistant.nix +++ b/nixos/modules/home-assistant.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkIf mkEnableOption; cnf = config.cynerd.home-assistant; in { options = { diff --git a/nixos/modules/hosts.nix b/nixos/modules/hosts.nix index 2746f93..76e884d 100644 --- a/nixos/modules/hosts.nix +++ b/nixos/modules/hosts.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption types mkIf; cnf = config.cynerd.hosts; staticZoneOption = mkOption { @@ -33,7 +33,6 @@ in { # Portable "binky" = "10.8.0.2"; "albert" = "10.8.0.3"; - "susan" = "10.8.0.5"; "android" = "10.8.0.6"; # Endpoints "spt-omnia" = "10.8.0.50"; @@ -49,7 +48,6 @@ in { "errol" = "10.8.2.60"; # Portable "albert" = "10.8.2.61"; - "susan" = "10.8.2.62"; "binky" = "10.8.2.63"; }; adm = { @@ -62,7 +60,6 @@ in { "mpd" = "10.8.3.51"; # Portable "albert" = "10.8.3.61"; - "susan" = "10.8.3.62"; "binky" = "10.8.3.63"; }; }; @@ -73,7 +70,6 @@ in { "${cnf.vpn.android}" = ["android.vpn"]; "${cnf.vpn.albert}" = ["albert.vpn"]; "${cnf.vpn.dean}" = ["dean" "dean.vpn"]; - "${cnf.vpn.susan}" = ["susan.vpn"]; "${cnf.vpn.binky}" = ["binky.vpn"]; "${cnf.vpn.spt-omnia}" = ["spt.vpn"]; "${cnf.vpn.adm-omnia}" = ["adm.vpn"]; @@ -85,7 +81,6 @@ in { "${cnf.spt.mpd}" = ["mpd.spt"]; "${cnf.spt.errol}" = ["errol" "desktop.spt"]; "${cnf.spt.albert}" = ["albert.spt"]; - "${cnf.spt.susan}" = ["susan.spt"]; "${cnf.spt.binky}" = ["binky.spt"]; # Adm "${cnf.adm.omnia}" = ["omnia.adm"]; @@ -93,7 +88,6 @@ in { "${cnf.adm.omnia2}" = ["omnia2.adm"]; "${cnf.adm.ridcully}" = ["ridcully" "desktop.adm"]; "${cnf.adm.albert}" = ["albert.adm"]; - "${cnf.adm.susan}" = ["susan.adm"]; "${cnf.adm.binky}" = ["binky.adm"]; "${cnf.adm."3dprint"}" = ["3dprint"]; "${cnf.adm.mpd}" = ["mpd.adm"]; diff --git a/nixos/modules/monitoring.nix b/nixos/modules/monitoring.nix index 2fc6da5..44d0cbb 100644 --- a/nixos/modules/monitoring.nix +++ b/nixos/modules/monitoring.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption types mkMerge mkIf optionalAttrs optionals; cnf = config.cynerd.monitoring; in { options.cynerd.monitoring = { diff --git a/nixos/modules/openvpn.nix b/nixos/modules/openvpn.nix index d2c7319..57d59ee 100644 --- a/nixos/modules/openvpn.nix +++ b/nixos/modules/openvpn.nix @@ -3,8 +3,8 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption types mkIf; cnf = config.cynerd.openvpn; in { options = { diff --git a/nixos/modules/syncthing.nix b/nixos/modules/syncthing.nix index 263acbe..af6d957 100644 --- a/nixos/modules/syncthing.nix +++ b/nixos/modules/syncthing.nix @@ -3,9 +3,8 @@ lib, pkgs, ... -}: -with builtins; -with lib; let +}: let + inherit (lib) filterAttrs mkOption types mkIf any mkDefault recursiveUpdate genAttrs; cnf = config.cynerd.syncthing; inherit (config.networking) hostName; allDevices = [ diff --git a/nixos/modules/wifi-client.nix b/nixos/modules/wifi-client.nix index 0d7fd48..8fc803d 100644 --- a/nixos/modules/wifi-client.nix +++ b/nixos/modules/wifi-client.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; { +}: let + inherit (lib) mkOption types mkIf; +in { options = { cynerd.wifiClient = mkOption { type = types.bool; diff --git a/nixos/routers/wifi-adm.nix b/nixos/routers/wifi-adm.nix index f50e3f3..9869e3e 100644 --- a/nixos/routers/wifi-adm.nix +++ b/nixos/routers/wifi-adm.nix @@ -30,70 +30,111 @@ in { config = mkIf cnf.enable { services.hostapd = { - countryCode = "CZ"; - environmentFile = "/run/secrets/hostapd.env"; - interfaces = - (optionalAttrs (cnf.ar9287.interface != null) { - "${cnf.ar9287.interface}" = hostapd.qualcomAtherosAR9287 { - inherit (cnf.ar9287) channel; - bssid = "@BSSID_AR9287_0@"; - ssid = "TurrisAdamkovi"; - wpa = 2; - wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; - bss = { - "${cnf.ar9287.interface}.nela" = { - bssid = "@BSSID_AR9287_1@"; - ssid = "Nela"; - wpa = 2; - wpaPassphrase = "@PASS_NELA@"; + enable = true; + radios = { + "${cnf.ar9287.interface}" = mkIf (cnf.ar9287.interface != null) { + countryCode = "CZ"; + inherit (cnf.ar9287) channel; + wifi4 = { + enable = true; + inherit (hostapd.qualcomAtherosAR9287.wifi4) capabilities; + }; + networks = { + "${cnf.ar9287.interface}" = { + bssid = "02:f0:21:23:2b:00"; + ssid = "TurrisAdamkovi"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-TurrisAdamkovi.pass"; }; - "${cnf.ar9287.interface}.milan" = { - bssid = "@BSSID_AR9287_2@"; - ssid = "MILAN-AC"; - wpa = 2; - wpaPassphrase = "@PASS_MILAN_AC@"; + }; + "${cnf.ar9287.interface}.nela" = { + bssid = "06:f0:21:23:2b:00"; + ssid = "Nela"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-Nela.pass"; }; }; + "${cnf.ar9287.interface}.milan" = { + bssid = "0a:f0:21:23:2b:00"; + ssid = "MILAN-AC"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-MILAN-AC.pass"; + }; + }; + }; + }; + "${cnf.qca988x.interface}" = mkIf (cnf.qca988x.interface != null) { + countryCode = "CZ"; + inherit (cnf.qca988x) channel; + band = "5g"; + wifi4 = { + enable = true; + inherit (hostapd.qualcomAtherosQCA988x.wifi4) capabilities; }; - }) - // (optionalAttrs (cnf.qca988x.interface != null) { - "${cnf.qca988x.interface}" = hostapd.qualcomAtherosQCA988x { - inherit (cnf.qca988x) channel; - bssid = "@BSSID_AR9287_0@"; - ssid = "TurrisAdamkovi5"; - wpa = 2; - wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; - bss = { - "${cnf.qca988x.interface}.nela" = { - bssid = "@BSSID_AR9287_1@"; - ssid = "Nela5"; - wpa = 2; - wpaPassphrase = "@PASS_NELA@"; + wifi5 = { + enable = true; + inherit (hostapd.qualcomAtherosQCA988x.wifi5) capabilities; + }; + networks = { + "${cnf.qca988x.interface}" = { + bssid = "04:f0:21:24:24:d2"; + ssid = "TurrisAdamkovi"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-TurrisAdamkovi.pass"; + }; + }; + "${cnf.qca988x.interface}.nela" = { + bssid = "06:f0:21:24:24:d2"; + ssid = "Nela"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-Nela.pass"; }; - "${cnf.qca988x.interface}.milan" = { - bssid = "@BSSID_AR9287_2@"; - ssid = "MILAN-AC"; - wpa = 2; - wpaPassphrase = "@PASS_MILAN_AC@"; + }; + "${cnf.qca988x.interface}.milan" = { + bssid = "0a:f0:21:24:24:d2"; + ssid = "MILAN-AC"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-MILAN-AC.pass"; }; }; }; - }); + }; + }; }; - networking.bridges = { - brlan.interfaces = filter (v: v != null) [ - cnf.ar9287.interface - cnf.qca988x.interface - ]; - brguest.interfaces = - (optionals (cnf.ar9287.interface != null) [ + networking = { + # TODO wlanInterface doesn't work right now because it uses invalid + # command and seems to just configure only first interface. It is just + # wrong. + #wlanInterfaces = { + # "${cnf.ar9287.interface}.nela" = { + # device = "${cnf.ar9287.interface}"; + # mac = "06:f0:21:23:2b:00"; + # }; + # "${cnf.ar9287.interface}.milan" = { + # device = "${cnf.ar9287.interface}"; + # mac = "0a:f0:21:23:2b:00"; + # }; + #}; + bridges = { + brlan.interfaces = filter (v: v != null) [ + cnf.ar9287.interface + cnf.qca988x.interface + ]; + brguest.interfaces = optionals (cnf.ar9287.interface != null) [ "${cnf.ar9287.interface}.nela" "${cnf.ar9287.interface}.milan" - ]) - ++ (optionals (cnf.qca988x.interface != null) [ - "${cnf.qca988x.interface}.nela" - "${cnf.qca988x.interface}.milan" - ]); + ]; + # ++ (optionals (cnf.qca988x.interface != null) [ + # "${cnf.qca988x.interface}.nela" + # "${cnf.qca988x.interface}.milan" + # ]); + }; }; }; } diff --git a/nixos/routers/wifi-spt.nix b/nixos/routers/wifi-spt.nix index 3d70e18..e726b84 100644 --- a/nixos/routers/wifi-spt.nix +++ b/nixos/routers/wifi-spt.nix @@ -30,47 +30,47 @@ in { config = mkIf cnf.enable { services.hostapd = { - countryCode = "CZ"; - environmentFile = "/run/secrets/hostapd.env"; - interfaces = - (optionalAttrs (cnf.ar9287.interface != null) { - "${cnf.ar9287.interface}" = hostapd.qualcomAtherosAR9287 { - inherit (cnf.ar9287) channel; - bssid = "@BSSID_AR9287_0@"; - ssid = "TurrisRules"; - wpa = 2; - wpaPassphrase = "@PASS_TURRIS_RULES@"; - bridge = "brlan"; - bss = { - "${cnf.ar9287.interface}.guest" = { - bssid = "@BSSID_AR9287_1@"; - ssid = "Kocovi"; - wpa = 2; - wpaPassphrase = "@PASS_KOCOVI@"; - bridge = "brguest"; - }; - }; - }; - }) - // (optionalAttrs (cnf.qca988x.interface != null) { - "${cnf.qca988x.interface}" = hostapd.qualcomAtherosQCA988x { - inherit (cnf.qca988x) channel; - bssid = "@BSSID_QCA988X_0@"; - ssid = "TurrisRules5"; - wpa = 2; - wpaPassphrase = "@PASS_TURRIS_RULES@"; - bridge = "brlan"; - bss = { - "${cnf.qca988x.interface}.guest" = { - bssid = "@BSSID_QCA988X_1@"; - ssid = "Kocovi"; - wpa = 2; - wpaPassphrase = "@PASS_KOCOVI@"; - bridge = "brguest"; - }; - }; - }; - }); + #enable = true; + #countryCode = "CZ"; + #interfaces = + # (optionalAttrs (cnf.ar9287.interface != null) { + # "${cnf.ar9287.interface}" = hostapd.qualcomAtherosAR9287 { + # inherit (cnf.ar9287) channel; + # bssid = "@BSSID_AR9287_0@"; + # ssid = "TurrisRules"; + # wpa = 2; + # wpaPassphrase = "@PASS_TURRIS_RULES@"; + # bridge = "brlan"; + # bss = { + # "${cnf.ar9287.interface}.guest" = { + # bssid = "@BSSID_AR9287_1@"; + # ssid = "Kocovi"; + # wpa = 2; + # wpaPassphrase = "@PASS_KOCOVI@"; + # bridge = "brguest"; + # }; + # }; + # }; + # }) + # // (optionalAttrs (cnf.qca988x.interface != null) { + # "${cnf.qca988x.interface}" = hostapd.qualcomAtherosQCA988x { + # inherit (cnf.qca988x) channel; + # bssid = "@BSSID_QCA988X_0@"; + # ssid = "TurrisRules5"; + # wpa = 2; + # wpaPassphrase = "@PASS_TURRIS_RULES@"; + # bridge = "brlan"; + # bss = { + # "${cnf.qca988x.interface}.guest" = { + # bssid = "@BSSID_QCA988X_1@"; + # ssid = "Kocovi"; + # wpa = 2; + # wpaPassphrase = "@PASS_KOCOVI@"; + # bridge = "brguest"; + # }; + # }; + # }; + # }); }; networking.bridges = { brlan.interfaces = filter (v: v != null) [ diff --git a/pkgs/default.nix b/pkgs/default.nix index b1246cc..bed1bc4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,28 +1,23 @@ -pkgs: let - callPackage = pkgs.newScope personalpkgs; - - personalpkgs = rec { - luks-hw-password = callPackage ./luks-hw-password {}; - dev = callPackage ./dev { - devShells = import ../devShells pkgs; - }; +final: prev: { + luks-hw-password = final.callPackage ./luks-hw-password {}; + dev = final.callPackage ./dev { + devShells = import ../devShells final; + }; - 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 = final.callPackage ./theme/delft-icon-theme.nix {}; + background-lnxpcs = final.callPackage ./theme/background-lnxpcs.nix {}; + swaybackground = final.callPackage ./theme/swaybackground.nix {}; + myswaylock = final.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 = final.callPackage ./stardict {}; + stardict = final.callPackage ./stardict/wrapper.nix {stardict = final.stardict-unwrapped;}; + stardict-en-cz = final.callPackage ./stardict/en-cz.nix {}; + stardict-de-cz = final.callPackage ./stardict/de-cz.nix {}; + stardict-cz = final.callPackage ./stardict/cz.nix {}; + sdcv-unwrapped = final.callPackage ./sdcv {}; + sdcv = final.callPackage ./stardict/wrapper.nix {stardict = final.sdcv-unwrapped;}; - lorem-text = callPackage ./lorem-text {}; + lorem-text = final.callPackage ./lorem-text {}; - bigclown-leds = callPackage ./bigclown-leds {}; - }; -in - personalpkgs + bigclown-leds = final.callPackage ./bigclown-leds {}; +} diff --git a/tools/common.sh b/tools/common.sh index f74f38f..2b8e948 100644 --- a/tools/common.sh +++ b/tools/common.sh @@ -168,7 +168,7 @@ setenv() { local _store _switchop printf -v _store '%q' "$store" printf -v _switchop '%q' "$switchop" - _rootssh "$device" "$_store/bin/nixos-system -s $_switchop" + _rootssh "$device" "$_store/bin/nixos-system $_switchop" else warning "The latest system might have been already set." fi |