From 18403b428e600ae15e31baf105d9d2bd8e311b49 Mon Sep 17 00:00:00 2001 From: Jenmin Suen Date: Tue, 14 Oct 2025 16:24:16 +0800 Subject: [PATCH] Init --- flake.lock | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 72 ++++++++++++++++ 2 files changed, 310 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e675a7e --- /dev/null +++ b/flake.lock @@ -0,0 +1,238 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1754433428, + "narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=", + "rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d", + "type": "tarball", + "url": "https://git.zmsun.cn/api/v1/repos/mirror/3.agenix/archive/9edb1787864c4f59ae5074ad498b6272b3ec308d.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.zmsun.cn/mirror/3.agenix/archive/main.tar.gz" + } + }, + "darwin": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1758805352, + "narHash": "sha256-BHdc43Lkayd+72W/NXRKHzX5AZ+28F3xaUs3a88/Uew=", + "rev": "c48e963a5558eb1c3827d59d21c5193622a1477c", + "type": "tarball", + "url": "https://git.zmsun.cn/api/v1/repos/mirror/3.1.nix-darwin/archive/c48e963a5558eb1c3827d59d21c5193622a1477c.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.zmsun.cn/mirror/3.1.nix-darwin/archive/master.tar.gz" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1759362264, + "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1759711004, + "narHash": "sha256-B39NxeKCnK3DJlmJKIts6njcXcVVASLUChDNmRl4dxQ=", + "rev": "6f4021da5d2bb5ea7cb782ff413ecb7062066820", + "type": "tarball", + "url": "https://git.zmsun.cn/api/v1/repos/mirror/2.home-manager/archive/6f4021da5d2bb5ea7cb782ff413ecb7062066820.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.zmsun.cn/mirror/2.home-manager/archive/master.tar.gz" + } + }, + "ndg": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1760336097, + "narHash": "sha256-BedBcz5+dDHhNWMY4JndabYUMSOMusKzFGLV1PxvwBQ=", + "owner": "feel-co", + "repo": "ndg", + "rev": "0c898318cdb7b8288a58f6393b1d8ba0dd6b0a09", + "type": "github" + }, + "original": { + "owner": "feel-co", + "repo": "ndg", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747728033, + "narHash": "sha256-NnXFQu7g4LnvPIPfJmBuZF7LFy/fey2g2+LCzjQhTUk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9173bde1d3fbf1ad26ff6d52f952f9e9da52ea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1760375057, + "narHash": "sha256-YW++h8MBX+fDBm9uaZaFi6HoUDNdqUpvOeq1AfF1490=", + "type": "tarball", + "url": "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz" + }, + "original": { + "type": "tarball", + "url": "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1759733170, + "narHash": "sha256-TXnlsVb5Z8HXZ6mZoeOAIwxmvGHp1g4Dw89eLvIwKVI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8913c168d1c56dc49a7718685968f38752171c3b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs_2", + "sops-nix": "sops-nix", + "unf": "unf" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760393368, + "narHash": "sha256-8mN3kqyqa2PKY0wwZ2UmMEYMcxvNTwLaOrrDsw6Qi4E=", + "ref": "refs/heads/master", + "rev": "ab8d56e85b8be14cff9d93735951e30c3e86a437", + "revCount": 1052, + "type": "git", + "url": "https://git.zmsun.cn/pkg/sops-nix" + }, + "original": { + "type": "git", + "url": "https://git.zmsun.cn/pkg/sops-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "tarball", + "url": "https://git.zmsun.cn/api/v1/repos/mirror/3.2.nix-systems/archive/da67096a3b9bf56a91d16901293e51ba5b49a27e.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://git.zmsun.cn/mirror/3.2.nix-systems/archive/main.tar.gz" + } + }, + "unf": { + "inputs": { + "ndg": "ndg", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760178630, + "narHash": "sha256-oxRMTQtzIO1yFRhY++Ss8+ea1cTH40bD/+FAE+m5NFk=", + "ref": "refs/heads/main", + "rev": "8a6aa536039f1b207888b1369c5cabf0b131e07b", + "revCount": 5, + "type": "git", + "url": "https://git.zmsun.cn/pkg/unf" + }, + "original": { + "type": "git", + "url": "https://git.zmsun.cn/pkg/unf" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..41affd3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +# flake.nix +{ + inputs = { + nixpkgs.url = "https://mirrors.cernet.edu.cn/nix-channels/nixos-unstable/nixexprs.tar.xz"; + home-manager = { + url = "https://git.zmsun.cn/mirror/2.home-manager/archive/master.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + unf = { + url = "git+https://git.zmsun.cn/pkg/unf"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + agenix = { + url = "https://git.zmsun.cn/mirror/3.agenix/archive/main.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + inputs.darwin.url = "https://git.zmsun.cn/mirror/3.1.nix-darwin/archive/master.tar.gz"; + inputs.systems.url = "https://git.zmsun.cn/mirror/3.2.nix-systems/archive/main.tar.gz"; + }; + + sops-nix = { + url = "git+https://git.zmsun.cn/pkg/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... } @ inputs: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + lib = nixpkgs.lib; + modules = { + agenix = inputs.agenix.nixosModules.default; + sops-nix = inputs.sops-nix.nixosModules.default; + }; + jsonDerivations = with builtins; mapAttrs (n: v: inputs.unf.lib.json { + inherit self pkgs; + modules = [ v ]; + }) modules; + in + { + packages.${system} = rec { + default = json; + json = pkgs.runCommand "doc-extra-options" { + nativeBuildInputs = [ pkgs.coreutils ]; + } (let + aim = "$out/share/doc/doc-extra-options"; + cpCommands = lib.concatMapStringsSep "" (name: + "cp ${jsonDerivations.${name}} ${aim}/${name}.json\n" + ) (builtins.attrNames jsonDerivations); + in '' + mkdir -p ${aim} + ${cpCommands} + ''); + json-allinone = inputs.unf.lib.json { + inherit self pkgs; + projectName = "Extra Docs"; + modules = builtins.attrValues modules; + }; + html = inputs.unf.lib.html { + inherit self pkgs; + projectName = "Extra options"; + newPath = "https://doc.zmsun.cn/extra"; + specialArgs = { goodDx = true; }; + modules = builtins.attrValues modules; + userOpts = { warningsAreErrors = false; }; + }; + }; + }; +}