diff --git a/flake.lock b/flake.lock index c45fed3..ef7f8b9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,5 @@ { "nodes": { - "devshell": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1722113426, - "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", - "owner": "numtide", - "repo": "devshell", - "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -40,42 +20,6 @@ "type": "github" } }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": [ - "vpnconfinement", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-root": { - "locked": { - "lastModified": 1723604017, - "narHash": "sha256-rBtQ8gg+Dn4Sx/s+pvjdq3CB2wQNzx9XGFq/JVGCB6k=", - "owner": "srid", - "repo": "flake-root", - "rev": "b759a56851e10cb13f6b8e5698af7b59c44be26e", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "flake-root", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1726583932, @@ -94,12 +38,9 @@ }, "root": { "inputs": { - "devshell": "devshell", "flake-parts": "flake-parts", - "flake-root": "flake-root", "nixpkgs": "nixpkgs", "submerger": "submerger", - "treefmt-nix": "treefmt-nix", "vpnconfinement": "vpnconfinement" } }, @@ -145,29 +86,11 @@ "type": "github" } }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1726734507, - "narHash": "sha256-VUH5O5AcOSxb0uL/m34dDkxFKP6WLQ6y4I1B4+N3L2w=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "ee41a466c2255a3abe6bc50fc6be927cdee57a9f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "vpnconfinement": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": [ + "flake-parts" + ], "nixpkgs": [ "nixpkgs" ] diff --git a/flake.nix b/flake.nix index 56957f4..cd260de 100644 --- a/flake.nix +++ b/flake.nix @@ -14,78 +14,51 @@ submerger.url = "github:rasmus-kirk/submerger"; submerger.inputs.nixpkgs.follows = "nixpkgs"; - - # Flake stuff - flake-parts.url = "github:hercules-ci/flake-parts"; - flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; - - flake-root.url = "github:srid/flake-root"; - - devshell.url = "github:numtide/devshell"; - devshell.inputs.nixpkgs.follows = "nixpkgs"; - - treefmt-nix.url = "github:numtide/treefmt-nix"; - treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { - flake-parts, + nixpkgs, vpnconfinement, submerger, ... } @ inputs: - flake-parts.lib.mkFlake { - inherit inputs; - } { - imports = with inputs; [ - flake-root.flakeModule - treefmt-nix.flakeModule - devshell.flakeModule - ]; - systems = [ - "x86_64-linux" + let + # Systems supported + supportedSystems = [ + "x86_64-linux" # 64-bit Intel/AMD Linux + "aarch64-linux" # 64-bit ARM Linux + "x86_64-darwin" # 64-bit Intel macOS + "aarch64-darwin" # 64-bit ARM macOS ]; - flake = { - nixosModules = rec { - nixarr = import ./nixarr submerger vpnconfinement; - imports = [ vpnconfinement.nixosModules.default ]; - default = nixarr; - }; + # Helper to provide system-specific attributes + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in { + nixosModules = rec { + nixarr = import ./nixarr submerger vpnconfinement; + imports = [ vpnconfinement.nixosModules.default ]; + default = nixarr; }; - perSystem = { - config, - pkgs, - ... - }: { - treefmt.config = { - inherit (config.flake-root) projectRootFile; - package = pkgs.treefmt; - - programs = { - alejandra.enable = true; - deadnix.enable = true; - }; + devShells = forAllSystems ({ pkgs } : { + default = pkgs.mkShell { + packages = with pkgs; [ + alejandra + ]; }; + }); - packages = rec { + packages = forAllSystems ({ pkgs } : { + default = pkgs.mkShell rec { docs = pkgs.callPackage ./mkDocs.nix {inherit inputs;}; default = docs; }; + }); - devshells.default = { - name = "Rasmus Kirk"; - - commands = [ - { - category = "Tools"; - name = "fmt"; - help = "Format the source tree"; - command = "nix fmt"; - } - ]; - }; - }; + formatters = forAllSystems ({ pkgs } : { + default = pkgs.alejandra; + }); }; }