flake: add p2
This commit is contained in:
parent
28e9f9469c
commit
95afeb6815
16
flake.lock
16
flake.lock
@ -16,6 +16,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1666547822,
|
||||
"narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1666244578,
|
||||
@ -35,6 +50,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
99
flake.nix
99
flake.nix
@ -6,11 +6,15 @@
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
nix-filter = {
|
||||
url = "github:numtide/nix-filter";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nix-filter,
|
||||
...
|
||||
}: let
|
||||
projname = "ak9im";
|
||||
@ -41,6 +45,8 @@
|
||||
);
|
||||
packages = forAllSystems (system: let
|
||||
baseurl = "https://git.dotya.ml/wanderer/ak9im/";
|
||||
pkgs = nixpkgsFor.${system};
|
||||
inherit (pkgs) lib overlays;
|
||||
in rec {
|
||||
p1 = pkgs.${system}.poetry2nix.mkPoetryApplication {
|
||||
name = "p1";
|
||||
@ -53,6 +59,84 @@
|
||||
platforms = nixpkgs.lib.platforms.linux ++ nixpkgs.lib.platforms.darwin;
|
||||
};
|
||||
};
|
||||
|
||||
p2 = with pkgs;
|
||||
buildGo119Module rec {
|
||||
pname = "p2";
|
||||
buildInputs = [
|
||||
go_1_19
|
||||
gcc
|
||||
];
|
||||
nativeBuildInputs = [pkgconfig];
|
||||
|
||||
overrideModAttrs = _: {
|
||||
# GOPROXY = "direct";
|
||||
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
|
||||
};
|
||||
|
||||
inherit version;
|
||||
doCheck = false;
|
||||
# use go.mod for managing go deps, instead of vendor-only dir
|
||||
proxyVendor = true;
|
||||
tags = []; # go "-tags" to build with
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${version}"
|
||||
];
|
||||
|
||||
# dont't forget to update vendorSha256 whenever go.mod or go.sum change
|
||||
vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
||||
|
||||
# In 'nix develop', we don't need a copy of the source tree
|
||||
# in the Nix store.
|
||||
src = nix-filter.lib.filter {
|
||||
# when in doubt, check out
|
||||
# https://github.com/numtide/nix-filter#design-notes
|
||||
# tl;dr: it'd be best to include folders, however there are
|
||||
# currently issues with that approach.
|
||||
root = lib.cleanSource ./p2;
|
||||
exclude = [
|
||||
./p2/README.md
|
||||
|
||||
./p1
|
||||
|
||||
./flake.nix
|
||||
./flake.lock
|
||||
./default.nix
|
||||
./shell.nix
|
||||
./overlay.nix
|
||||
|
||||
./README.md
|
||||
|
||||
./.envrc
|
||||
./.gitattributes
|
||||
./.gitignore
|
||||
./.golangci.yml
|
||||
./.editorconfig
|
||||
./.pre-commit-config.yaml
|
||||
|
||||
# program output
|
||||
./out
|
||||
./res
|
||||
|
||||
# nix result symlink
|
||||
./result
|
||||
|
||||
# the entire .git folder
|
||||
./.git
|
||||
];
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "implementation of task 2 for ak9im";
|
||||
homepage = "https://git.dotya.ml/wanderer/ak9im/p2";
|
||||
license = lib.licenses.gpl3;
|
||||
maintainers = ["wanderer"];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
};
|
||||
|
||||
default = p1;
|
||||
});
|
||||
|
||||
@ -61,6 +145,10 @@
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.${projname}}/bin/p1";
|
||||
};
|
||||
p2 = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.${projname}}/bin/p2";
|
||||
};
|
||||
default = p1;
|
||||
});
|
||||
|
||||
@ -85,6 +173,12 @@
|
||||
in {
|
||||
default = pkgs.${system}.mkShellNoCC {
|
||||
name = "${projname}-" + version;
|
||||
|
||||
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
|
||||
GOLDFLAGS = "-s -w -X main.version=${version}";
|
||||
CGO_CFLAGS = "-g0 -Ofast -mtune=native -flto";
|
||||
CGO_LDFLAGS = "-Wl,-O1,-sort-common,-as-needed,-z,relro,-z,now,-flto -pthread";
|
||||
|
||||
shellHook = ''
|
||||
echo " -- in ${projname} dev shell..."
|
||||
'';
|
||||
@ -102,6 +196,11 @@
|
||||
python3Packages.matplotlib
|
||||
python3Packages.scipy
|
||||
poetry
|
||||
|
||||
go_1_19
|
||||
go-tools
|
||||
gopls
|
||||
gofumpt
|
||||
];
|
||||
};
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user