diff --git a/flake.lock b/flake.lock index 280c634..9470d49 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,30 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1672441588, - "narHash": "sha256-jx5kxOyeObnVD44HRebKYL3cjWrcKhhcDmEYm0/naDY=", + "lastModified": 1682134069, + "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6a0d2701705c3cf6f42c15aa92b7885f1f8a477f", + "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", "type": "github" }, "original": { @@ -16,8 +34,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 661bcb2..4f6f7e5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,37 @@ { description = "NixOS VSCode server"; + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, nixpkgs, - }: let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - auto-fix-vscode-server = pkgs.callPackage ./pkgs/auto-fix-vscode-server.nix { }; - in { - nixosModule = import ./modules/vscode-server; - nixosModules.default = self.nixosModule; - nixosModules.home = import ./modules/vscode-server/home.nix; - checks.x86_64-linux.auto-fix-vscode-server = auto-fix-vscode-server; - }; + flake-utils, + }: + { + nixosModule = self.nixosModules.default; # Deprecrated, but perhaps still in use. + nixosModules.default = import ./modules/vscode-server; + nixosModules.home = self.homeModules.default; # Backwards compatiblity. + homeModules.default = import ./modules/vscode-server/home.nix; # Consistent with homeConfigurations. + } + // (let + inherit (flake-utils.lib) defaultSystems eachSystem; + in + eachSystem defaultSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + inherit (pkgs.lib) hasSuffix optionalAttrs; + auto-fix-vscode-server = pkgs.callPackage ./pkgs/auto-fix-vscode-server.nix { }; + in + # The package depends on `inotify-tools` which is only available on Linux. + optionalAttrs (hasSuffix "-linux" system) { + packages = { + inherit auto-fix-vscode-server; + default = auto-fix-vscode-server; + }; + checks = { + inherit auto-fix-vscode-server; + }; + })); }