added nix flake

This commit is contained in:
2026-04-07 20:25:57 +02:00
parent 6daf2f953f
commit 187546b750
3 changed files with 129 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/result

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1775423009,
"narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"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",
"version": 7
}

67
flake.nix Normal file
View File

@@ -0,0 +1,67 @@
{
description = "ripsort";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pname = "ripsort";
version = "0.1.0";
app = pkgs.buildGoModule {
inherit pname version;
src = ./.;
vendorHash = "sha256-K40zYmELd2eM29CdOScbRcC0NSrsZRsRGPTPgWRAFPQ=";
meta = with pkgs.lib; {
description = "Organize music library";
license = licenses.asl20;
mainProgram = pname;
};
};
in
{
packages.default = app;
packages.${pname} = app;
defaultPackage = app;
apps.default = flake-utils.lib.mkApp { drv = app; };
devShells.default = pkgs.mkShell {
name = "${pname}-dev";
packages = with pkgs; [
go
gopls
gotools
golangci-lint
delve
];
env = {
GOPATH = "${placeholder "out"}/go";
CGO_ENABLED = "0";
};
shellHook = ''
echo "Go version: $(go version | awk '{print $3}')"
'';
};
devShell = self.devShells.${system}.default;
}
);
}