diff --git a/flake.lock b/flake.lock index 7a1ce71..5a4bb39 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1690558459, - "narHash": "sha256-5W7y1l2cLYPkpJGNlAja7XW2X2o9rjf0O1mo9nxS9jQ=", + "lastModified": 1692794066, + "narHash": "sha256-H0aG8r16dj0x/Wz6wQhQxc9V7AsObOiHPaKxQgH6Y08=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "48e82fe1b1c863ee26a33ce9bd39621d2ada0a33", + "rev": "fc944919f743bb22379dddf18dcb72db6cff84aa", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ceba3e8..9a839b9 100644 --- a/flake.nix +++ b/flake.nix @@ -3,87 +3,93 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; }; - outputs = { self, nixpkgs }: - let - # Systems supported - allSystems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; + outputs = { + self, + nixpkgs, + }: let + # Systems supported + allSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; - # Helper to provide system-specific attributes - forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { - pkgs = import nixpkgs { inherit system; }; - }); - in - { - # Development environment output - devShells = forAllSystems ({ pkgs }: { - default = pkgs.mkShell { - # The Nix packages provided in the environment - packages = with pkgs; [ - go_1_20 - gotools # Go tools like goimports, godoc, and others - ]; + # Helper to provide system-specific attributes + forAllSystems = f: + nixpkgs.lib.genAttrs allSystems (system: + f { + pkgs = import nixpkgs {inherit system;}; + }); + in { + # Development environment output + devShells = forAllSystems ({pkgs}: { + default = pkgs.mkShell { + # The Nix packages provided in the environment + packages = with pkgs; [ + go_1_20 + go-tools # Go tools like goimports, godoc, and others + ]; + }; + }); + + packages = + forAllSystems + ({pkgs}: let + path = builtins.path { + name = "modupdate"; + path = ./.; }; - }); + gitRev = + if (self ? rev) + then self.rev + else "dirty"; + modupdate = pkgs.buildGoModule { + name = "modupdate"; + src = pkgs.nix-gitignore.gitignoreSource [] path; + vendorSha256 = "sha256-XU4kLbEAPCL8mNk4omk2OIijKdiiAsJKBfoKkJJfHkI="; - packages = forAllSystems - ({ pkgs }: - let - path = builtins.path { - name = "modupdate"; - path = ./.; - }; - gitRev = if (self ? rev) then self.rev else "dirty"; - modupdate = pkgs.buildGoModule { - name = "modupdate"; - src = pkgs.nix-gitignore.gitignoreSource [ ] path; - vendorSha256 = "sha256-XU4kLbEAPCL8mNk4omk2OIijKdiiAsJKBfoKkJJfHkI="; + ldflags = [ + "-s" + "-w" + "-X 'main.version=${self.shortRev or ""}'" + "-X 'main.vcsCommit=${gitRev}'" + ]; - ldflags = [ - "-s" - "-w" - "-X 'main.version=${self.shortRev or ""}'" - "-X 'main.vcsCommit=${gitRev}'" + meta = with pkgs.lib; { + description = "Tool to update direct dependencies in go.mod"; + homepage = "https://github.com/knightpp/modupdate"; + license = licenses.mit; + maintainers = with maintainers; [knightpp]; + }; + }; + container = + # docker run --rm -i --tty -v (pwd):/src modupdate + pkgs.dockerTools.buildImage { + name = "modupdate"; + tag = "latest"; + # created = "now"; # if you want correct timestamp + copyToRoot = pkgs.buildEnv { + name = "modupdate-root"; + paths = [ + modupdate + pkgs.go + pkgs.cacert # x509 certificates to pull from https + ]; + pathsToLink = [ + "/bin" + "/etc/ssl" # include x509 certificates ]; - - meta = with pkgs.lib; { - description = "Tool to update direct dependencies in go.mod"; - homepage = "https://github.com/knightpp/modupdate"; - license = licenses.mit; - maintainers = with maintainers; [ knightpp ]; - }; }; - container = # docker run --rm -i --tty -v (pwd):/src modupdate - pkgs.dockerTools.buildImage { - name = "modupdate"; - tag = "latest"; - # created = "now"; # if you want correct timestamp - copyToRoot = pkgs.buildEnv { - name = "modupdate-root"; - paths = [ - modupdate - pkgs.go - pkgs.cacert # x509 certificates to pull from https - ]; - pathsToLink = [ - "/bin" - "/etc/ssl" # include x509 certificates - ]; - }; - config = { - Cmd = [ "modupdate" ]; - WorkingDir = "/src"; - }; - }; - in - { - default = modupdate; - # NOTE: Do not use this, it's just an example for my own use - inherit container; - }); - }; + config = { + Cmd = ["modupdate"]; + WorkingDir = "/src"; + }; + }; + in { + default = modupdate; + # NOTE: Do not use this, it's just an example for my own use + inherit container; + }); + }; }