From b4cd6cf85b4eb20302ea9895a45a876a56fc01b3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 14 Mar 2024 13:57:54 +0100 Subject: [PATCH] Cosmic: Don't use unstablepkgs for vm by default. make it buildable with stable nixos. --- nix-os/desktopManagers/cosmic.nix | 13 +++++++++++-- nix-os/displayManagers/cosmic-greeter.nix | 14 ++++++++++++-- vm-cosmic.sh | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index a26c073..302c22e 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -1,15 +1,24 @@ -{pkgs, lib, ... }: +{config, lib, pkgs, ... }: let nixos-cosmic = builtins.fetchGit { url = "https://github.com/lilyinstarlight/nixos-cosmic.git"; # rev = "b61e7a0da2fa1d5f05d41e3db6386b2ac5f5079b"; }; + + unstablePkgs = import (builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"); + cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); cosmicPkgsOverlay = final: prev: builtins.listToAttrs ( builtins.map (v: {name = v; value = final.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs ); + + cosmicPkgs = unstablePkgs { + inherit (config.nixpkgs) config localSystem crossSystem; + overlays = [ cosmicPkgsOverlay ]; + }; + finalOverlay = finial: prev: lib.filterAttrs (n: v: builtins.elem n cosmicPkgsDirs) cosmicPkgs; in { imports = [ @@ -17,7 +26,7 @@ in ]; config = { services.xserver.desktopManager.cosmic.enable = true; - nixpkgs.overlays = [ cosmicPkgsOverlay ]; + nixpkgs.overlays = [ finalOverlay ]; nix.settings = { substituters = [ "https://cosmic.cachix.org/" ]; trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; diff --git a/nix-os/displayManagers/cosmic-greeter.nix b/nix-os/displayManagers/cosmic-greeter.nix index b66341a..fcbe0dc 100644 --- a/nix-os/displayManagers/cosmic-greeter.nix +++ b/nix-os/displayManagers/cosmic-greeter.nix @@ -1,15 +1,25 @@ -{pkgs, lib, ... }: +{config, lib, pkgs, ... }: let nixos-cosmic = builtins.fetchGit { url = "https://github.com/lilyinstarlight/nixos-cosmic.git"; # rev = "b61e7a0da2fa1d5f05d41e3db6386b2ac5f5079b"; }; + + unstablePkgs = import (builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"); + cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); cosmicPkgsOverlay = final: prev: builtins.listToAttrs ( builtins.map (v: {name = v; value = final.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs ); + + cosmicPkgs = unstablePkgs { + inherit (config.nixpkgs) config localSystem crossSystem; + overlays = [ cosmicPkgsOverlay ]; + }; + + finalOverlay = finial: prev: lib.filterAttrs (n: v: builtins.elem n cosmicPkgsDirs) cosmicPkgs; in { imports = [ @@ -18,7 +28,7 @@ in config = { services.xserver.desktopManager.cosmic.enable = true; services.xserver.displayManager.cosmic-greeter.enable = true; - nixpkgs.overlays = [ cosmicPkgsOverlay ]; + nixpkgs.overlays = [ finalOverlay ]; nix.settings = { substituters = [ "https://cosmic.cachix.org/" ]; trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; diff --git a/vm-cosmic.sh b/vm-cosmic.sh index b03a0df..c673bab 100755 --- a/vm-cosmic.sh +++ b/vm-cosmic.sh @@ -1 +1 @@ -nix-build '' -A vm -I nixpkgs=channel:nixos-unstable -I nixos-config=./nix-os-configs/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 +nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./nix-os-configs/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2