From dfb606e59ee45d90e4f87ade9fc7309eb52d0b5a Mon Sep 17 00:00:00 2001 From: xecarlox94 Date: Sun, 5 Jan 2025 13:41:19 +0000 Subject: [PATCH] moving flake file and additional gitignore changes to branch --- .gitignore | 4 ++++ flake.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 645ba09..1926a85 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,7 @@ p2prc.PublicKeyBareMetal # Ignore pem files *.pem + +# Nix and Nix flake files +result +result-* diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..699b714 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "P2PRC nix flake"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.gomod2nix.url = "github:nix-community/gomod2nix"; + inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; + inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; + + outputs = { self, nixpkgs, flake-utils, gomod2nix }: + (flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. + # This has no effect on other platforms. + callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; + in + { + + # packages.default = callPackage ./. { + # inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; + # }; + + devShells.default = callPackage ./shell.nix { + inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; + }; + }) + ); +}