Don't depend on external nixos-unstable channel

modules can now use unstablePkgs argument
This commit is contained in:
Wroclaw 2024-02-19 06:42:58 +01:00
parent fca3744086
commit ffb6be2ea2
4 changed files with 51 additions and 13 deletions

View file

@ -1,9 +1,9 @@
{ config, pkgs, ... }:
{ config, pkgs, unstablePkgs, ... }:
let
unstable = import <nixos-unstable> { config = config.nixpkgs.config; };
in
{
imports = [
./unstable-packages.nix
];
users.users.wroclaw = {
isNormalUser = true;
description = "Rafał";
@ -20,7 +20,7 @@ in
firefox
vivaldi
discord-canary
unstable.vscode
unstablePkgs.vscode
];
};
users.groups.wroclaw.gid = 1000;

View file

@ -1,9 +1,9 @@
{lib, config, pkgs, ...}:
{lib, config, pkgs, unstablePkgs, ...}:
let
unstable = import <nixos-unstable> {};
in
{
imports = [
../unstable-packages.nix
];
config = rec {
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
@ -207,7 +207,7 @@ in
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.color-picker
gnomeExtensions.top-bar-organizer
# unstable.gnomeExtensions.translate-indicator
# unstablePkgs.gnomeExtensions.translate-indicator
# translate-shell
pavucontrol
#FIXME: Apply the cursor theme also in GTK3 config

View file

@ -1,7 +1,6 @@
{ config, pkgs, ... }:
{ config, pkgs, unstablePkgs, ... }:
let
unstable = import <nixos-unstable> {};
rangerGit = pkgs.ranger.overrideAttrs (old: {
version = "git";
src = pkgs.fetchFromGitHub {
@ -20,6 +19,9 @@ let
});
in
{
imports = [
./unstable-packages.nix
];
environment.systemPackages = with pkgs; [
rangerGit
kitty
@ -50,7 +52,7 @@ in
set vcs_aware true
set show_hidden true
alias drag shell ${unstable.ripdrag}/bin/ripdrag -Axd %p &
alias drag shell ${unstablePkgs.ripdrag}/bin/ripdrag -Axd %p &
map <C-d> drag
'';

View file

@ -0,0 +1,36 @@
{config, pkgs, lib, ...}:
let
nixos-unstable-exprs = builtins.fetchTarball https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz;
nixos-unstable = import nixos-unstable-exprs {
inherit (config.nixpkgs) config localSystem crossSystem;
overlays = if config.unstable.usePkgsOverlays then config.pkgs.overlays else [];
};
nixos-unstable-version = builtins.concatStringsSep "." [
(builtins.readFile "${builtins.toString nixos-unstable-exprs}/.version")
(builtins.readFile "${builtins.toString nixos-unstable-exprs}/.version-suffix")
];
in
{
options.unstable = {
enable = lib.mkEnableOption (lib.mkDoc ''
use of unstable packages in configuration. You can use `unstablePkgs` in configuration modules
'') // { default = true; };
usePkgsOverlays = lib.mkEnableOption (lib.mkDoc ''
use overlays from `nixpkgs.overlays`
'');
pkgs = lib.mkOption {
default = if config.unstable.enable then nixos-unstable else pkgs;
description = lib.mkDoc ''
acts like pkgs, but it has unstable packages if `unstable.enable` is enabled.
You can also use `unstablePkgs` in module arguments.
'';
visible = true;
readOnly = true;
type = lib.types.pkgs;
};
};
config._module.args.unstablePkgs = config.unstable.pkgs;
# FIXME: move it to the system derivation output (overrideAttrs config.system.build.toplevel?)
config.environment.etc."NIXOS-UNSTABLE-VERSION".text = nixos-unstable-version;
}