Skip to content

Commit

Permalink
flake.lock: Update (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
knightpp authored Aug 25, 2023
1 parent 6c1fedf commit 21dd84f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 80 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 83 additions & 77 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
};
}

0 comments on commit 21dd84f

Please sign in to comment.