Initial commit

This commit is contained in:
Arnie 2024-09-28 21:54:29 +02:00
commit 9f1e53c3b1
5 changed files with 208 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.env
.envrc
.direnv
result

78
.golangci.yml Normal file
View File

@ -0,0 +1,78 @@
linters-settings:
errcheck:
check-type-assertions: true
gci:
sections:
- standard
- default
- prefix(go.yrps.dev)
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- hugeParam
- paramTypeCombine
- sloppyReassign
govet:
enable-all: true
settings:
shadow:
strict: true
nolintlint:
require-explanation: true
require-specific: true
sloglint:
no-global: "all"
context: "scope"
stylecheck:
checks:
- all
- -ST1000
wsl:
allow-cuddle-declarations: true
linters:
disable-all: true
enable:
- bidichk
- bodyclose
- copyloopvar
- errcheck
- errorlint
- exportloopref
- exhaustive
- gci
- gocheckcompilerdirectives
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- noctx
- nolintlint
- prealloc
- predeclared
- protogetter
- sloglint
- staticcheck
- stylecheck
- unconvert
- unparam
- unused
- whitespace
- usestdlibvars
- wsl
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-use-default: false
exclude:
- Error return value of .*\.Body\.Close. is not checked

12
default.nix Normal file
View File

@ -0,0 +1,12 @@
{ system ? builtins.currentSystem }:
let
flake-compat = builtins.fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/0f9255e01c2351cc7d116c072cb317785dd33b33.tar.gz";
sha256 = "sha256:0m9grvfsbwmvgwaxvdzv6cmyvjnlww004gfxjvcl806ndqaxzy4j";
};
flake = import flake-compat { src = ./.; };
in
{
image = flake.defaultNix.packages.${system}.image;
shell = flake.shellNix.default;
}

48
flake.lock Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"devshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722113426,
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
"owner": "numtide",
"repo": "devshell",
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1727348695,
"narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devshell": "devshell",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

66
flake.nix Normal file
View File

@ -0,0 +1,66 @@
{
description = "Arnie's nix flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, devshell }:
let
systems = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
in
{
lib = {
forAllSystems = function: systems (system:
function (import nixpkgs {
inherit system;
overlays = [
devshell.overlays.default
];
config.allowUnfreePredicate = (pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "terraform" ]);
})
);
golangci-config-file = ./.golangci.yml;
cd_root = "cd $PRJ_ROOT;";
};
formatter = self.lib.forAllSystems (pkgs: pkgs.nixpkgs-fmt);
devShells = self.lib.forAllSystems (pkgs: {
default = pkgs.devshell.mkShell {
name = "nix";
packages = [
pkgs.nix-tree
pkgs.golangci-lint
];
commands = [
{
name = "fix";
command = ''
${self.lib.cd_root}
nix fmt .
'';
}
];
};
});
packages = self.lib.forAllSystems (pkgs:
{
control4_env = pkgs.mkShell {
packages = [
pkgs.lua5_1
];
};
}
);
};
}