Compare commits

...

2 commits

Author SHA1 Message Date
6f4757a1e9 chore: update flake.lock 2025-11-07 16:38:34 +01:00
eb64db1c80 feat: update flake. 2025-11-07 16:32:13 +01:00
4 changed files with 77 additions and 191 deletions

View file

@ -1,4 +1,5 @@
{ pkgs ? ( {
pkgs ? (
let let
inherit (builtins) fetchTree fromJSON readFile; inherit (builtins) fetchTree fromJSON readFile;
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
@ -8,10 +9,9 @@
(import "${fetchTree gomod2nix.locked}/overlay.nix") (import "${fetchTree gomod2nix.locked}/overlay.nix")
]; ];
} }
) ),
, buildGoApplication ? pkgs.buildGoApplication buildGoApplication ? pkgs.buildGoApplication,
}: }:
buildGoApplication { buildGoApplication {
pname = "upfast"; pname = "upfast";
version = "1.3"; version = "1.3";

145
flake.lock generated
View file

@ -1,31 +1,15 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1709126324, "lastModified": 1731533236,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -34,45 +18,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gomod2nix": { "gomod2nix": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@ -83,11 +28,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1705314449, "lastModified": 1759991118,
"narHash": "sha256-yfQQ67dLejP0FLK76LKHbkzcQqNIrux6MFe32MMFGNQ=", "narHash": "sha256-pDyrtUQyeP1lVTMIYqJtftzDtsXEZaJjYy9ZQ/SGhL8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "gomod2nix", "repo": "gomod2nix",
"rev": "30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6", "rev": "7f8d7438f5870eb167abaf2c39eea3d2302019d1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -98,11 +43,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1709237383, "lastModified": 1762363567,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", "narHash": "sha256-YRqMDEtSMbitIMj+JLpheSz0pwEr0Rmy5mC7myl17xs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", "rev": "ae814fd3904b621d8ab97418f1d0f2eb0d3716f4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -112,66 +57,11 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable": {
"locked": {
"lastModified": 1704874635,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1704842529,
"narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"gomod2nix": "gomod2nix", "gomod2nix": "gomod2nix",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"pre-commit-hooks": "pre-commit-hooks"
} }
}, },
"systems": { "systems": {
@ -188,21 +78,6 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"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", "root": "root",

View file

@ -6,26 +6,45 @@
inputs.gomod2nix.url = "github:nix-community/gomod2nix"; inputs.gomod2nix.url = "github:nix-community/gomod2nix";
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
outputs = { self, nixpkgs, flake-utils, gomod2nix, pre-commit-hooks }: outputs = {
(flake-utils.lib.eachDefaultSystem self,
(system: nixpkgs,
let flake-utils,
gomod2nix,
}: (flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now. callPackage = pkgs.callPackage;
# This has no effect on other platforms. # Simple lint check added to nix flake check
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; go-lint = pkgs.stdenvNoCC.mkDerivation {
in name = "go-lint";
{ dontBuild = true;
src = ./.;
doCheck = true;
nativeBuildInputs = with pkgs; [
golangci-lint
go
writableTmpDirAsHomeHook
];
checkPhase = ''
golangci-lint run
'';
installPhase = ''
mkdir "$out"
'';
};
in {
checks = {
inherit go-lint;
};
packages.default = callPackage ./. { packages.default = callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
}; };
devShells.default = callPackage ./shell.nix { devShells.default = callPackage ./shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
inherit pre-commit-hooks;
}; };
}) }
); ));
} }

View file

@ -1,4 +1,5 @@
{ pkgs ? ( {
pkgs ? (
let let
inherit (builtins) fetchTree fromJSON readFile; inherit (builtins) fetchTree fromJSON readFile;
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
@ -8,25 +9,16 @@
(import "${fetchTree gomod2nix.locked}/overlay.nix") (import "${fetchTree gomod2nix.locked}/overlay.nix")
]; ];
} }
) ),
, mkGoEnv ? pkgs.mkGoEnv mkGoEnv ? pkgs.mkGoEnv,
, gomod2nix ? pkgs.gomod2nix gomod2nix ? pkgs.gomod2nix,
, pre-commit-hooks }: let
}:
let
goEnv = mkGoEnv {pwd = ./.;}; goEnv = mkGoEnv {pwd = ./.;};
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
gofmt.enable = true;
};
};
in in
pkgs.mkShell { pkgs.mkShell {
inherit (pre-commit-check) shellHook;
packages = [ packages = [
goEnv goEnv
gomod2nix gomod2nix
pkgs.gopls
]; ];
} }