From 932cfac79d6da2a168dff9ee84c66bbc2d037ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Mon, 16 Jan 2023 10:02:58 +0100 Subject: [PATCH] Add attic --- .github/workflows/build.yml | 3 + default.nix | 11 +++- flake.lock | 116 ++++++++++++++++++++++++++++++++++++ flake.nix | 9 +++ lib/default.nix | 1 + lib/importFlake.nix | 18 ++++++ 6 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 lib/importFlake.nix diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 805ca15..65ffbe4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,9 @@ jobs: - python-instagram - moa - nix-s3-dedup + - attic + - attic-client + - attic-server runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/default.nix b/default.nix index 7349422..3e59059 100644 --- a/default.nix +++ b/default.nix @@ -5,9 +5,15 @@ # Having pkgs default to is fine though, and it lets you use short # commands such as: # nix-build -A mypackage -{pkgs ? import {}}: { - # The `lib`, `modules`, and `overlay` names are special +{pkgs ? import {}}: let lib = import ./lib {inherit pkgs;}; # functions + attic = lib.importFlake { + input = "attic"; + inherit (pkgs) system; + }; +in { + # The `lib`, `modules`, and `overlay` names are special + inherit lib; modules = import ./modules; # NixOS modules overlays = import ./overlays; # nixpkgs overlays @@ -58,4 +64,5 @@ python-instagram = pkgs.python3Packages.callPackage ./python/instagram.nix {}; moa = pkgs.python3Packages.callPackage ./moa {}; nix-s3-dedup = pkgs.callPackage ./nix {}; + inherit (attic.defaultNix.packages.${pkgs.system}) attic attic-client attic-server; } diff --git a/flake.lock b/flake.lock index ad92b9a..22749ea 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,92 @@ { "nodes": { + "attic": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673819363, + "narHash": "sha256-JQsPxaGHLCLtlxPzpf+b8XfA8vUwmIb9aJRsJQCht4Q=", + "owner": "zhaofengli", + "repo": "attic", + "rev": "70ae61b59114982a2685f67b35405f7ca0bf5b6f", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "attic", + "type": "github" + } + }, + "crane": { + "inputs": { + "flake-compat": [ + "attic", + "flake-compat" + ], + "flake-utils": [ + "attic", + "flake-utils" + ], + "nixpkgs": [ + "attic", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1672095661, + "narHash": "sha256-7NTsdCn3qsvU7A+1/7tY8pxbq0DYy1pFYNpzN6he9lI=", + "owner": "ipetkov", + "repo": "crane", + "rev": "98894bb39b03bfb379c5e10523cd61160e1ac782", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -32,9 +119,38 @@ }, "root": { "inputs": { + "attic": "attic", + "flake-compat": "flake-compat_2", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "attic", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "attic", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1670034122, + "narHash": "sha256-EqmuOKucPWtMvCZtHraHr3Q3bgVszq1x2PoZtQkUuEk=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "a0d5773275ecd4f141d792d3a0376277c0fc0b65", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1e72bf0..5ef5143 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,15 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; + attic = { + url = "github:zhaofengli/attic"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; }; outputs = { diff --git a/lib/default.nix b/lib/default.nix index c78bae0..5e0ad27 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -3,4 +3,5 @@ gradleDeps = pkgs.callPackage ./gradleDeps.nix {}; opensslLegacyProvider = pkgs.callPackage ./opensslLegacyProvider.nix {}; crushpng = pkgs.callPackage ./crushpng.nix {}; + importFlake = import ./importFlake.nix; } diff --git a/lib/importFlake.nix b/lib/importFlake.nix new file mode 100644 index 0000000..36b422b --- /dev/null +++ b/lib/importFlake.nix @@ -0,0 +1,18 @@ +{ + input, + system, +}: let + lock = builtins.fromJSON (builtins.readFile ../flake.lock); + flake-compat = fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + }; + input-src = fetchTarball { + url = "https://github.com/${lock.nodes.${input}.locked.owner}/${lock.nodes.${input}.locked.repo}/archive/${lock.nodes.${input}.locked.rev}.tar.gz"; + sha256 = lock.nodes.${input}.locked.narHash; + }; +in + (import flake-compat) { + src = input-src; + inherit system; + }