Compare commits
No commits in common. "72d18c49feed6e974f6c44855b0072c1b1194bf0" and "567358418b3b876c4e966326501f1434b14e5989" have entirely different histories.
72d18c49fe
...
567358418b
6 changed files with 22 additions and 260 deletions
83
inputs.nix
83
inputs.nix
|
@ -1,84 +1,29 @@
|
||||||
let self = {
|
let self = {
|
||||||
lock ? import lockFile,
|
lock ? import ./lock.nix
|
||||||
lockFile ? ./lock.nix,
|
, lib ? import "${(self {}).nixpkgs}/lib"
|
||||||
pkgs ? throw "inputs called without pkgs",
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
inherit lock;
|
inherit lock;
|
||||||
nixos-vscode-server = rec {
|
nixos-vscode-server = builtins.fetchTarball {
|
||||||
|
name = "nixos-vscode-server";
|
||||||
url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz";
|
url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz";
|
||||||
updateScript = pkgs.den-http-get-updater {
|
sha256 = "${lock.nixos-vscode-server.sha256}";
|
||||||
fileLocation = lockFile;
|
|
||||||
previousHash = lock.nixos-vscode-server.sha256;
|
|
||||||
previousVersion = lock.nixos-vscode-server.revision;
|
|
||||||
versionUrl = "https://api.github.com/repos/nix-community/nixos-vscode-server/commits";
|
|
||||||
contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\"";
|
|
||||||
prefetchUrlLocation = {
|
|
||||||
file = ./inputs.nix;
|
|
||||||
attrpath = "nixos-vscode-server.url";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
outPath = builtins.fetchTarball {
|
|
||||||
inherit url;
|
|
||||||
name = "nixos-vscode-server";
|
|
||||||
sha256 = "${lock.nixos-vscode-server.sha256}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
nixpkgs = rec {
|
nixpkgs = builtins.fetchTarball {
|
||||||
|
name = "nixpkgs";
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz";
|
||||||
updateScript = pkgs.den-http-get-updater {
|
sha256 = "${lock.nixpkgs.sha256}";
|
||||||
fileLocation = lockFile;
|
|
||||||
previousHash = lock.nixpkgs.sha256;
|
|
||||||
previousVersion = lock.nixpkgs.revision;
|
|
||||||
versionUrl = "https://channels.nixos.org/nixos-24.11/git-revision";
|
|
||||||
prefetchUrlLocation = {
|
|
||||||
file = ./inputs.nix;
|
|
||||||
attrpath = "nixpkgs.url";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
outPath = builtins.fetchTarball {
|
|
||||||
inherit url;
|
|
||||||
name = "nixpkgs";
|
|
||||||
sha256 = "${lock.nixpkgs.sha256}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
nixpkgs-unstable = rec {
|
nixpkgs-unstable = builtins.fetchTarball {
|
||||||
|
name = "nixpkgs-unstable";
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz";
|
||||||
updateScript = pkgs.den-http-get-updater {
|
sha256 = "${lock.nixpkgs-unstable.sha256}";
|
||||||
fileLocation = lockFile;
|
|
||||||
previousHash = lock.nixpkgs-unstable.sha256;
|
|
||||||
previousVersion = lock.nixpkgs-unstable.revision;
|
|
||||||
versionUrl = "https://channels.nixos.org/nixos-unstable/git-revision";
|
|
||||||
prefetchUrlLocation = {
|
|
||||||
file = ./inputs.nix;
|
|
||||||
attrpath = "nixpkgs-unstable.url";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
outPath = builtins.fetchTarball {
|
|
||||||
inherit url;
|
|
||||||
name = "nixpkgs-unstable";
|
|
||||||
sha256 = "${lock.nixpkgs-unstable.sha256}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
cosmic-modules = rec {
|
cosmic-modules = builtins.fetchTarball {
|
||||||
|
name = "cosmic-modules";
|
||||||
url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz";
|
url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz";
|
||||||
updateScript = pkgs.den-http-get-updater {
|
sha256 = "${lock.cosmic-modules.sha256}";
|
||||||
fileLocation = lockFile;
|
|
||||||
previousHash = lock.cosmic-modules.sha256;
|
|
||||||
previousVersion = lock.cosmic-modules.revision;
|
|
||||||
versionUrl = "https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits";
|
|
||||||
contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\"";
|
|
||||||
prefetchUrlLocation = {
|
|
||||||
file = ./inputs.nix;
|
|
||||||
attrpath = "cosmic-modules.url";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
outPath = builtins.fetchTarball {
|
|
||||||
inherit url;
|
|
||||||
name = "cosmic-modules";
|
|
||||||
sha256 = "${lock.cosmic-modules.sha256}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in self
|
in self
|
||||||
|
|
12
lock.nix
12
lock.nix
|
@ -7,18 +7,18 @@
|
||||||
};
|
};
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
# https://channels.nixos.org/nixos-24.11/git-revision
|
# https://channels.nixos.org/nixos-24.11/git-revision
|
||||||
revision = "a1185f4064c18a5db37c5c84e5638c78b46e3341";
|
revision = "cdd2ef009676ac92b715ff26630164bb88fec4e0";
|
||||||
sha256 = "0ipjb56fdhfvhgnrw0rvp89g0mplpyhjil29fqdcpmv4ablbadqc";
|
sha256 = "0r5c1l5cagxykyjfh1wsn8wk9vhay5dpwp36318hizn4rcrp9dm6";
|
||||||
};
|
};
|
||||||
nixpkgs-unstable = {
|
nixpkgs-unstable = {
|
||||||
# https://channels.nixos.org/nixos-unstable/git-revision
|
# https://channels.nixos.org/nixos-unstable/git-revision
|
||||||
revision = "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5";
|
revision = "6607cf789e541e7873d40d3a8f7815ea92204f32";
|
||||||
sha256 = "1sfb9g6fmyfligcsd1rmkamfqvy8kgn3p0sy8ickf6swi1zdbf0b";
|
sha256 = "0lad6jan49sywk6xzgcivc4h3ln7grhjhb8q8jv2jwhwlgrfrxvh";
|
||||||
};
|
};
|
||||||
cosmic-modules = {
|
cosmic-modules = {
|
||||||
# https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits
|
# https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits
|
||||||
# jsonpath: [1].sha
|
# jsonpath: [1].sha
|
||||||
revision = "fcee247f21d21acb738ac208d6ed86e65c2e7240";
|
revision = "24785e84d4b3844936caffe2c56994bdef9a9300";
|
||||||
sha256 = "18xw0innlpswz35cf8n16myh5a24b4kpw0xckwm42c93zd5rm2zh";
|
sha256 = "18qqbhw5kk5j2i741faamipbga590ywxkax19ny2nz3w2zfq64k4";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
29
outputs.nix
29
outputs.nix
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
inputsPath ? ./inputs.nix,
|
inputs ? import ./inputs.nix {},
|
||||||
inputs ? import inputsPath {},
|
|
||||||
selfPath ? ./.
|
selfPath ? ./.
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ systems = [
|
||||||
forEachSystem = lib.genAttrs systems;
|
forEachSystem = lib.genAttrs systems;
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
inherit inputs inputsPath lib self;
|
inherit inputs lib self;
|
||||||
outPath = selfPath;
|
outPath = selfPath;
|
||||||
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
||||||
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
||||||
|
@ -72,30 +71,6 @@ self = {
|
||||||
builtins.attrValues
|
builtins.attrValues
|
||||||
builtins.listToAttrs
|
builtins.listToAttrs
|
||||||
];
|
];
|
||||||
# FIXME: currently impure
|
|
||||||
# NOTE: to run, you need to evaluate outputs.nix instead of default.nix
|
|
||||||
# nix-shell outputs.nix -A update
|
|
||||||
update = let
|
|
||||||
updateScript = (self.packagesForSystem (builtins.currentSystem)).den-update-script;
|
|
||||||
in updateScript {
|
|
||||||
path = "";
|
|
||||||
packages = lib.pipe ./update-list.nix [
|
|
||||||
import
|
|
||||||
(x: x self)
|
|
||||||
lib.attrsToList
|
|
||||||
(lib.imap1 (i: {name, value}: {
|
|
||||||
name = builtins.toString i;
|
|
||||||
value = value // {
|
|
||||||
# hack to pass isDerivation check in nixpkgs maintainers/scripts/update.nix
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/a1185f4064c18a5db37c5c84e5638c78b46e3341/maintainers/scripts/update.nix#L85
|
|
||||||
type = "derivation";
|
|
||||||
name = name;
|
|
||||||
};
|
|
||||||
}))
|
|
||||||
builtins.listToAttrs
|
|
||||||
lib.recurseIntoAttrs
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in self
|
in self
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
|
|
||||||
curl,
|
|
||||||
gawk,
|
|
||||||
jq,
|
|
||||||
nix,
|
|
||||||
writeScript,
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
# location of file to modify
|
|
||||||
fileLocation,
|
|
||||||
previousHash,
|
|
||||||
previousVersion,
|
|
||||||
versionUrl,
|
|
||||||
prefetchUrlLocation ? null,
|
|
||||||
# change newVersion variable in it, if the contents of the page
|
|
||||||
# is not plaintext version
|
|
||||||
# (json for example)
|
|
||||||
contentParser ? "echo \"$newVersion\"",
|
|
||||||
|
|
||||||
unpack ? true,
|
|
||||||
name ? if unpack then "source" else null,
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert builtins.isNull prefetchUrlLocation || lib.isAttrs prefetchUrlLocation;
|
|
||||||
assert lib.isAttrs prefetchUrlLocation && (
|
|
||||||
lib.isString prefetchUrlLocation.file or null ||
|
|
||||||
lib.isPath prefetchUrlLocation.file or null
|
|
||||||
);
|
|
||||||
assert lib.isAttrs prefetchUrlLocation && lib.isString prefetchUrlLocation.attrpath or null;
|
|
||||||
|
|
||||||
let
|
|
||||||
realFileLocation = builtins.toString fileLocation;
|
|
||||||
mark = builtins.hashString "sha256" previousHash;
|
|
||||||
|
|
||||||
mark' = lib.escapeShellArg mark;
|
|
||||||
prefetchUrlLocation' = lib.mapAttrs (_: lib.escapeShellArg) prefetchUrlLocation;
|
|
||||||
realFileLocation' = lib.escapeShellArg realFileLocation;
|
|
||||||
versionUrl' = lib.escapeShellArg versionUrl;
|
|
||||||
|
|
||||||
mark'' = lib.escapeShellArg (lib.escapeRegex mark);
|
|
||||||
previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion);
|
|
||||||
|
|
||||||
nixUnpack = lib.optionalString unpack "--unpack";
|
|
||||||
nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\"";
|
|
||||||
|
|
||||||
path = lib.makeBinPath [
|
|
||||||
curl
|
|
||||||
gawk
|
|
||||||
jq
|
|
||||||
nix
|
|
||||||
];
|
|
||||||
in
|
|
||||||
|
|
||||||
writeScript "den-http-get-updater" (''
|
|
||||||
PATH="${lib.escapeShellArg path}"
|
|
||||||
|
|
||||||
newVersion=$(curl -L "${versionUrl'}")
|
|
||||||
if [[ "$?" != 0 ]]; then
|
|
||||||
echo "error: fetching new version failed" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
newVersion=$(${contentParser})
|
|
||||||
awk -i inplace "{
|
|
||||||
sub(/${previousVersion''}/, \"$newVersion\")
|
|
||||||
# invalidate hash
|
|
||||||
sub(/${previousHash}/, \"${mark'}\")
|
|
||||||
}1" "${realFileLocation'}"
|
|
||||||
'' + lib.optionalString (!builtins.isNull prefetchUrlLocation) ''
|
|
||||||
nixUrlsResult=$(nix-instantiate --eval --json \
|
|
||||||
"${prefetchUrlLocation'.file}" \
|
|
||||||
-A "${prefetchUrlLocation'.attrpath}"
|
|
||||||
)
|
|
||||||
|
|
||||||
urlsType=$(jq -rc 'type' <<< "$nixUrlsResult")
|
|
||||||
if [ "$urlsType" = "array" ]; then
|
|
||||||
readarray -t prefetchUrls < <(
|
|
||||||
jq -rc '.[]' <<< "$nixUrlsResult"
|
|
||||||
)
|
|
||||||
elif [ "$urlsType" = "string" ]; then
|
|
||||||
readarray -t prefetchUrls < <(
|
|
||||||
jq -rc '.' <<< "$nixUrlsResult"
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
prefetchSucceeded=1
|
|
||||||
for url in "''${prefetchUrls[@]}"; do
|
|
||||||
echo "trying prefetch '$url'...";
|
|
||||||
expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName})
|
|
||||||
if [[ -n $expectedHash ]]; then
|
|
||||||
echo "prefetch succeeded!"
|
|
||||||
echo "hash: $expectedHash"
|
|
||||||
awk -i inplace "{
|
|
||||||
sub(/${mark''}/, \"$expectedHash\")
|
|
||||||
}1" "${realFileLocation'}"
|
|
||||||
prefetchSucceeded=
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ -n "$prefetchSucceeded" ]]; then
|
|
||||||
echo "warning: prefetch failed" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
'')
|
|
|
@ -1,39 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
path,
|
|
||||||
|
|
||||||
overlayAttrname ? "den-outputs",
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert lib.assertMsg (!lib.hasInfix "." overlayAttrname) (lib.pipe ''
|
|
||||||
overlayAttrname must not contain a dot (.),
|
|
||||||
because dot is used to reference package in a package set
|
|
||||||
inside nix-update-script.
|
|
||||||
'' [
|
|
||||||
lib.lines
|
|
||||||
(lib.concatStringsSep " ")
|
|
||||||
]);
|
|
||||||
|
|
||||||
let
|
|
||||||
updateScript = import (path + /maintainers/scripts/update.nix);
|
|
||||||
functionArgs = lib.functionArgs updateScript;
|
|
||||||
nameInFunctionArgs = name: lib.elem name (lib.attrNames functionArgs);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
__functionArgs = functionArgs // { packages = false; };
|
|
||||||
__functor = _: args: let
|
|
||||||
# args.outputs should be an attrset of packages to update
|
|
||||||
overlay = _: _: {
|
|
||||||
"${overlayAttrname}" = args.packages;
|
|
||||||
};
|
|
||||||
in updateScript (lib.filterAttrs (name: _: nameInFunctionArgs name) args // {
|
|
||||||
include-overlays =
|
|
||||||
if !args ? updateScript then [ overlay ]
|
|
||||||
else if lib.isList args.updateScript then [ overlay ] ++ args.updateScript
|
|
||||||
else args.updateScript;
|
|
||||||
} // lib.optionalAttrs (args ? package) {
|
|
||||||
package = "${overlayAttrname}.${args.package}";
|
|
||||||
} // lib.optionalAttrs (args ? path) {
|
|
||||||
path = if lib.stringLength args.path == 0 then overlayAttrname else "${overlayAttrname}.${args.path}";
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
self:
|
|
||||||
|
|
||||||
# MARK: inputs
|
|
||||||
( let
|
|
||||||
inputsWithPackages = import self.inputsPath {
|
|
||||||
pkgs = self.packagesForSystem builtins.currentSystem;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
"inputs/nixpkgs" = inputsWithPackages.nixpkgs;
|
|
||||||
"inputs/nixpkgs-unstable" = inputsWithPackages.nixpkgs-unstable;
|
|
||||||
"inputs/cosmic-modules" = inputsWithPackages.cosmic-modules;
|
|
||||||
"inputs/nixos-vscode-server" = inputsWithPackages.nixos-vscode-server;
|
|
||||||
})
|
|
Loading…
Add table
Add a link
Reference in a new issue