nix: move dev outputs to subflake
This commit is contained in:
parent
3503dda44d
commit
921540e249
18 changed files with 461 additions and 331 deletions
2
.envrc
2
.envrc
|
@ -1,5 +1,5 @@
|
|||
if has nix_direnv_version; then
|
||||
use flake
|
||||
use flake ./nix/dev
|
||||
fi
|
||||
|
||||
dotenv_if_exists
|
||||
|
|
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
|
@ -27,7 +27,7 @@ jobs:
|
|||
- name: Build Docker image
|
||||
id: build
|
||||
run: |
|
||||
nix build --print-build-logs .#container-${{ matrix.arch }}
|
||||
nix build --print-build-logs ./nix/dev#container-${{ matrix.arch }}
|
||||
[ ! -L result ] && exit 1
|
||||
echo "path=$(readlink -f result)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
|
|
4
.github/workflows/nix.yml
vendored
4
.github/workflows/nix.yml
vendored
|
@ -48,4 +48,6 @@ jobs:
|
|||
uses: DeterminateSystems/magic-nix-cache-action@v4
|
||||
|
||||
- name: Run checks
|
||||
run: nix flake check --print-build-logs --show-trace
|
||||
run: |
|
||||
cd ./nix/dev
|
||||
nix flake check --print-build-logs --show-trace
|
||||
|
|
60
.github/workflows/update-flake.yml
vendored
60
.github/workflows/update-flake.yml
vendored
|
@ -8,21 +8,65 @@ on:
|
|||
|
||||
jobs:
|
||||
update:
|
||||
name: Run update
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
PR_BRANCH: 'update-lockfiles'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: nixbuild/nix-quick-install-action@v27
|
||||
uses: DeterminateSystems/nix-installer-action@v10
|
||||
|
||||
- name: Update and create PR
|
||||
uses: DeterminateSystems/update-flake-lock@v21
|
||||
with:
|
||||
commit-msg: 'nix: update flake.lock'
|
||||
pr-title: 'nix: update flake.lock'
|
||||
token: ${{ github.token }}
|
||||
- name: Set Git user info
|
||||
run: |
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
|
||||
- name: Create new branch
|
||||
id: branch
|
||||
run: |
|
||||
git switch -c "$PR_BRANCH"
|
||||
|
||||
- name: Update flake inputs
|
||||
run: |
|
||||
pushd nix/dev
|
||||
nix flake update \
|
||||
--commit-lock-file \
|
||||
--commit-lockfile-summary "nix: update dev flake.lock"
|
||||
popd
|
||||
|
||||
nix flake update \
|
||||
--commit-lock-file \
|
||||
--commit-lockfile-summary "nix: update flake.lock"
|
||||
|
||||
- name: Make PR if needed
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if ! git diff --color=always --exit-code origin/main; then
|
||||
git fetch origin "$PR_BRANCH" || true
|
||||
git push --force-with-lease -u origin "$PR_BRANCH"
|
||||
|
||||
open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)"
|
||||
if [ "$open_prs" -eq 0 ]; then
|
||||
gh pr create \
|
||||
--base main \
|
||||
--head "$PR_BRANCH" \
|
||||
--title "chore: update lockfiles" \
|
||||
--fill
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Enable auto-merge
|
||||
shell: bash
|
||||
run: gh pr merge --auto --squash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.MERGE_TOKEN }}
|
||||
|
|
171
flake.lock
generated
171
flake.lock
generated
|
@ -1,64 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709336216,
|
||||
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"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": 1711715736,
|
||||
|
@ -75,119 +16,9 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [],
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711850184,
|
||||
"narHash": "sha256-rs5zMkTO+AlVBzgOaskAtY4zix7q3l8PpawfznHotcQ=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "9fc61b5eb0e50fc42f1d358f5240722907b79726",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"procfile-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711158989,
|
||||
"narHash": "sha256-exgncIe/lQIswv2L1M0y+RrHAg5dofLFCOxGu4/yJww=",
|
||||
"owner": "getchoo",
|
||||
"repo": "procfile-nix",
|
||||
"rev": "6388308f9e9c8a8fbfdff54b30adf486fa292cf9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "getchoo",
|
||||
"repo": "procfile-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"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": 1711851236,
|
||||
"narHash": "sha256-EJ03x3N9ihhonAttkaCrqxb0djDq3URCuDpmVPbNZhA=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "f258266af947599e8069df1c2e933189270f143a",
|
||||
"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": 1711803027,
|
||||
"narHash": "sha256-Qic3OvsVLpetchzaIe2hJqgliWXACq2Oee6mBXa/IZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1810d51a015c1730f2fe05a255258649799df416",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
65
flake.nix
65
flake.nix
|
@ -1,58 +1,31 @@
|
|||
{
|
||||
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";
|
||||
};
|
||||
|
||||
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;} {
|
||||
imports = [
|
||||
./nix/dev.nix
|
||||
./nix/packages.nix
|
||||
./nix/deployment
|
||||
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
inputs.procfile-nix.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
|
||||
in {
|
||||
nixosModules.default = import ./nix/module.nix self;
|
||||
|
||||
packages = forAllSystems (pkgs: rec {
|
||||
refraction = pkgs.callPackage ./nix/derivation.nix {inherit self;};
|
||||
default = refraction;
|
||||
});
|
||||
|
||||
overlays.default = _: prev: {
|
||||
refraction = prev.callPackage ./nix/derivation.nix {inherit self;};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
69
nix/dev.nix
69
nix/dev.nix
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
self',
|
||||
...
|
||||
}: {
|
||||
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 = [self'.packages.refraction];
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||
};
|
||||
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
prettier.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
|
||||
settings.global = {
|
||||
excludes = [
|
||||
"./target"
|
||||
"./flake.lock"
|
||||
"./Cargo.lock"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
pre-commit.settings.hooks = {
|
||||
actionlint.enable = true;
|
||||
nil.enable = true;
|
||||
statix.enable = true;
|
||||
treefmt = {
|
||||
enable = true;
|
||||
package = config.treefmt.build.wrapper;
|
||||
};
|
||||
};
|
||||
|
||||
procfiles.daemons.processes = {
|
||||
redis = lib.getExe' pkgs.redis "redis-server";
|
||||
};
|
||||
};
|
||||
}
|
11
nix/dev/args.nix
Normal file
11
nix/dev/args.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{inputs, ...}: {
|
||||
perSystem = {
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
_module.args = {
|
||||
refraction' = lib.mapAttrs (lib.const (v: v.${system} or v)) (inputs.get-flake ../../.);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,14 +1,4 @@
|
|||
{
|
||||
flake-parts-lib,
|
||||
withSystem,
|
||||
...
|
||||
}: {
|
||||
imports = [./static.nix];
|
||||
|
||||
flake.nixosModules.default = flake-parts-lib.importApply ./module.nix {
|
||||
inherit withSystem;
|
||||
};
|
||||
|
||||
{withSystem, ...}: {
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
212
nix/dev/flake.lock
generated
Normal file
212
nix/dev/flake.lock
generated
Normal file
|
@ -0,0 +1,212 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709336216,
|
||||
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
|
||||
"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",
|
||||
"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": 1711715736,
|
||||
"narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "807c549feabce7eddbf259dbdcec9e0600a0660d",
|
||||
"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": 1711850184,
|
||||
"narHash": "sha256-rs5zMkTO+AlVBzgOaskAtY4zix7q3l8PpawfznHotcQ=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "9fc61b5eb0e50fc42f1d358f5240722907b79726",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"procfile-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711158989,
|
||||
"narHash": "sha256-exgncIe/lQIswv2L1M0y+RrHAg5dofLFCOxGu4/yJww=",
|
||||
"owner": "getchoo",
|
||||
"repo": "procfile-nix",
|
||||
"rev": "6388308f9e9c8a8fbfdff54b30adf486fa292cf9",
|
||||
"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": 1711851236,
|
||||
"narHash": "sha256-EJ03x3N9ihhonAttkaCrqxb0djDq3URCuDpmVPbNZhA=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "f258266af947599e8069df1c2e933189270f143a",
|
||||
"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": 1711803027,
|
||||
"narHash": "sha256-Qic3OvsVLpetchzaIe2hJqgliWXACq2Oee6mBXa/IZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1810d51a015c1730f2fe05a255258649799df416",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
65
nix/dev/flake.nix
Normal file
65
nix/dev/flake.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
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";
|
||||
|
||||
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"
|
||||
];
|
||||
};
|
||||
}
|
20
nix/dev/pre-commit.nix
Normal file
20
nix/dev/pre-commit.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
11
nix/dev/procfiles.nix
Normal file
11
nix/dev/procfiles.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
procfiles.daemons.processes = {
|
||||
redis = lib.getExe' pkgs.redis "redis-server";
|
||||
};
|
||||
};
|
||||
}
|
36
nix/dev/shell.nix
Normal file
36
nix/dev/shell.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
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}";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
pkgs,
|
||||
inputs',
|
||||
self',
|
||||
refraction',
|
||||
...
|
||||
}: let
|
||||
targets = with pkgs.pkgsCross; {
|
||||
|
@ -26,7 +26,7 @@
|
|||
targets;
|
||||
|
||||
buildWith = rustPlatform:
|
||||
self'.packages.refraction.override {
|
||||
refraction'.packages.refraction.override {
|
||||
inherit rustPlatform;
|
||||
optimizeSize = true;
|
||||
};
|
22
nix/dev/treefmt.nix
Normal file
22
nix/dev/treefmt.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
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"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{withSystem, ...}: {
|
||||
self: {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
|
@ -22,9 +22,7 @@
|
|||
in {
|
||||
options.services.refraction = {
|
||||
enable = mkEnableOption "refraction";
|
||||
package = mkPackageOption (
|
||||
withSystem pkgs.stdenv.hostPlatform.system ({self', ...}: self'.packages)
|
||||
) "refraction" {};
|
||||
package = mkPackageOption self.packages.${pkgs.stdenv.hostPlatform.system} "refraction" {};
|
||||
|
||||
user = mkOption {
|
||||
description = mdDoc ''
|
|
@ -1,16 +0,0 @@
|
|||
{self, ...}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}: {
|
||||
packages = {
|
||||
refraction = pkgs.callPackage ./derivation.nix {inherit self;};
|
||||
default = self'.packages.refraction;
|
||||
};
|
||||
};
|
||||
|
||||
flake.overlays.default = _: prev: {
|
||||
refraction = prev.callPackage ./derivation.nix {inherit self;};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue