feat: nix

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2024-06-09 20:59:43 -05:00
parent 159c6ae362
commit 8568a3b3ad
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
4 changed files with 81 additions and 0 deletions

2
.gitignore vendored 100644
View File

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

27
flake.lock 100644
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1717786204,
"narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "051f920625ab5aabe37c920346e3e69d7d34400e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

51
flake.nix 100644
View File

@ -0,0 +1,51 @@
{
description = "cfg";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
...
}: let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
inherit (nixpkgs) lib;
forEachSystem = f: (lib.listToAttrs (
map (system: {
name = system;
value = f {
inherit system;
pkgs = import nixpkgs {
inherit system;
};
};
})
systems
));
in {
packages = forEachSystem ({
pkgs,
system,
}: {
default = self.packages.${system}.cfg;
cfg = pkgs.buildGoModule rec {
pname = "cfg";
version = self.rev or "dev";
src = pkgs.nix-gitignore.gitignoreSource [] (builtins.path {
name = pname;
path = ./.;
});
subPackages = ["cmd/cfg"];
vendorHash = nixpkgs.lib.fileContents ./go.mod.sri;
meta = {
description = "config transpiler";
homepage = "https://git.jolheiser.com/cfg";
mainProgram = "cfg";
};
};
});
};
}

1
go.mod.sri 100644
View File

@ -0,0 +1 @@
sha256-IKdsBsOJ41qh/d2ZxgkY0IihIGieYlTtdHRmFufS+yQ=