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

View file

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

View file

@ -118,9 +118,33 @@ in
pkgs.callPackage systems { pkgs.callPackage systems {
inherit (pkgs) lib hostPlatform targetPlatform; inherit (pkgs) lib hostPlatform targetPlatform;
})) }))
(lib.mapAttrs (lib.mapAttrs
(name: { package, systems }: (name: { package, systems }:
pkgs.callPackage package { })) 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 { in {
inherit packages; inherit packages;

View file

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