From 05a798a56e9cd9aba0231319227a5ea500b77c4d Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Fri, 12 Jun 2020 19:18:27 -0600 Subject: [PATCH] flake: add option to install packages from nixos-unstable --- flake.lock | 20 +++++++++++- flake.nix | 36 +++++++++++++--------- hosts/default.nix | 7 +++-- profiles/graphical/qutebrowser/default.nix | 17 +++++----- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index 47ec2f7..2888054 100644 --- a/flake.lock +++ b/flake.lock @@ -57,7 +57,25 @@ "root": { "inputs": { "home": "home", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "unstable": "unstable" + } + }, + "unstable": { + "info": { + "lastModified": 1591465133, + "narHash": "sha256-HdXyiHl8TumxQZhs2/DCSnqbi1GnvqXaZlsJneGf0g0=" + }, + "locked": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "029a5de08390bb03c3f44230b064fd1850c6658a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" } } }, diff --git a/flake.nix b/flake.nix index 124a05d..4138afa 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,10 @@ description = "A highly structured configuration database."; inputs.nixpkgs.url = "nixpkgs/release-20.03"; + inputs.unstable.url = "nixpkgs/nixos-unstable"; inputs.home.url = "github:rycee/home-manager/bqv-flakes"; - outputs = inputs@{ self, home, nixpkgs }: + outputs = inputs@{ self, home, nixpkgs, unstable }: let inherit (builtins) listToAttrs baseNameOf attrNames attrValues readDir; inherit (nixpkgs.lib) removeSuffix; @@ -22,25 +23,30 @@ value = import path; }); - pkgs = import nixpkgs { - inherit system; - overlays = attrValues self.overlays; - config = { allowUnfree = true; }; - }; + pkgImport = pkgs: + import pkgs { + inherit system; + overlays = attrValues self.overlays; + config = { allowUnfree = true; }; + }; + + pkgs = pkgImport nixpkgs; + + unstablePkgs = pkgImport unstable; in { - nixosConfigurations = - let configs = import ./hosts (inputs // { inherit system pkgs; }); - in configs; + nixosConfigurations = let + configs = + import ./hosts (inputs // { inherit system pkgs unstablePkgs; }); + in configs; overlay = import ./pkgs; - overlays = - let - overlayDir = ./overlays; - fullPath = name: overlayDir + "/${name}"; - overlayPaths = map fullPath (attrNames (readDir overlayDir)); - in pathsToImportedAttrs overlayPaths; + overlays = let + overlayDir = ./overlays; + fullPath = name: overlayDir + "/${name}"; + overlayPaths = map fullPath (attrNames (readDir overlayDir)); + in pathsToImportedAttrs overlayPaths; packages.x86_64-linux = { inherit (pkgs) sddm-chili dejavu_nerdfont purs pure; diff --git a/hosts/default.nix b/hosts/default.nix index 092ae6e..5d08509 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,4 @@ -inputs@{ home, nixpkgs, self, pkgs, system, ... }: +inputs@{ home, nixpkgs, unstablePkgs, self, pkgs, system, ... }: let inherit (nixpkgs) lib; @@ -12,7 +12,10 @@ let lib.nixosSystem { inherit system; - specialArgs.usr = { inherit utils; }; + specialArgs = { + inherit unstablePkgs; + usr = { inherit utils; }; + }; modules = let inherit (home.nixosModules) home-manager; diff --git a/profiles/graphical/qutebrowser/default.nix b/profiles/graphical/qutebrowser/default.nix index f6709bb..6f3a820 100644 --- a/profiles/graphical/qutebrowser/default.nix +++ b/profiles/graphical/qutebrowser/default.nix @@ -1,19 +1,20 @@ -{ pkgs, ... }: +{ unstablePkgs, ... }: let inherit (builtins) readFile; in { sound.enable = true; environment = { - etc."xdg/qutebrowser/config.py".text = let mpv = "${pkgs.mpv}/bin/mpv"; - in '' - ${readFile ./config.py} + etc."xdg/qutebrowser/config.py".text = + let mpv = "${unstablePkgs.mpv}/bin/mpv"; + in '' + ${readFile ./config.py} - config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') - config.bind(',v', 'spawn -d ${mpv} {url}') - ''; + config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') + config.bind(',v', 'spawn -d ${mpv} {url}') + ''; sessionVariables.BROWSER = "qute"; - systemPackages = with pkgs; [ qute qutebrowser mpv youtubeDL ]; + systemPackages = with unstablePkgs; [ qute qutebrowser mpv youtubeDL ]; }; }