update flake
This commit is contained in:
parent
9721499489
commit
55bea85611
3 changed files with 122 additions and 82 deletions
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -28,11 +28,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1756047880,
|
||||
"narHash": "sha256-JeuGh9kA1SPL70fnvpLxkIkCWpTjtoPaus3jzvdna0k=",
|
||||
"lastModified": 1763982521,
|
||||
"narHash": "sha256-ur4QIAHwgFc0vXiaxn5No/FuZicxBr2p0gmT54xZkUQ=",
|
||||
"owner": "tweag",
|
||||
"repo": "gomod2nix",
|
||||
"rev": "47d628dc3b506bd28632e47280c6b89d3496909d",
|
||||
"rev": "02e63a239d6eabd595db56852535992c898eba72",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -43,11 +43,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1756823642,
|
||||
"narHash": "sha256-5n3gG2zESe1xNeoccFe8sHtBNneShfCt+NqWsn6KpR4=",
|
||||
"lastModified": 1766601203,
|
||||
"narHash": "sha256-iCAUuJRNgRoxlcBfH6pFZLU0TDzfBczpliP5iLJYujk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "549bb173b0aea5dc66da4d9443710e08f9cb5556",
|
||||
"rev": "c0532e48685132432f0d6fa751cc2bda0381b8dd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
56
flake.nix
56
flake.nix
|
|
@ -1,23 +1,33 @@
|
|||
{
|
||||
description = "sanic - chaos music control";
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable-small;
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
gomod2nix = {
|
||||
url = github:tweag/gomod2nix;
|
||||
url = "github:tweag/gomod2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils, gomod2nix }: flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
gomod2nix,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ gomod2nix.overlays.default ];
|
||||
};
|
||||
golang = pkgs.go_1_25;
|
||||
sanic = pkgs.buildGoApplication {
|
||||
pname = "sanic";
|
||||
version = "0.0.1";
|
||||
go = golang;
|
||||
src = ./.;
|
||||
modules = ./gomod2nix.toml;
|
||||
};
|
||||
|
|
@ -27,7 +37,7 @@
|
|||
src = ./.;
|
||||
doCheck = true;
|
||||
nativeBuildInputs = with pkgs; [
|
||||
go
|
||||
golang
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
checkPhase = ''
|
||||
|
|
@ -43,12 +53,14 @@
|
|||
src = ./.;
|
||||
doCheck = true;
|
||||
nativeBuildInputs = with pkgs; [
|
||||
golangci-lint
|
||||
go
|
||||
#golangci-lint
|
||||
golang
|
||||
go-tools
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
checkPhase = ''
|
||||
golangci-lint run
|
||||
#golangci-lint run
|
||||
staticcheck -f stylish ./...
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir "$out"
|
||||
|
|
@ -56,28 +68,48 @@
|
|||
};
|
||||
in
|
||||
{
|
||||
apps = {
|
||||
test = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScript "test" ''
|
||||
${golang}/bin/go test -v ./...
|
||||
''}";
|
||||
};
|
||||
lint = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScript "lint" ''
|
||||
${pkgs.go-tools}/bin/staticcheck -f stylish ./...
|
||||
''}";
|
||||
};
|
||||
};
|
||||
checks = { inherit go-test go-lint; };
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
formatter = pkgs.nixfmt-tree;
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
go
|
||||
golang
|
||||
go-tools # staticcheck
|
||||
gomod2nix.packages.${system}.default
|
||||
];
|
||||
packages = with pkgs; [
|
||||
mpd
|
||||
mpc-cli
|
||||
mpc
|
||||
mkcert
|
||||
];
|
||||
};
|
||||
packages = {
|
||||
default = sanic;
|
||||
container = pkgs.dockerTools.buildImage {
|
||||
container_old = pkgs.dockerTools.buildImage {
|
||||
name = "sanic";
|
||||
config = {
|
||||
Cmd = [ "${sanic}/bin/sanic" ];
|
||||
};
|
||||
};
|
||||
container = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "sanic";
|
||||
tag = sanic.version;
|
||||
contents = [ sanic ];
|
||||
config.Cmd = [ "${sanic}/bin/sanic" ];
|
||||
};
|
||||
};
|
||||
nixosModules.default = import ./option.nix;
|
||||
}
|
||||
|
|
|
|||
12
option.nix
12
option.nix
|
|
@ -1,4 +1,10 @@
|
|||
{ config, lib, pkgs, options, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.sanic;
|
||||
|
|
@ -11,7 +17,9 @@ in
|
|||
package = lib.mkOption {
|
||||
description = "Package to use.";
|
||||
type = lib.types.package;
|
||||
default = sanic;
|
||||
default = lib.literalExpression ''
|
||||
pkgs.sanic
|
||||
'';
|
||||
};
|
||||
ui = lib.mkOption {
|
||||
description = "Setting for HTTP(S) UI.";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue