diff --git a/inputs.nix b/inputs.nix index 334379b..1979433 100644 --- a/inputs.nix +++ b/inputs.nix @@ -15,6 +15,11 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; sha256 = "${lock.nixpkgs.sha256}"; }; + nixpkgs-unstable = builtins.fetchTarball { + name = "nixpkgs-unstable"; + url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; + sha256 = "${lock.nixpkgs-unstable.sha256}"; + }; cosmic-modules = builtins.fetchTarball { name = "cosmic-modules"; url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; diff --git a/lock.nix b/lock.nix index 100cf80..84cd166 100644 --- a/lock.nix +++ b/lock.nix @@ -7,6 +7,10 @@ revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751"; sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4"; }; + nixpkgs-unstable = { + revision = "130595eba61081acde9001f43de3248d8888ac4a"; + sha256 = "0sw7zg4gal3wpz51ch1v36pdan9z73d4f3yrggh8h2clxs8jdgsx"; + }; cosmic-modules = { revision = "a934c861065b6b1aca9a859c45631336e0e8560c"; sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47"; diff --git a/nix-os/unstable-packages.nix b/nix-os/unstable-packages.nix index 4c41240..b39d9f4 100644 --- a/nix-os/unstable-packages.nix +++ b/nix-os/unstable-packages.nix @@ -1,8 +1,14 @@ -{config, pkgs, lib, ...}: +{ + config, + lib, + pkgs, + self, + ... +}: let cfg = config.unstable; - unstableOverlay = import ../pkgs/overlays/unstable.nix; + unstableOverlay = self.overlays.unstableWithMeta; in { options.unstable = { diff --git a/outputs.nix b/outputs.nix index 3355399..e1e2c24 100644 --- a/outputs.nix +++ b/outputs.nix @@ -15,7 +15,7 @@ self = { overlays = { cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; }; selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; }; - unstable = import ./pkgs/overlays/unstable.nix; + unstableWithMeta = import ./pkgs/overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; }; versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; }; }; nixosConfigurations = let diff --git a/pkgs/overlays/unstable-with-meta.nix b/pkgs/overlays/unstable-with-meta.nix new file mode 100644 index 0000000..dbfbc2c --- /dev/null +++ b/pkgs/overlays/unstable-with-meta.nix @@ -0,0 +1,16 @@ +{ + unstableSource, + revision, +}: self: super: + +let + version = builtins.readFile "${unstableSource}/lib/.version" + ".git." + builtins.substring 0 12 revision; + useUnstable = self.config.useUnstable or true; + +in +import ./unstable-from-source.nix { + inherit unstableSource; +} self super // { + unstableVersion = self.lib.optionalString useUnstable version; + unstableRevision = self.lib.optionalString useUnstable revision; +} diff --git a/pkgs/overlays/unstable.nix b/pkgs/overlays/unstable.nix deleted file mode 100644 index 73e79b9..0000000 --- a/pkgs/overlays/unstable.nix +++ /dev/null @@ -1,24 +0,0 @@ -self: super: - -let - nixos = self.config.nixos or true; - useUnstable = self.config.useUnstable or true; - - unstablePkgsExprs = if nixos - then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" - else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; - - # Compiled nixpkgs expression eg expressions from a nix channel - nixpkgsVersion = builtins.concatStringsSep "." [ - (builtins.readFile "${unstablePkgsExprs}/.version") - (builtins.readFile "${unstablePkgsExprs}/.version-suffix") - ]; - - nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision"); -in -import ./unstable-from-source.nix { - unstableSource = unstablePkgsExprs; -} self super // { - unstableVersion = self.lib.optionalString useUnstable nixpkgsVersion; - unstableRevision = self.lib.optionalString useUnstable nixpkgsRevision; -} diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index fd3e12a..dfdae8b 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -14,7 +14,7 @@ let overlays = (args.overlays or []) ++ [ # ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point ( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } ) - ( import ../overlays/unstable.nix ) + ( import ../overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; } ) ( import ../overlays/version-info-fixup.nix { inherit inputs; } ) ( import ./by-name-overlay.nix ../by-name ) ];