setup flake
This commit is contained in:
parent
038f5e38ec
commit
04d7466e0c
2 changed files with 64 additions and 69 deletions
69
flake.lock
69
flake.lock
|
@ -1,27 +1,15 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1678901627,
|
||||
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
|
||||
"type": "github"
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -32,32 +20,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1680125544,
|
||||
"narHash": "sha256-mlqo1r+TZUOuypWdrZHluxWL+E5WzXlUXNZ9Y0WLDFU=",
|
||||
"lastModified": 1688939073,
|
||||
"narHash": "sha256-jYhYjeK5s6k8QS3i+ovq9VZqBJaWbxm7awTKNhHL9d0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9a6aabc4740790ef3bbb246b86d029ccf6759658",
|
||||
"rev": "8df7a67abaf8aefc8a2839e0b48f92fdcf69a38b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -65,26 +37,21 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1680229280,
|
||||
"narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "aa480d799023141e1b9e5d6108700de63d9ad002",
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
|
|
48
flake.nix
48
flake.nix
|
@ -1,28 +1,56 @@
|
|||
{
|
||||
description = "Wiki Source";
|
||||
description = "wiki.adtya.xyz";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
with pkgs; {
|
||||
formatter = pkgs.alejandra;
|
||||
devShells.default = mkShell {
|
||||
buildInputs = [
|
||||
(rust-bin.stable.latest.default.override {extensions = [ "rust-src" "rust-analyzer" ];})
|
||||
mdbook
|
||||
];
|
||||
};
|
||||
packages.dockerImage = let
|
||||
book = callPackage ./default.nix {};
|
||||
in
|
||||
dockerTools.buildImage {
|
||||
name = "wiki.adtya.xyz";
|
||||
tag = "latest";
|
||||
fromImage = dockerTools.pullImage {
|
||||
imageName = "nginx";
|
||||
imageDigest =
|
||||
if stdenv.isAarch64
|
||||
then "sha256:9956d05e8f945ae928901c985936953e93eeb20f1b612b9851f8a5b02ba07b19"
|
||||
else "sha256:da86ecb516d88a5b0579cec8687a75f974712cb5091560c06ef6c393ea4936ee";
|
||||
sha256 =
|
||||
if stdenv.isAarch64
|
||||
then "1mpy68r0vqkyb8ls2p8msarhsljjkv3pwvl23wbhipygjv1gmqa4"
|
||||
else "003cpzhjn5myy7myw79gzy9x1mzb2h9b4q1jwwzlhhjv08db9bal";
|
||||
finalImageName = "nginx";
|
||||
finalImageTag = "alpine-slim";
|
||||
};
|
||||
copyToRoot = book;
|
||||
config = {
|
||||
Cmd = ["nginx" "-g" "daemon off;"];
|
||||
ExposedPort = {
|
||||
"80/tcp" = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue