Skip to content
Snippets Groups Projects
Verified Commit 86bc54d1 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: change to pute flake

parent 072d5326
No related branches found
No related tags found
No related merge requests found
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
nix_direnv_watch_file devenv.nix
nix_direnv_watch_file system/scripts/*.nix
nix_direnv_watch_file system/config/*.nix
nix_direnv_watch_file project.nix
nix_direnv_watch_file devenv.lock
nix_direnv_watch_file devenv.yaml
nix_direnv_watch_file flake.nix
nix_direnv_watch_file flake.lock
if ! use flake . --impure --show-trace
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
updateCommand="update-files"
if type "$command" &>/dev/null; then
$command
fi
watch_file ./flake.nix ./nix/scripts/*.nix ./nix/config/*.nix ./nix/packages/*.nix
use flake
\ No newline at end of file
{
"nodes": {
"cachix": {
"inputs": {
"devenv": "devenv_2",
"flake-compat": "flake-compat_2",
"nixpkgs": [
"devenv",
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1710475558,
"narHash": "sha256-egKrPCKjy/cE+NqCj4hg2fNX/NwLCf0bRDInraYXDgs=",
"owner": "cachix",
"repo": "cachix",
"rev": "661bbb7f8b55722a0406456b15267b5426a3bda6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "cachix",
"type": "github"
}
},
"devenv": {
"inputs": {
"cachix": "cachix",
"flake-compat": "flake-compat_4",
"nix": "nix_2",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks_2"
},
"locked": {
"lastModified": 1711535042,
"narHash": "sha256-Jr0LQ+bvFekPJvWxost2oymNNUzdym/Hu+HzQ6Fp630=",
"owner": "cachix",
"repo": "devenv",
"rev": "ad5a82f493f016bf4e82fae481b374d943be9560",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"devenv_2": {
"inputs": {
"flake-compat": [
"devenv",
"cachix",
"flake-compat"
],
"nix": "nix",
"nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix",
"pre-commit-hooks": [
"devenv",
"cachix",
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1708704632,
"narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=",
"owner": "cachix",
"repo": "devenv",
"rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "python-rewrite",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"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-compat_3": {
"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-compat_4": {
"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-compat_5": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"flake-root": {
"locked": {
"lastModified": 1692742795,
"narHash": "sha256-f+Y0YhVCIJ06LemO+3Xx00lIcqQxSKJHXT/yk1RTKxw=",
"owner": "srid",
"repo": "flake-root",
"rev": "d9a70d9c7a5fd7f3258ccf48da9335e9b47c3937",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"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"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"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": [
"devenv",
"cachix",
"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"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"devenv",
"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"
}
},
"mk-shell-bin": {
"locked": {
"lastModified": 1677004959,
"narHash": "sha256-/uEkr1UkJrh11vD02aqufCxtbF5YnhRTIKlx5kyvf+I=",
"owner": "rrbutani",
"repo": "nix-mk-shell-bin",
"rev": "ff5d8bd4d68a347be5042e2f16caee391cd75887",
"type": "github"
},
"original": {
"owner": "rrbutani",
"repo": "nix-mk-shell-bin",
"type": "github"
}
},
"nix": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"devenv",
"cachix",
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1708577783,
"narHash": "sha256-92xq7eXlxIT5zFNccLpjiP7sdQqQI30Gyui2p/PfKZM=",
"owner": "domenkozar",
"repo": "nix",
"rev": "ecd0af0c1f56de32cbad14daa1d82a132bf298f8",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"devenv",
"cachix",
"devenv",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870561,
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix_2": {
"inputs": {
"flake-compat": "flake-compat_5",
"nixpkgs": [
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression_2"
},
"locked": {
"lastModified": 1710500156,
"narHash": "sha256-zvCqeUO2GLOm7jnU23G4EzTZR7eylcJN+HJ5svjmubI=",
"owner": "domenkozar",
"repo": "nix",
"rev": "c5bbf14ecbd692eeabf4184cc8d50f79c2446549",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692808169,
"narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=",
"lastModified": 1716061101,
"narHash": "sha256-H0eCta7ahEgloGIwE/ihkyGstOGu+kQwAiHvwVoXaA0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9201b5ff357e781bf014d0330d18555695df7ba8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-regression_2": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"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-stable_2": {
"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": 1710236354,
"narHash": "sha256-vWrciFdq49vve43g4pbi7NjmL4cwG1ifXnQx+dU3T5E=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "829e73affeadfb4198a7105cbe3a03153d13edc9",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1704145853,
"narHash": "sha256-G/1AMt9ibpeMlcxvD1vNaC8imGaK+g7zZ99e29BLgWw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2ea8eab9e400618748ab1a6a108255233b602c",
"rev": "e7cc61784ddf51c81487637b3031a6dd2d6673a2",
"type": "github"
},
"original": {
......@@ -538,175 +15,9 @@
"type": "indirect"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils",
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"devenv",
"cachix",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1692876271,
"narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"devenv",
"cachix",
"nixpkgs"
],
"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"
}
},
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": [
"devenv",
"flake-compat"
],
"flake-utils": "flake-utils_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"devenv",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"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": {
"inputs": {
"devenv": "devenv",
"flake-parts": "flake-parts",
"flake-root": "flake-root",
"mk-shell-bin": "mk-shell-bin",
"nixpkgs": "nixpkgs_3",
"treefmt-nix": "treefmt-nix",
"versions-tool": "versions-tool"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"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"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1711531821,
"narHash": "sha256-5n4hq7PsH8g9czJ5HvXpVrJ4AiJdzrutHK01oKIaCXE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "c2172ef83d6904cdff3118e0c08e89171db6028a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"versions-tool": {
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1704542622,
"narHash": "sha256-HnFuaOXHoxv8tpBvMsEjfhcl/hFNxEY7GbBqoyJ1U8U=",
"ref": "refs/heads/master",
"rev": "6b4f85fe6d934429cf3055bbcd8cf15014730118",
"revCount": 114,
"type": "git",
"url": "https://gitlab.schukai.com/oss/utilities/version.git"
},
"original": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/utilities/version.git"
"nixpkgs": "nixpkgs"
}
}
},
......
{
description = "Configuration for the bob project";
description = "Bob the builder for Go projects";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
devenv.url = "github:cachix/devenv";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
flake-root.url = "github:srid/flake-root";
treefmt-nix.url = "github:numtide/treefmt-nix";
versions-tool.url = "git+https://gitlab.schukai.com/oss/utilities/version.git";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "nixpkgs/nixos-23.11";
outputs = inputs @ {
outputs = {
self,
flake-parts,
versions-tool,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.devenv.flakeModule
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
];
systems = (import ./project.nix).supportedSystems;
perSystem = let
common-script = import ./system/scripts/common.nix;
in
{
config,
self',
inputs',
pkgs,
system,
...
}: let
projectDefinition = import ./project.nix;
buildRoot = ./.;
enableDebugPackage = true;
portAsString = toString projectDefinition.k8s.port;
in {
packages = rec {
default = self.packages.${system}.bob;
bob = let
projectDefinition = import ./project.nix;
sourcePath = ./source;
timestamp = let
pkgs = import inputs.nixpkgs {};
in
builtins.readFile (
pkgs.runCommand "timestamp"
{when = builtins.currentTime;}
"echo -n `date -d @$when +%Y-%m-%d_%H-%M-%S` > $out"
);
in
# https://nixos.wiki/wiki/Go
pkgs.buildGoModule {
pname = projectDefinition.name;
version = projectDefinition.version;
src = sourcePath;
tags = []; # add your tags here (eq "netgo" "osusergo" "static_build")
# The -w turns off DWARF debugging information:
# The -s flag will omit the symbol table and debug information.
ldflags = [
"-s -w"
"-X '${projectDefinition.modulePath}/release.version=${projectDefinition.version}'"
"-X '${projectDefinition.modulePath}/release.commit=${projectDefinition.commitHash}'"
"-X '${projectDefinition.modulePath}/release.name=${projectDefinition.name}'"
"-X '${projectDefinition.modulePath}/release.mnemonic=${projectDefinition.mnemonic}'"
"-X '${projectDefinition.modulePath}/release.buildDate=${timestamp}'"
];
#vendorHash = null;
vendorHash = projectDefinition.vendorHash;
#vendorHash = system.lib.fakeHash;
proxyVendor = true;
meta = with system.lib; {
description = projectDefinition.description;
homepage = "https://" + projectDefinition.modulePath;
maintainers = with maintainers; ["schukai GmbH"];
};
buildInputs = [pkgs.bash];
nativeBuildInputs = with system; [pkgs.alejandra pkgs.shellcheck pkgs.shfmt];
doCheck = true;
checkPhase = ''
cd ${sourcePath}
if ! go test -v ./... 2>&1 | cat ; then
echo "Test failed."
exit 1
fi
echo "Test passed: '$out' is as expected."
'';
};
};
treefmt.config = {
inherit (config.flake-root) projectRootFile;
programs.alejandra.enable = true;
programs.gofmt.enable = true;
programs.shfmt.enable = true;
programs.shellcheck.enable = true;
programs.yamlfmt.enable = true;
programs.prettier.enable = true;
};
devenv.shells = let
projectDefinition = import ./project.nix;
buildRoot = ./.;
in {
default = rec {
name = projectDefinition.name;
scripts = let
versions-tool = inputs.versions-tool.defaultPackage."${builtins.currentSystem}";
workingDirectory = builtins.getEnv "PWD";
in {
treefmt.exec = ''
${config.treefmt.build.wrapper}/bin/treefmt
'';
rm-gitlab-pipelines.exec = import ./system/scripts/rm-gitlab-pipelines.nix {
inherit pkgs config buildRoot projectDefinition;
};
update-files.exec = import ./system/scripts/update-files.nix {
inherit pkgs config buildRoot projectDefinition;
};
check-licences.exec = import ./system/scripts/check-licences.nix {
inherit pkgs config buildRoot projectDefinition;
};
update-hashes.exec = import ./system/scripts/update-hashes.nix {
inherit pkgs config buildRoot projectDefinition workingDirectory;
};
update-version.exec = import ./system/scripts/update-version.nix {
inherit pkgs config buildRoot projectDefinition versions-tool workingDirectory;
};
git-commit.exec = import ./system/scripts/git-commit.nix {
inherit pkgs;
};
};
imports = [
];
packages = with pkgs; [
inputs.versions-tool.defaultPackage."${builtins.currentSystem}"
nodePackages.prettier-plugin-toml
nodePackages.prettier
go-task
alejandra
];
languages.javascript = {
enable = true;
package = pkgs.nodejs_21;
corepack.enable = true;
};
languages.nix.enable = true;
languages = {go = {enable = true;};};
difftastic.enable = true;
enterShell = ''
post-init-setup
'';
};
};
nixpkgs,
}: let
# to work with older version of flakes
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
rootPath = ./.;
goPkgReleaseData = import "${rootPath}/project.nix";
goPkgName = goPkgReleaseData.name or "goPkg";
goPkgMnemonic = goPkgReleaseData.mnemonic or "go-pkg";
goPkgDescription = goPkgReleaseData.description or "this is a goPkg";
goPkgVersion = goPkgReleaseData.version or "0.1.0";
goPkgHash =
if (self ? shortRev)
then self.shortRev
else "dirty-not-for-production";
goPkgVendorHash = goPkgReleaseData.vendorHash or null;
# System types to support.
supportedSystems = ["x86_64-linux" "x86_64-windows" "x86_64-darwin"];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
in {
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
bob = pkgs.buildGoModule {
name = goPkgName;
# In 'nix develop', we don't need a copy of the source tree
# in the Nix store.
src = ././source;
tags = []; # add your tags here (eq "netgo" "osusergo" "static_build")
ldflags = [
"-X 'main.version=${goPkgVersion}'"
"-X 'main.commit=${goPkgHash}'"
"-X 'main.build=${lastModifiedDate}'"
"-X 'main.name=${goPkgName}'"
"-X 'main.mnemonic=${goPkgMnemonic}'"
];
#vendorHash = pkgs.lib.fakeHash;
vendorHash = null; # disable vendorHash for goPkgVendorHash;
meta = with nixpkgs.legacyPackages.${system}.lib; {
description = goPkgDescription;
homepage = "https://gitlab.schukai.com/oss/bob";
license = licenses.mit;
maintainers = with maintainers; ["schukai GmbH"];
};
};
default = self.packages.${system}.bob;
});
flake = {
defaultPackage = self.packages.${builtins.currentSystem}.bob;
# Add dependencies that are only needed for development
devShells = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [go gopls gotools go-tools];
};
};
});
# The default package for 'nix build'. This makes sense if the
# flake provides only one package or there is a clear "main"
# package.
defaultPackage = forAllSystems (system: self.packages.${system}.bob);
};
}
......@@ -6,7 +6,7 @@
}: let
serviceSourcePath = "${buildRoot}/services/";
licensesPath = "${buildRoot}/documentation/licenses/";
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
moduleGoPath = projectDefinition.modulePath;
in ''
#!${pkgs.bash}/bin/bash
......
{pkgs, ...}: let
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
nix-flakes = builtins.getFlake "git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes";
in ''
#!${pkgs.bash}/bin/bash
......
......@@ -4,7 +4,7 @@
projectDefinition,
...
}: let
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
in ''
#!${pkgs.bash}/bin/bash
${common}
......
......@@ -5,7 +5,7 @@
projectDefinition,
...
}: let
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
taskfileYaml = import ../config/taskfile.nix {
inherit pkgs config buildRoot projectDefinition;
};
......
......@@ -6,7 +6,7 @@
...
}: let
serviceSourcePath = "${buildRoot}/";
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
in ''
#!${pkgs.bash}/bin/bash
......
......@@ -7,7 +7,7 @@
...
}: let
serviceSourcePath = "${buildRoot}/";
common = import ./common.nix {inherit pkgs;};
common = import "${./common.nix}" {inherit pkgs;};
in ''
#!${pkgs.bash}/bin/bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment