Skip to content

Commit f16adee

Browse files
committed
WIP
1 parent e977b78 commit f16adee

File tree

5 files changed

+292
-11
lines changed

5 files changed

+292
-11
lines changed

flake.lock

Lines changed: 189 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
description = "Flake for acm-aws";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs?ref=50aa30a13c4ab5e7ba282da460a3e3d44e9d0eb3";
6+
7+
flake-utils.url = "github:numtide/flake-utils";
8+
9+
gomod2nix.url = "github:nix-community/gomod2nix";
10+
gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
11+
gomod2nix.inputs.flake-utils.follows = "flake-utils";
12+
13+
poetry2nix.url = "github:nix-community/poetry2nix";
14+
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
15+
poetry2nix.inputs.flake-utils.follows = "flake-utils";
16+
17+
nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage";
18+
nix-npm-buildpackage.inputs.nixpkgs.follows = "nixpkgs";
19+
};
20+
21+
outputs = {
22+
self,
23+
nixpkgs,
24+
flake-utils,
25+
gomod2nix,
26+
poetry2nix,
27+
nix-npm-buildpackage,
28+
}@inputs:
29+
30+
flake-utils.lib.eachDefaultSystem (system:
31+
let
32+
pkgs = nixpkgs.legacyPackages.${system};
33+
overlays = self.overlays.${system};
34+
in
35+
{
36+
overlays = {
37+
# Overlay for the build tools that our packages use.
38+
buildTools = final: prev: {
39+
#
40+
# Build tools
41+
#
42+
inherit (gomod2nix.legacyPackages.${system})
43+
mkGoEnv buildGoApplication;
44+
inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = prev; })
45+
mkPoetryApplication;
46+
inherit (nix-npm-buildpackage.legacyPackages.${system})
47+
buildNpmPackage
48+
buildYarnPackage;
49+
buildDenoPackage = final.callPackage ./nix/packaging/deno.nix { };
50+
buildJavaPackage = final.callPackage ./nix/packaging/java.nix { };
51+
buildGradlePackage = final.callPackage ./nix/packaging/gradle.nix { };
52+
buildPoetryPackage = final.callPackage ./nix/packaging/poetry.nix { };
53+
54+
#
55+
# Miscellanous tools
56+
#
57+
nix-update = final.callPackage ./nix/nix-update.nix { };
58+
59+
#
60+
# Miscellanous utility derivations
61+
#
62+
pkgutil = final.callPackage ./nix/pkgutil.nix { };
63+
sources = import ./nix/sources.nix {
64+
inherit system;
65+
pkgs = prev;
66+
};
67+
};
68+
# Overlay adding our own packages.
69+
default = final: prev: self.packages.${system};
70+
};
71+
72+
packages = import ./packages {
73+
pkgs = nixpkgs.legacyPackages.${system}.extend (overlays.buildTools);
74+
};
75+
76+
nixosConfigurations = {
77+
cirno = nixpkgs.lib.nixosSystem {
78+
system = "x86_64-linux";
79+
modules = [
80+
({ ... }: { nixpkgs.overlays = [ overlays.default ]; })
81+
./servers/base.nix
82+
./servers/cirno/configuration.nix
83+
];
84+
specialArgs = inputs // { inherit self; };
85+
};
86+
cs306 = nixpkgs.lib.nixosSystem {
87+
system = "x86_64-linux";
88+
modules = [
89+
({ ... }: { nixpkgs.overlays = [ overlays.default ]; })
90+
./servers/base.nix
91+
./servers/cs306/configuration.nix
92+
];
93+
specialArgs = inputs // { inherit self; };
94+
};
95+
};
96+
}
97+
);
98+
}

nix/packaging/poetry.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
{ poetry2nix, writeShellScriptBin, python3 }:
2-
3-
let
4-
pkgutil = import <acm-aws/nix/pkgutil.nix>;
5-
in
1+
{ pkgutil, mkPoetryApplication, writeShellScriptBin, python3 }:
62

73
{
84
name ? "${pname}-${version}",
@@ -16,7 +12,7 @@ in
1612
}:
1713

1814
let
19-
poetryApplication = (poetry2nix.mkPoetryApplication {
15+
poetryApplication = (mkPoetryApplication {
2016
inherit src python;
2117
pyproject = "${src}/pyproject.toml";
2218
poetrylock = "${src}/poetry.lock";

nix/pkgutil.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{ pkgs }:
2+
13
{
24
version = src:
35
if (src ? version && src.version != "")

packages/crying-counter/default.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
{ buildPoetryPackage, git, runCommandLocal }:
2-
3-
let
4-
sources = import <acm-aws/nix/sources.nix>;
5-
in
1+
{ buildPoetryPackage, git, runCommandLocal, sources }:
62

73
buildPoetryPackage {
84
pname = "crying-counter";

0 commit comments

Comments
 (0)