feat(packages)!: add support for dream2nix

Also convert `sdcv` to use `dream2nix`
This commit is contained in:
reo101 2024-08-02 10:30:48 +03:00
parent 4f891220c1
commit 4e3733178e
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
4 changed files with 206 additions and 84 deletions

View file

@ -14,11 +14,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1720546205,
"narHash": "sha256-boCXsjYVxDviyzoEyAk624600f3ZBo/DKtUdvMTpbGY=",
"lastModified": 1722339003,
"narHash": "sha256-ZeS51uJI30ehNkcZ4uKqT4ZDARPyqrHADSKAwv5vVCU=",
"owner": "ryantm",
"repo": "agenix",
"rev": "de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6",
"rev": "3f1dae074a12feb7327b4bf43cbac0d124488bb7",
"type": "github"
},
"original": {
@ -37,11 +37,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1721402988,
"narHash": "sha256-O5j5y5gpssVF5FNsSF7joTyrlW//LpwyLk6yBWgQ0VE=",
"lastModified": 1722299223,
"narHash": "sha256-+5HNJBXb9YXKSmi2TJsnftrgU/msF/4jBAMH9J1bc5c=",
"owner": "oddlama",
"repo": "agenix-rekey",
"rev": "3f1c787e2092d9c13142ae7572cc1c52b68f1c4c",
"rev": "4107b53b152f4ddc504269ec17c4b7005869d762",
"type": "github"
},
"original": {
@ -175,11 +175,11 @@
]
},
"locked": {
"lastModified": 1722217815,
"narHash": "sha256-8r5AJ3n8WEDw3rsZLALSuFQ5kJyWOcssNZvPxYLr2yc=",
"lastModified": 1722476845,
"narHash": "sha256-7gZ8uf3qOox8Vrwd+p9EhUHHLhhK8lis/5KcXGmIaow=",
"owner": "nix-community",
"repo": "disko",
"rev": "1e6f8a7b4634fc051cc9361959bf414fcf17e094",
"rev": "7e1b215a0a96efb306ad6440bf706d2b307dc267",
"type": "github"
},
"original": {
@ -188,6 +188,28 @@
"type": "github"
}
},
"dream2nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"purescript-overlay": "purescript-overlay",
"pyproject-nix": "pyproject-nix"
},
"locked": {
"lastModified": 1722526955,
"narHash": "sha256-fFS8aDnfK9Qfm2FLnQ8pqWk8FzvFEv5LvTuZTZLREnc=",
"owner": "nix-community",
"repo": "dream2nix",
"rev": "3fd4c14d3683baac8d1f94286ae14fe160888b51",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "dream2nix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -656,11 +678,11 @@
},
"hardware": {
"locked": {
"lastModified": 1722114937,
"narHash": "sha256-MOZ9woPwdpFJcHx3wic2Mlw9aztdKjMnFT3FaeLzJkM=",
"lastModified": 1722332872,
"narHash": "sha256-2xLM4sc5QBfi0U/AANJAW21Bj4ZX479MHPMPkB+eKBU=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "e67b60fb1b2c3aad2202d95b91d4c218cf2a4fdd",
"rev": "14c333162ba53c02853add87a0000cbd7aa230c2",
"type": "github"
},
"original": {
@ -698,11 +720,11 @@
]
},
"locked": {
"lastModified": 1722203588,
"narHash": "sha256-91V5FMSQ4z9bkhTCf0f86Zjw0bh367daSf0mzCIW0vU=",
"lastModified": 1722462338,
"narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "792757f643cedc13f02098d8ed506d82e19ec1da",
"rev": "6e090576c4824b16e8759ebca3958c5b09659ee8",
"type": "github"
},
"original": {
@ -734,11 +756,11 @@
]
},
"locked": {
"lastModified": 1721993749,
"narHash": "sha256-dGqEQ68GNGmA8+HHzHEqAcW2uGu/AX+sRWcMO99UM8s=",
"lastModified": 1722491724,
"narHash": "sha256-pvZ0sqDNhcUzYXrCF9UYZBf+qd3ri/0fT0b4mFqVuBs=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "3bd059992912139d6a12e86ba418f933ec368ef2",
"rev": "ff83ee27a56651dcd6d4c9b3e3b7c08267dc52ae",
"type": "github"
},
"original": {
@ -805,11 +827,11 @@
]
},
"locked": {
"lastModified": 1722232823,
"narHash": "sha256-TyBoea7IzssGHS/hn2qjqgHfrpRGdBwBj5JrzTk+LmE=",
"lastModified": 1722471252,
"narHash": "sha256-rgNPBiWN+y2jBiXIEgV/McBfkPeZax80eol0FBoupCk=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "a53756a2ea77e55b662c68c9a6cf6472a10ae911",
"rev": "fe7178b41d84add25c63a695620629050fb35bbd",
"type": "github"
},
"original": {
@ -821,11 +843,11 @@
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1722175991,
"narHash": "sha256-IlmC/5lLdIq+sLdTAPkSsVpnrMr6wOS79kXSXcowQII=",
"lastModified": 1722463651,
"narHash": "sha256-3YorBqxT1RpL3Z2rLDCJhG+1HnBsgjrW8AOlTkFWlbA=",
"owner": "neovim",
"repo": "neovim",
"rev": "5aa1a9532cbac835ad027ebdf04311c7e8fb7007",
"rev": "e820474cde09273608be5f57e1032aab21e3c97d",
"type": "github"
},
"original": {
@ -860,11 +882,11 @@
]
},
"locked": {
"lastModified": 1722082646,
"narHash": "sha256-od8dBWVP/ngg0cuoyEl/w9D+TCNDj6Kh4tr151Aax7w=",
"lastModified": 1722500642,
"narHash": "sha256-Vls0TQRdplex1JslnBxEk3M26Q1vR+OSg+sk5rBG4DA=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "0413754b3cdb879ba14f6e96915e5fdf06c6aab6",
"rev": "b47af8628624856ad6853168298f1f96364d92d6",
"type": "github"
},
"original": {
@ -979,11 +1001,11 @@
"pre-commit-hooks": "pre-commit-hooks_2"
},
"locked": {
"lastModified": 1721160643,
"narHash": "sha256-ZkjJnwgDUkjzgySZv9GjKnDsDmNJVkU2u2pLD4a1QKA=",
"lastModified": 1722338736,
"narHash": "sha256-bSnWgJ7eXgHZ/pwL7+NTDGfOzsbOiw899BV3k7TawWE=",
"owner": "oddlama",
"repo": "nix-topology",
"rev": "fe9ace7f40a63e3eb9b39a20a1032834e090d806",
"rev": "870dcc9074077a327220b36597098c295944a47d",
"type": "github"
},
"original": {
@ -1101,11 +1123,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1722062969,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
"lastModified": 1722185531,
"narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
"rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
"type": "github"
},
"original": {
@ -1203,11 +1225,11 @@
},
"nur": {
"locked": {
"lastModified": 1722236015,
"narHash": "sha256-JXv70YOqAN+TaB0b/H8efrGk9dCLZgx+LE/YhH4AljY=",
"lastModified": 1722506945,
"narHash": "sha256-stBe+eCSthbVgRbnw7omowcRHLxua391at3e9yPKVpQ=",
"owner": "nix-community",
"repo": "NUR",
"rev": "83890edff37e69bdf57d29faff9e5c9e275d52cd",
"rev": "883ce50da0a347787fecb88969c6d92452f058e5",
"type": "github"
},
"original": {
@ -1272,6 +1294,45 @@
"type": "github"
}
},
"purescript-overlay": {
"inputs": {
"nixpkgs": [
"dream2nix",
"nixpkgs"
],
"slimlock": "slimlock"
},
"locked": {
"lastModified": 1696022621,
"narHash": "sha256-eMjFmsj2G1E0Q5XiibUNgFjTiSz0GxIeSSzzVdoN730=",
"owner": "thomashoneyman",
"repo": "purescript-overlay",
"rev": "047c7933abd6da8aa239904422e22d190ce55ead",
"type": "github"
},
"original": {
"owner": "thomashoneyman",
"repo": "purescript-overlay",
"type": "github"
}
},
"pyproject-nix": {
"flake": false,
"locked": {
"lastModified": 1702448246,
"narHash": "sha256-hFg5s/hoJFv7tDpiGvEvXP0UfFvFEDgTdyHIjDVHu1I=",
"owner": "davhau",
"repo": "pyproject.nix",
"rev": "5a06a2697b228c04dd2f35659b4b659ca74f7aeb",
"type": "github"
},
"original": {
"owner": "davhau",
"ref": "dream2nix",
"repo": "pyproject.nix",
"type": "github"
}
},
"ragenix": {
"inputs": {
"agenix": [
@ -1302,6 +1363,7 @@
"agenix-rekey": "agenix-rekey",
"deploy-rs": "deploy-rs",
"disko": "disko",
"dream2nix": "dream2nix",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts",
"hardware": "hardware",
@ -1384,6 +1446,28 @@
"type": "github"
}
},
"slimlock": {
"inputs": {
"nixpkgs": [
"dream2nix",
"purescript-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688610262,
"narHash": "sha256-Wg0ViDotFWGWqKIQzyYCgayeH8s4U1OZcTiWTQYdAp4=",
"owner": "thomashoneyman",
"repo": "slimlock",
"rev": "b5c6cdcaf636ebbebd0a1f32520929394493f1a6",
"type": "github"
},
"original": {
"owner": "thomashoneyman",
"repo": "slimlock",
"type": "github"
}
},
"spicetify-nix": {
"inputs": {
"flake-utils": "flake-utils_6",
@ -1617,11 +1701,11 @@
]
},
"locked": {
"lastModified": 1722212818,
"narHash": "sha256-zNMilDci+GPIITqbFhc5k4lIhaXLmXUUActfFTHn3PY=",
"lastModified": 1722472132,
"narHash": "sha256-0HtrawSR0P4HEyBGbgdwltA70pa/FU6/oV3dtUdS4YI=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "a68969f1121dbf9964c6e326003ed3ed044c6825",
"rev": "e607f7d7b0c7d559fa000ec2300eb58b6dc33b4e",
"type": "github"
},
"original": {

View file

@ -72,6 +72,11 @@
inputs.nixpkgs-lib.follows = "nixpkgs";
};
dream2nix = {
url = "github:nix-community/dream2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Nix on Droid
nix-on-droid = {
url = "github:t184256/nix-on-droid";

View file

@ -118,9 +118,33 @@ in
pkgs.callPackage systems {
inherit (pkgs) lib hostPlatform targetPlatform;
}))
(lib.mapAttrs
(name: { package, systems }:
pkgs.callPackage package { }))
(lib.mapAttrs
(name: { package, systems }:
let
isDream2Nix = lib.pipe package
[
builtins.functionArgs
builtins.attrNames
(builtins.elem "dream2nix")
];
in
if isDream2Nix
then inputs.dream2nix.lib.evalModules {
packageSets.nixpkgs = pkgs;
modules = [
package
{
paths.projectRoot = "${self.outPath}";
paths.projectRootFile = "flake.nix";
paths.package = "${self.outPath}";
}
];
specialArgs = {
# NOTE: for overlayed `maintainers`
inherit (pkgs) lib;
};
}
else pkgs.callPackage package { }))
];
in {
inherit packages;

View file

@ -1,52 +1,61 @@
{ lib
, stdenv
, darwin
# Fetchers
, fetchFromGitHub
# Build inputs
, cmake
, pkg-config
, iconv
, pcre
, readline
, glib
, zlib
{ config
, lib
, dream2nix
, ...
}:
}: {
imports = [
dream2nix.modules.dream2nix.mkDerivation
];
stdenv.mkDerivation rec {
pname = "sdcv";
deps = { nixpkgs, ... }: {
inherit (nixpkgs)
# Fetchers
fetchFromGitHub
# Build inputs
cmake
pkg-config
iconv
pcre
readline
glib
zlib
;
};
name = "sdcv";
version = "0.5.5";
src = fetchFromGitHub {
owner = "Dushistov";
repo = pname;
rev = "v${version}";
hash = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
};
mkDerivation = {
src = config.deps.fetchFromGitHub {
owner = "Dushistov";
repo = config.name;
rev = "v${config.version}";
hash = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
};
nativeBuildInputs = [
pkg-config
cmake
iconv
];
nativeBuildInputs = with config.deps; [
pkg-config
cmake
iconv
];
buildInputs = [
pcre
readline
glib
zlib
];
buildInputs = with config.deps; [
pcre
readline
glib
zlib
];
cmakeFlags = [
# BUG: <https://github.com/Dushistov/sdcv/blob/49c8094b53b7dd90efeabeaf276752a650a0f931/CMakeLists.txt#L58> does not exit
"-DENABLE_NLS=OFF"
];
cmakeFlags = [
# FIXME: <https://github.com/Dushistov/sdcv/blob/49c8094b53b7dd90efeabeaf276752a650a0f931/CMakeLists.txt#L58> does not exit
"-DENABLE_NLS=OFF"
];
meta = with lib; {
description = "Console version of StarDict";
homepage = "https://github.com/Dushistov/sdcv";
license = licenses.gpl2;
# maintainers = with maintainers; [ reo101 ];
meta = with lib; {
description = "Console version of StarDict";
homepage = "https://github.com/Dushistov/sdcv";
license = licenses.gpl2;
maintainers = with maintainers; [ reo101 ];
};
};
}