diff --git a/codegen.ts b/codegen.ts index f47c88e9..02a988a9 100644 --- a/codegen.ts +++ b/codegen.ts @@ -9,6 +9,7 @@ const config: CodegenConfig = { plugins: [], config: { enumsAsTypes: true, + useTypeImports: true, }, presetConfig: { gqlTagName: "gql", diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..637a0bf6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,45 @@ +{ + "nodes": { + "deno2nix": { + "flake": false, + "locked": { + "lastModified": 1771449470, + "narHash": "sha256-ZGKHKRB7K5aUIyJenXwOcX21F2yTXLa19q3YXQM3E48=", + "owner": "aMOPel", + "repo": "deno2nix", + "rev": "adb4dcea663cd61c19e01c8c36dd73db4af358a5", + "type": "github" + }, + "original": { + "owner": "aMOPel", + "ref": "custom-made-fetcher", + "repo": "deno2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1775423009, + "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "deno2nix": "deno2nix", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..ba2bc5de --- /dev/null +++ b/flake.nix @@ -0,0 +1,85 @@ +{ + description = "Nix flake for linear-cli"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + deno2nix = { + url = "github:aMOPel/deno2nix?ref=custom-made-fetcher"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, deno2nix }: + let + lib = nixpkgs.lib; + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = lib.genAttrs systems; + in + { + packages = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + deno2nixLib = (import deno2nix { inherit pkgs; }).lib; + version = (builtins.fromJSON (builtins.readFile ./deno.json)).version; + linear = deno2nixLib.buildDenoPackage { + pname = "linear"; + inherit version; + src = lib.cleanSource ./.; + denoDepsHash = "sha256-jGqice4hH4RW2o7Q4VhwUm8G/EUb98AdJ/Z1jrXMeGE="; + + buildPhase = '' + runHook preBuild + deno run --no-check --cached-only --allow-all npm:@graphql-codegen/cli/graphql-codegen-esm + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/linear $out/bin $out/share/doc/linear $out/share/licenses/linear + cp -r src graphql deno.json deno.lock $out/share/linear/ + cp -r vendor .deno node_modules $out/share/linear/ + cp README.md CHANGELOG.md $out/share/doc/linear/ + cp LICENSE $out/share/licenses/linear/ + cat > $out/bin/linear <