nix: remove subflake
This commit is contained in:
parent
5f5f399c8f
commit
203dad0703
16 changed files with 185 additions and 459 deletions
|
@ -1,11 +0,0 @@
|
|||
{inputs, ...}: {
|
||||
perSystem = {
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
_module.args = {
|
||||
refraction' = lib.mapAttrs (lib.const (v: v.${system} or v)) (inputs.get-flake ../../.);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{withSystem, ...}: {
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}: let
|
||||
containerFor = arch:
|
||||
pkgs.dockerTools.buildLayeredImage {
|
||||
name = "refraction";
|
||||
tag = "latest-${arch}";
|
||||
contents = [pkgs.dockerTools.caCertificates];
|
||||
config.Cmd = [
|
||||
(lib.getExe self'.packages."refraction-static-${arch}")
|
||||
];
|
||||
|
||||
architecture = withSystem "${arch}-linux" ({pkgs, ...}: pkgs.pkgsStatic.go.GOARCH);
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
container-x86_64 = containerFor "x86_64";
|
||||
container-aarch64 = containerFor "aarch64";
|
||||
};
|
||||
};
|
||||
}
|
213
nix/dev/flake.lock
generated
213
nix/dev/flake.lock
generated
|
@ -1,213 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"get-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1694475786,
|
||||
"narHash": "sha256-s5wDmPooMUNIAAsxxCMMh9g68AueGg63DYk2hVZJbc8=",
|
||||
"owner": "ursi",
|
||||
"repo": "get-flake",
|
||||
"rev": "ac54750e3b95dab6ec0726d77f440efe6045bec1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ursi",
|
||||
"repo": "get-flake",
|
||||
"rev": "ac54750e3b95dab6ec0726d77f440efe6045bec1",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714314149,
|
||||
"narHash": "sha256-yNAevSKF4krRWacmLUsLK7D7PlfuY3zF0lYnGYNi9vQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cf8cc1201be8bc71b7cbbbdaf349b22f4f99c7ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [],
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714478972,
|
||||
"narHash": "sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "2849da033884f54822af194400f8dff435ada242",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"procfile-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714465080,
|
||||
"narHash": "sha256-GeLqyVPS485iLawJVgA/CmvDgeRQcMh8RkSvBp9dp9U=",
|
||||
"owner": "getchoo",
|
||||
"repo": "procfile-nix",
|
||||
"rev": "be0f7c40dab3cf93ffc61d8736c5a63c67efd78a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "getchoo",
|
||||
"repo": "procfile-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"get-flake": "get-flake",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"procfile-nix": "procfile-nix",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"pre-commit-hooks",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714443211,
|
||||
"narHash": "sha256-lKTA3XqRo4aVgkyTSCtpcALpGXdmkilHTtN00eRg0QU=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "ce35c36f58f82cee6ec959e0d44c587d64281b6f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714058656,
|
||||
"narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
{
|
||||
description = "Discord bot for Prism Launcher";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
get-flake.url = "github:ursi/get-flake/ac54750e3b95dab6ec0726d77f440efe6045bec1";
|
||||
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
nixpkgs-stable.follows = "nixpkgs";
|
||||
flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
|
||||
procfile-nix = {
|
||||
url = "github:getchoo/procfile-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.follows = "pre-commit-hooks/flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {flake-parts, ...} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
debug = true;
|
||||
imports = [
|
||||
./args.nix
|
||||
./docker.nix
|
||||
./pre-commit.nix
|
||||
./procfiles.nix
|
||||
./shell.nix
|
||||
./static.nix
|
||||
./treefmt.nix
|
||||
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
inputs.procfile-nix.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
pre-commit.settings = {
|
||||
rootSrc = lib.mkForce ../../.;
|
||||
hooks = {
|
||||
actionlint.enable = true;
|
||||
nil.enable = true;
|
||||
statix.enable = true;
|
||||
treefmt = {
|
||||
enable = true;
|
||||
package = config.treefmt.build.wrapper;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
procfiles.daemons.processes = {
|
||||
redis = lib.getExe' pkgs.redis "redis-server";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
self',
|
||||
refraction',
|
||||
...
|
||||
}: {
|
||||
devShells.default = pkgs.mkShell {
|
||||
shellHook = ''
|
||||
${config.pre-commit.installationScript}
|
||||
'';
|
||||
|
||||
packages = with pkgs; [
|
||||
# general
|
||||
actionlint
|
||||
nodePackages.prettier
|
||||
config.procfiles.daemons.package
|
||||
|
||||
# rust
|
||||
clippy
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
|
||||
# nix
|
||||
self'.formatter
|
||||
deadnix
|
||||
nil
|
||||
statix
|
||||
];
|
||||
|
||||
inputsFrom = [refraction'.packages.refraction];
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
inputs',
|
||||
refraction',
|
||||
...
|
||||
}: let
|
||||
targets = with pkgs.pkgsCross; {
|
||||
x86_64 = musl64.pkgsStatic;
|
||||
aarch64 = aarch64-multiplatform.pkgsStatic;
|
||||
};
|
||||
|
||||
toolchain = inputs'.rust-overlay.packages.rust.minimal.override {
|
||||
extensions = ["rust-std"];
|
||||
targets = map (pkgs: pkgs.stdenv.hostPlatform.config) (lib.attrValues targets);
|
||||
};
|
||||
|
||||
rustPlatforms =
|
||||
lib.mapAttrs (
|
||||
lib.const (pkgs:
|
||||
pkgs.makeRustPlatform (
|
||||
lib.genAttrs ["cargo" "rustc"] (lib.const toolchain)
|
||||
))
|
||||
)
|
||||
targets;
|
||||
|
||||
buildWith = rustPlatform:
|
||||
refraction'.packages.refraction.override {
|
||||
inherit rustPlatform;
|
||||
optimizeSize = true;
|
||||
};
|
||||
in {
|
||||
packages =
|
||||
lib.mapAttrs' (
|
||||
target: rustPlatform:
|
||||
lib.nameValuePair "refraction-static-${target}" (buildWith rustPlatform)
|
||||
)
|
||||
rustPlatforms;
|
||||
};
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
treefmt = {
|
||||
projectRootFile = ".git/config";
|
||||
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
prettier.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
|
||||
settings.global = {
|
||||
excludes = [
|
||||
"./target"
|
||||
"./flake.lock"
|
||||
"./Cargo.lock"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
27
nix/static.nix
Normal file
27
nix/static.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
refraction,
|
||||
rust-overlay,
|
||||
pkgsCross,
|
||||
}: {arch}: let
|
||||
targets = with pkgsCross; {
|
||||
x86_64 = musl64.pkgsStatic;
|
||||
aarch64 = aarch64-multiplatform.pkgsStatic;
|
||||
};
|
||||
|
||||
getRustcTarget = pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget;
|
||||
toolchain = rust-overlay.rust.minimal.override {
|
||||
extensions = ["rust-std"];
|
||||
targets = lib.mapAttrsToList (lib.const getRustcTarget) targets;
|
||||
};
|
||||
|
||||
mkRustPlatformWith = pkgs:
|
||||
pkgs.makeRustPlatform (
|
||||
lib.genAttrs ["cargo" "rustc"] (lib.const toolchain)
|
||||
);
|
||||
rustPlatforms = lib.mapAttrs (lib.const mkRustPlatformWith) targets;
|
||||
in
|
||||
refraction.override {
|
||||
rustPlatform = rustPlatforms.${arch};
|
||||
optimizeSize = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue